mirror of
https://github.com/nasa/openmct.git
synced 2025-03-12 07:24:13 +00:00
Don't disallow mouse events when in compact mode for plots (#7975)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
e2e-couchdb / e2e-couchdb (push) Has been cancelled
e2e-perf / e2e-full (push) Has been cancelled
e2e-pr / e2e-full (ubuntu-latest) (push) Has been cancelled
e2e-pr / e2e-full (windows-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, macos-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, ubuntu-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, windows-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, macos-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, ubuntu-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, windows-latest) (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on macos-latest (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on ubuntu-latest (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on windows-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on macos-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on ubuntu-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on windows-latest (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
e2e-couchdb / e2e-couchdb (push) Has been cancelled
e2e-perf / e2e-full (push) Has been cancelled
e2e-pr / e2e-full (ubuntu-latest) (push) Has been cancelled
e2e-pr / e2e-full (windows-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, macos-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, ubuntu-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/hydrogen, windows-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, macos-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, ubuntu-latest) (push) Has been cancelled
pr-platform / Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} (x64, lts/iron, windows-latest) (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on macos-latest (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on ubuntu-latest (push) Has been cancelled
pr-platform / Node lts/hydrogen - x64 on windows-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on macos-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on ubuntu-latest (push) Has been cancelled
pr-platform / Node lts/iron - x64 on windows-latest (push) Has been cancelled
* Allow highlights and locking highlight points for plots in compact mode, but still disallow pan and zoom. * Remove unnecessary watch on cursor guides and grid lines * Test for cursor guides in compact mode
This commit is contained in:
parent
5be103ea72
commit
1fde0d9e38
@ -0,0 +1,58 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2025, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This test suite is dedicated to testing the rendering and interaction of plots.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
|
||||||
|
import { expect, test } from '../../../../pluginFixtures.js';
|
||||||
|
|
||||||
|
test.describe('Plot Controls in compact mode', () => {
|
||||||
|
let timeStrip;
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
timeStrip = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Time Strip'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create an overlay plot with a sine wave generator
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Sine Wave Generator',
|
||||||
|
parent: timeStrip.uuid
|
||||||
|
});
|
||||||
|
await page.goto(`${timeStrip.url}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Plots show cursor guides', async ({ page }) => {
|
||||||
|
// hover over plot for plot controls
|
||||||
|
await page.getByLabel('Plot Canvas').hover();
|
||||||
|
// click on cursor guides control
|
||||||
|
await page.getByTitle('Toggle cursor guides').click();
|
||||||
|
await page.getByLabel('Plot Canvas').hover();
|
||||||
|
await expect(page.getByLabel('Vertical cursor guide')).toBeVisible();
|
||||||
|
await expect(page.getByLabel('Horizontal cursor guide')).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
@ -164,11 +164,13 @@
|
|||||||
<div
|
<div
|
||||||
v-show="cursorGuide"
|
v-show="cursorGuide"
|
||||||
ref="cursorGuideVertical"
|
ref="cursorGuideVertical"
|
||||||
|
aria-label="Vertical cursor guide"
|
||||||
class="c-cursor-guide--v js-cursor-guide--v"
|
class="c-cursor-guide--v js-cursor-guide--v"
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
v-show="cursorGuide"
|
v-show="cursorGuide"
|
||||||
ref="cursorGuideHorizontal"
|
ref="cursorGuideHorizontal"
|
||||||
|
aria-label="Horizontal cursor guide"
|
||||||
class="c-cursor-guide--h js-cursor-guide--h"
|
class="c-cursor-guide--h js-cursor-guide--h"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
@ -854,13 +856,11 @@ export default {
|
|||||||
|
|
||||||
this.canvas = this.$refs.chartContainer.querySelectorAll('canvas')[1];
|
this.canvas = this.$refs.chartContainer.querySelectorAll('canvas')[1];
|
||||||
|
|
||||||
if (!this.options.compact) {
|
this.listenTo(this.canvas, 'mousemove', this.trackMousePosition, this);
|
||||||
this.listenTo(this.canvas, 'mousemove', this.trackMousePosition, this);
|
this.listenTo(this.canvas, 'mouseleave', this.untrackMousePosition, this);
|
||||||
this.listenTo(this.canvas, 'mouseleave', this.untrackMousePosition, this);
|
this.listenTo(this.canvas, 'mousedown', this.onMouseDown, this);
|
||||||
this.listenTo(this.canvas, 'mousedown', this.onMouseDown, this);
|
this.listenTo(this.canvas, 'click', this.selectNearbyAnnotations, this);
|
||||||
this.listenTo(this.canvas, 'click', this.selectNearbyAnnotations, this);
|
this.listenTo(this.canvas, 'wheel', this.wheelZoom, this);
|
||||||
this.listenTo(this.canvas, 'wheel', this.wheelZoom, this);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
marqueeAnnotations(annotationsToSelect) {
|
marqueeAnnotations(annotationsToSelect) {
|
||||||
@ -1115,19 +1115,21 @@ export default {
|
|||||||
this.listenTo(window, 'mouseup', this.onMouseUp, this);
|
this.listenTo(window, 'mouseup', this.onMouseUp, this);
|
||||||
this.listenTo(window, 'mousemove', this.trackMousePosition, this);
|
this.listenTo(window, 'mousemove', this.trackMousePosition, this);
|
||||||
|
|
||||||
// track frozen state on mouseDown to be read on mouseUp
|
if (!this.options.compact) {
|
||||||
const isFrozen =
|
// track frozen state on mouseDown to be read on mouseUp
|
||||||
this.config.xAxis.get('frozen') === true && this.config.yAxis.get('frozen') === true;
|
const isFrozen =
|
||||||
this.isFrozenOnMouseDown = isFrozen;
|
this.config.xAxis.get('frozen') === true && this.config.yAxis.get('frozen') === true;
|
||||||
|
this.isFrozenOnMouseDown = isFrozen;
|
||||||
|
|
||||||
if (event.altKey && !event.shiftKey) {
|
if (event.altKey && !event.shiftKey) {
|
||||||
return this.startPan(event);
|
return this.startPan(event);
|
||||||
} else if (event.altKey && event.shiftKey) {
|
} else if (event.altKey && event.shiftKey) {
|
||||||
this.freeze();
|
this.freeze();
|
||||||
|
|
||||||
return this.startMarquee(event, true);
|
return this.startMarquee(event, true);
|
||||||
} else {
|
} else {
|
||||||
return this.startMarquee(event, false);
|
return this.startMarquee(event, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1158,11 +1160,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isMouseClick() {
|
isMouseClick() {
|
||||||
if (!this.marquee) {
|
// We may not have a marquee if we've disabled pan/zoom, but we still need to know if it's a mouse click for highlights and lock points.
|
||||||
|
if (!this.marquee && !this.positionOverPlot) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { start, end } = this.marquee;
|
const { start, end } = this.marquee ?? {
|
||||||
|
start: this.positionOverPlot,
|
||||||
|
end: this.positionOverPlot
|
||||||
|
};
|
||||||
const someYPositionOverPlot = start.y.some((y) => y);
|
const someYPositionOverPlot = start.y.some((y) => y);
|
||||||
|
|
||||||
return start.x === end.x && someYPositionOverPlot;
|
return start.x === end.x && someYPositionOverPlot;
|
||||||
|
@ -162,14 +162,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
gridLines(newGridLines) {
|
|
||||||
this.gridLines = newGridLines;
|
|
||||||
},
|
|
||||||
cursorGuide(newCursorGuide) {
|
|
||||||
this.cursorGuide = newCursorGuide;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
eventHelpers.extend(this);
|
eventHelpers.extend(this);
|
||||||
this.imageExporter = new ImageExporter(this.openmct);
|
this.imageExporter = new ImageExporter(this.openmct);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user