Skip to content

Commit e2f0db8

Browse files
authored
fix: edge case where zoomToOrigin unsets the fixed camera (#203)
1 parent 0162422 commit e2f0db8

3 files changed

Lines changed: 9 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.3
2+
3+
- Fix: catch another edge case where `zoomToOrigin` was unsetting the camera fixed state
4+
15
## 1.11.2
26

37
- Fix: handle camera fixing better by adding a dedicated prop called `cameraIsFixed`. Previously, the lasso end interaction would unset the camera fixing. ([#94](https://github.com/flekschas/regl-scatterplot/issues/94))

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ const createScatterplot = (
27802780
'transitionEnd',
27812781
() => {
27822782
resolve();
2783-
camera.config({ isFixed: false });
2783+
camera.config({ isFixed: cameraIsFixed });
27842784
},
27852785
1,
27862786
);

tests/get-set.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,10 @@ test('set({ cameraIsFixed })', async () => {
661661
scatterplot.set({ cameraIsFixed: true });
662662
expect(scatterplot.get('cameraIsFixed')).toBe(true);
663663

664+
// Adding this here to triple check that the programmatic zoom does not unset
665+
// the camera fixed state
666+
await scatterplot.zoomToOrigin();
667+
664668
canvas.dispatchEvent(new WheelEvent('wheel', { deltaY: -100 }));
665669

666670
await nextAnimationFrame();

0 commit comments

Comments
 (0)