diff --git a/src/plugins/plot/src/plot/MCTPlotController.js b/src/plugins/plot/src/plot/MCTPlotController.js index b005bb7457..1de14cfad2 100644 --- a/src/plugins/plot/src/plot/MCTPlotController.js +++ b/src/plugins/plot/src/plot/MCTPlotController.js @@ -71,8 +71,6 @@ define([ this.listenTo(this.$canvas, 'mouseleave', this.untrackMousePosition, this); this.listenTo(this.$canvas, 'mousedown', this.onMouseDown, this); this.listenTo(this.$canvas, 'wheel', this.wheelZoom, this); - - this.watchForMarquee(); }; MCTPlotController.prototype.initialize = function () { @@ -83,11 +81,6 @@ define([ this.listenTo(this.$canvas, 'mousedown', this.onMouseDown, this); this.listenTo(this.$canvas, 'wheel', this.wheelZoom, this); - this.watchForMarquee(); - - this.listenTo(this.$window, 'keydown', this.toggleInteractionMode, this); - this.listenTo(this.$window, 'keyup', this.resetInteractionMode, this); - this.$scope.rectangles = []; this.$scope.tickWidth = 0; @@ -243,12 +236,16 @@ define([ }; MCTPlotController.prototype.onMouseDown = function ($event) { + // do not monitor drag events on browser context click + if (event.ctrlKey) { + return; + } + this.listenTo(this.$window, 'mouseup', this.onMouseUp, this); this.listenTo(this.$window, 'mousemove', this.trackMousePosition, this); - if (this.allowPan) { + if (event.altKey) { return this.startPan($event); - } - if (this.allowMarquee) { + } else { return this.startMarquee($event); } }; @@ -261,11 +258,11 @@ define([ this.$scope.lockHighlightPoint = !this.$scope.lockHighlightPoint; } - if (this.allowPan) { + if (this.pan) { return this.endPan($event); } - if (this.allowMarquee) { + if (this.marquee) { return this.endMarquee($event); } }; @@ -289,6 +286,9 @@ define([ }; MCTPlotController.prototype.startMarquee = function ($event) { + this.$canvas.removeClass('plot-drag'); + this.$canvas.addClass('plot-marquee'); + this.trackMousePosition($event); if (this.positionOverPlot) { this.freeze(); @@ -444,6 +444,9 @@ define([ }; MCTPlotController.prototype.startPan = function ($event) { + this.$canvas.addClass('plot-drag'); + this.$canvas.removeClass('plot-marquee'); + this.trackMousePosition($event); this.freeze(); this.pan = { @@ -486,32 +489,6 @@ define([ this.$scope.$emit('user:viewport:change:end'); }; - MCTPlotController.prototype.watchForMarquee = function () { - this.$canvas.removeClass('plot-drag'); - this.$canvas.addClass('plot-marquee'); - this.allowPan = false; - this.allowMarquee = true; - }; - - MCTPlotController.prototype.watchForPan = function () { - this.$canvas.addClass('plot-drag'); - this.$canvas.removeClass('plot-marquee'); - this.allowPan = true; - this.allowMarquee = false; - }; - - MCTPlotController.prototype.toggleInteractionMode = function (event) { - if (event.keyCode === 18) { // control key. - this.watchForPan(); - } - }; - - MCTPlotController.prototype.resetInteractionMode = function (event) { - if (event.keyCode === 18) { - this.watchForMarquee(); - } - }; - MCTPlotController.prototype.freeze = function () { this.config.yAxis.set('frozen', true); this.config.xAxis.set('frozen', true);