mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 09:26:45 +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
|
||||
ref="chartContainer"
|
||||
class="gl-plot-chart-wrapper"
|
||||
:class="[
|
||||
{ 'alt-pressed': altPressed },
|
||||
]"
|
||||
>
|
||||
<mct-chart
|
||||
:rectangles="rectangles"
|
||||
@ -230,6 +233,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
altPressed: false,
|
||||
highlights: [],
|
||||
lockHighlightPoint: false,
|
||||
tickWidth: 0,
|
||||
@ -268,6 +272,8 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.addEventListener('keydown', this.handleKeyDown);
|
||||
document.addEventListener('keyup', this.handleKeyUp);
|
||||
eventHelpers.extend(this);
|
||||
this.updateRealTime = this.updateRealTime.bind(this);
|
||||
this.updateDisplayBounds = this.updateDisplayBounds.bind(this);
|
||||
@ -299,9 +305,21 @@ export default {
|
||||
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('keydown', this.handleKeyDown);
|
||||
document.removeEventListener('keyup', this.handleKeyUp);
|
||||
this.destroy();
|
||||
},
|
||||
methods: {
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Alt') {
|
||||
this.altPressed = true;
|
||||
}
|
||||
},
|
||||
handleKeyUp(event) {
|
||||
if (event.key === 'Alt') {
|
||||
this.altPressed = false;
|
||||
}
|
||||
},
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
|
||||
|
@ -160,6 +160,10 @@ mct-plot {
|
||||
bottom: 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 {
|
||||
top: auto;
|
||||
|
Loading…
x
Reference in New Issue
Block a user