Skip to content

Commit 0a67521

Browse files
committed
Merge branch 'master' into increase-floating-point-precision
2 parents 6dc1036 + ed7d57a commit 0a67521

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
**v0.7.4**
22

33
- Increase floating point precision (#5)
4+
- Fix a rare glitch in the lasso selection where the lasso would be drawn with a far away point
5+
- Smoothify lasso by lowering the min delay and min dist
46

57
**v0.7.3**
68

src/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export const COLOR_NORMAL_IDX = 0;
55
export const COLOR_NUM_STATES = 4;
66
export const FLOAT_BYTES = Float32Array.BYTES_PER_ELEMENT;
77
export const GL_EXTENSIONS = ['OES_standard_derivatives', 'OES_texture_float'];
8-
export const LASSO_MIN_DELAY = 15;
9-
export const LASSO_MIN_DIST = 4;
8+
export const LASSO_MIN_DELAY = 10;
9+
export const LASSO_MIN_DIST = 3;
1010

1111
// Default attribute
1212
export const DEFAULT_DATA_ASPECT_RATIO = 1;

src/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ const createScatterplot = ({
211211
const currMousePos = getMousePos();
212212

213213
if (!lassoPrevMousePos) {
214-
lassoPos.push(...getMouseGlPos(currMousePos));
215-
lassoScatterPos.push(...getScatterGlPos(currMousePos));
214+
lassoPos = [...getMouseGlPos(currMousePos)];
215+
lassoScatterPos = [...getScatterGlPos(currMousePos)];
216216
lassoPrevMousePos = currMousePos;
217217
} else {
218218
const d = dist(...currMousePos, ...lassoPrevMousePos);
@@ -227,7 +227,7 @@ const createScatterplot = ({
227227
}
228228
}
229229
};
230-
let lassoExtendDb = withThrottle(lassoExtend, lassoMinDelay, true);
230+
let lassoExtendDb = withThrottle(lassoExtend, lassoMinDelay);
231231

232232
const findPointsInLasso = lassoPolygon => {
233233
// get the bounding box of the lasso selection...
@@ -296,8 +296,12 @@ const createScatterplot = ({
296296
mouseDownPosition = getRelativeMousePosition(event);
297297
mouseDownShift = event.shiftKey;
298298

299-
// fix camera
300-
if (mouseDownShift) camera.config({ isFixed: true });
299+
if (mouseDownShift) {
300+
// Fix camera for the lasso selection
301+
camera.config({ isFixed: true });
302+
// Make sure we start a new lasso selection
303+
lassoPrevMousePos = undefined;
304+
}
301305
};
302306

303307
const mouseUpHandler = () => {
@@ -753,7 +757,7 @@ const createScatterplot = ({
753757
if (!+newLassoMinDelay) return;
754758

755759
lassoMinDelay = +newLassoMinDelay;
756-
lassoExtendDb = withThrottle(lassoExtend, lassoMinDelay, true);
760+
lassoExtendDb = withThrottle(lassoExtend, lassoMinDelay);
757761
};
758762

759763
const setLassoMinDist = newLassoMinDist => {

0 commit comments

Comments
 (0)