Compare commits

...

3 Commits

Author SHA1 Message Date
1153da9f55 [plot] set minimum marquee size
Users must draw a marquee box with diagonal size of atleast 7.5
pixels.  This prevents clicks from being translated to zooms on
the plot.  Because startMarquee triggers a plot history update.
endMarquee must remove the plot history update when preventing
marqueeZoom.  This has a side effect of causing a requery for
data, but is a simple enough solution for now.

Fixes #2002.
2018-05-01 13:51:29 -07:00
ec8b4db2e5 Merge pull request #2004 from nasa/bump-circleci-node-env
Bump Node Version
2018-05-01 13:50:35 -07:00
d6bd09fabf Bump Node Version 2018-04-30 10:41:32 -07:00
2 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,6 @@
machine:
node:
version: 4.7.0
version: 8.11.0
dependencies:
pre:
@ -24,4 +24,4 @@ test:
general:
branches:
ignore:
- gh-pages
- gh-pages

View File

@ -220,6 +220,7 @@ define([
return;
}
this.marquee.end = this.positionOverPlot;
this.marquee.endPixels = this.positionOverElement;
};
MCTPlotController.prototype.startMarquee = function ($event) {
@ -227,6 +228,8 @@ define([
if (this.positionOverPlot) {
this.freeze();
this.marquee = {
startPixels: this.positionOverElement,
endPixels: this.positionOverElement,
start: this.positionOverPlot,
end: this.positionOverPlot,
color: [1, 1, 1, 0.5]
@ -237,8 +240,14 @@ define([
};
MCTPlotController.prototype.endMarquee = function () {
if (this.marquee.start.x !== this.marquee.end.x &&
this.marquee.start.y !== this.marquee.end.y) {
var startPixels = this.marquee.startPixels;
var endPixels = this.marquee.endPixels;
var marqueeDistance = Math.sqrt(
Math.pow(startPixels.x - endPixels.x, 2) +
Math.pow(startPixels.y - endPixels.y, 2)
);
// Don't zoom if mouse moved less than 7.5 pixels.
if (marqueeDistance > 7.5) {
this.$scope.xAxis.set('displayRange', {
min: Math.min(this.marquee.start.x, this.marquee.end.x),
max: Math.max(this.marquee.start.x, this.marquee.end.x)
@ -248,6 +257,10 @@ define([
max: Math.max(this.marquee.start.y, this.marquee.end.y)
});
this.$scope.$emit('user:viewport:change:end');
} else {
// A history entry is created by startMarquee, need to remove
// if marquee zoom doesn't occur.
this.back();
}
this.$scope.rectangles = [];
this.marquee = undefined;