mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
improve plot gestures - and clean up (#3013)
This commit is contained in:
@ -67,10 +67,10 @@ define([
|
|||||||
}
|
}
|
||||||
this.$canvas = this.$element.find('canvas');
|
this.$canvas = this.$element.find('canvas');
|
||||||
|
|
||||||
this.listenTo(this.$canvas, 'click', this.onMouseClick, this);
|
|
||||||
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, 'wheel', this.wheelZoom, this);
|
||||||
|
|
||||||
this.watchForMarquee();
|
this.watchForMarquee();
|
||||||
};
|
};
|
||||||
@ -78,7 +78,6 @@ define([
|
|||||||
MCTPlotController.prototype.initialize = function () {
|
MCTPlotController.prototype.initialize = function () {
|
||||||
this.$canvas = this.$element.find('canvas');
|
this.$canvas = this.$element.find('canvas');
|
||||||
|
|
||||||
this.listenTo(this.$canvas, 'click', this.onMouseClick, this);
|
|
||||||
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);
|
||||||
@ -210,23 +209,6 @@ define([
|
|||||||
this.highlightValues(point);
|
this.highlightValues(point);
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTPlotController.prototype.onMouseClick = function ($event) {
|
|
||||||
const isClick = this.isMouseClick();
|
|
||||||
if (this.pan) {
|
|
||||||
this.endPan($event);
|
|
||||||
}
|
|
||||||
if (this.marquee) {
|
|
||||||
this.endMarquee($event);
|
|
||||||
}
|
|
||||||
this.$scope.$apply();
|
|
||||||
|
|
||||||
if (!this.$scope.highlights.length || !isClick) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$scope.lockHighlightPoint = !this.$scope.lockHighlightPoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
MCTPlotController.prototype.highlightValues = function (point) {
|
MCTPlotController.prototype.highlightValues = function (point) {
|
||||||
this.highlightPoint = point;
|
this.highlightPoint = point;
|
||||||
this.$scope.$emit('plot:highlight:update', point);
|
this.$scope.$emit('plot:highlight:update', point);
|
||||||
@ -274,11 +256,23 @@ define([
|
|||||||
MCTPlotController.prototype.onMouseUp = function ($event) {
|
MCTPlotController.prototype.onMouseUp = function ($event) {
|
||||||
this.stopListening(this.$window, 'mouseup', this.onMouseUp, this);
|
this.stopListening(this.$window, 'mouseup', this.onMouseUp, this);
|
||||||
this.stopListening(this.$window, 'mousemove', this.trackMousePosition, this);
|
this.stopListening(this.$window, 'mousemove', this.trackMousePosition, this);
|
||||||
|
|
||||||
|
if (this.isMouseClick()) {
|
||||||
|
this.$scope.lockHighlightPoint = !this.$scope.lockHighlightPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.allowPan) {
|
||||||
|
return this.endPan($event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.allowMarquee) {
|
||||||
|
return this.endMarquee($event);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTPlotController.prototype.isMouseClick = function () {
|
MCTPlotController.prototype.isMouseClick = function () {
|
||||||
if (!this.marquee) {
|
if (!this.marquee) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { start, end } = this.marquee;
|
const { start, end } = this.marquee;
|
||||||
|
Reference in New Issue
Block a user