Skip to content

Commit 60d1d68

Browse files
committed
Avoid empty lasso events
1 parent 560dbd0 commit 60d1d68

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## v0.16.2
44

55
- Stop calling `camera.refresh()` as that is unnecessary since `v1.2.2`
6+
- Avoid empty lasso events
67

78
## v0.16.1
89

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ const createScatterplot = (initialProperties = {}) => {
726726
};
727727

728728
const mouseDblClickHandler = () => {
729+
lassoManager.hideInitiator();
729730
if (lassoInitiatorTimeout) {
730731
clearTimeout(lassoInitiatorTimeout);
731732
lassoInitiatorTimeout = null;

src/lasso-manager/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const createLasso = (
197197
});
198198
};
199199

200-
const hideinitiator = () => {
200+
const hideInitiator = () => {
201201
const { opacity, scale, rotate } = getCurrentinitiatorAnimationStyle();
202202
initiator.style.opacity = opacity;
203203
initiator.style.transform = `translate(-50%,-50%) scale(${scale}) rotate(${rotate}deg)`;
@@ -284,7 +284,7 @@ const createLasso = (
284284
};
285285

286286
const initiatorMouseLeaveHandler = () => {
287-
hideinitiator();
287+
hideInitiator();
288288
};
289289

290290
const end = ({ merge = false } = {}) => {
@@ -297,7 +297,8 @@ const createLasso = (
297297

298298
clear();
299299

300-
onEnd(currLassoPos, currLassoPosFlat, { merge });
300+
// When `currLassoPos` is empty the user didn't actually lasso
301+
if (currLassoPos.length) onEnd(currLassoPos, currLassoPosFlat, { merge });
301302

302303
return currLassoPos;
303304
};
@@ -355,6 +356,7 @@ const createLasso = (
355356
extend: extendPublic,
356357
set,
357358
showInitiator,
359+
hideInitiator,
358360
});
359361

360362
initiatorParentElement.appendChild(initiator);

0 commit comments

Comments
 (0)