Skip to content

Commit 6259d9a

Browse files
authored
fix: expose lassoLongPressIndicatorParentElement (#205)
1 parent 0b1a61d commit 6259d9a

4 files changed

Lines changed: 28 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.11.4
2+
3+
- Fix: allow setting the lasso long press indicator parent element
4+
15
## 1.11.3
26

37
- Fix: catch another edge case where `zoomToOrigin` was unsetting the camera fixed state

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ can be read and written via [`scatterplot.get()`](#scatterplot.get) and [`scatte
798798
| lassoInitiator | boolean | `false` | | `true` | `false` |
799799
| lassoInitiatorElement | object | the lasso dom element | | `false` | `false` |
800800
| lassoInitiatorParentElement | object | `document.body` | | `true` | `false` |
801+
| lassoLongPressIndicatorParentElement | object | `document.body` | | `true` | `false` |
801802
| lassoOnLongPress | boolean | `false` | | `true` | `false` |
802803
| lassoLongPressTime | int | `750` | | `true` | `false` |
803804
| lassoLongPressAfterEffectTime | int | `500` | | `true` | `false` |

src/index.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const createScatterplot = (
247247
lassoClearEvent = DEFAULT_LASSO_CLEAR_EVENT,
248248
lassoInitiator = DEFAULT_LASSO_INITIATOR,
249249
lassoInitiatorParentElement = document.body,
250+
lassoLongPressIndicatorParentElement = document.body,
250251
lassoOnLongPress = DEFAULT_LASSO_ON_LONG_PRESS,
251252
lassoLongPressTime = DEFAULT_LASSO_LONG_PRESS_TIME,
252253
lassoLongPressAfterEffectTime = DEFAULT_LASSO_LONG_PRESS_AFTER_EFFECT_TIME,
@@ -909,6 +910,7 @@ const createScatterplot = (
909910
onEnd: lassoEnd,
910911
enableInitiator: lassoInitiator,
911912
initiatorParentElement: lassoInitiatorParentElement,
913+
longPressIndicatorParentElement: lassoLongPressIndicatorParentElement,
912914
pointNorm: ([x, y]) => getScatterGlPos(getNdcX(x), getNdcY(y)),
913915
});
914916

@@ -2994,7 +2996,15 @@ const createScatterplot = (
29942996
lassoInitiatorParentElement = newLassoInitiatorParentElement;
29952997

29962998
lassoManager.set({
2997-
startInitiatorParentElement: lassoInitiatorParentElement,
2999+
initiatorParentElement: lassoInitiatorParentElement,
3000+
});
3001+
};
3002+
3003+
const setLassoLongPressIndicatorParentElement = (newParentElement) => {
3004+
lassoLongPressIndicatorParentElement = newParentElement;
3005+
3006+
lassoManager.set({
3007+
longPressIndicatorParentElement: lassoLongPressIndicatorParentElement,
29983008
});
29993009
};
30003010

@@ -3362,6 +3372,11 @@ const createScatterplot = (
33623372
if (property === 'lassoInitiatorParentElement') {
33633373
return lassoInitiatorParentElement;
33643374
}
3375+
3376+
if (property === 'lassoLongPressIndicatorParentElement') {
3377+
return lassoLongPressIndicatorParentElement;
3378+
}
3379+
33653380
if (property === 'keyMap') {
33663381
return { ...keyMap };
33673382
}
@@ -3757,6 +3772,12 @@ const createScatterplot = (
37573772
setLassoInitiatorParentElement(properties.lassoInitiatorParentElement);
37583773
}
37593774

3775+
if (properties.lassoLongPressIndicatorParentElement !== undefined) {
3776+
setLassoLongPressIndicatorParentElement(
3777+
properties.lassoLongPressIndicatorParentElement,
3778+
);
3779+
}
3780+
37603781
if (properties.lassoOnLongPress !== undefined) {
37613782
setLassoOnLongPress(properties.lassoOnLongPress);
37623783
}

src/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export type Properties = {
205205
syncEvents: boolean;
206206
version: string;
207207
lassoInitiatorElement: HTMLElement;
208+
lassoLongPressIndicatorParentElement: HTMLElement;
208209
camera: Camera2D;
209210
performanceMode: boolean;
210211
opacityByDensityDebounceTime: number;

0 commit comments

Comments
 (0)