mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +00:00
Fix Cursor Grab while panning (#4957)
Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
parent
824a597825
commit
2b599a7ff4
@ -76,6 +76,9 @@
|
|||||||
<div
|
<div
|
||||||
ref="chartContainer"
|
ref="chartContainer"
|
||||||
class="gl-plot-chart-wrapper"
|
class="gl-plot-chart-wrapper"
|
||||||
|
:class="[
|
||||||
|
{ 'alt-pressed': altPressed },
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<mct-chart
|
<mct-chart
|
||||||
:rectangles="rectangles"
|
:rectangles="rectangles"
|
||||||
@ -230,6 +233,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
altPressed: false,
|
||||||
highlights: [],
|
highlights: [],
|
||||||
lockHighlightPoint: false,
|
lockHighlightPoint: false,
|
||||||
tickWidth: 0,
|
tickWidth: 0,
|
||||||
@ -268,6 +272,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
document.addEventListener('keydown', this.handleKeyDown);
|
||||||
|
document.addEventListener('keyup', this.handleKeyUp);
|
||||||
eventHelpers.extend(this);
|
eventHelpers.extend(this);
|
||||||
this.updateRealTime = this.updateRealTime.bind(this);
|
this.updateRealTime = this.updateRealTime.bind(this);
|
||||||
this.updateDisplayBounds = this.updateDisplayBounds.bind(this);
|
this.updateDisplayBounds = this.updateDisplayBounds.bind(this);
|
||||||
@ -299,9 +305,21 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
document.removeEventListener('keydown', this.handleKeyDown);
|
||||||
|
document.removeEventListener('keyup', this.handleKeyUp);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleKeyDown(event) {
|
||||||
|
if (event.key === 'Alt') {
|
||||||
|
this.altPressed = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleKeyUp(event) {
|
||||||
|
if (event.key === 'Alt') {
|
||||||
|
this.altPressed = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
setTimeContext() {
|
setTimeContext() {
|
||||||
this.stopFollowingTimeContext();
|
this.stopFollowingTimeContext();
|
||||||
|
|
||||||
|
@ -160,6 +160,10 @@ mct-plot {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
.alt-pressed {
|
||||||
|
// When alt is being pressed and user is hovering over the plot, set the cursor
|
||||||
|
@include cursorGrab();
|
||||||
|
}
|
||||||
|
|
||||||
.gl-plot-axis-area.gl-plot-x {
|
.gl-plot-axis-area.gl-plot-x {
|
||||||
top: auto;
|
top: auto;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user