Skip to content

Commit

Permalink
fix: edge case where zoomToOrigin unsets the fixed camera (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
flekschas authored Dec 11, 2024
1 parent 0162422 commit e2f0db8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.11.3

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

## 1.11.2

- 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))
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ const createScatterplot = (
'transitionEnd',
() => {
resolve();
camera.config({ isFixed: false });
camera.config({ isFixed: cameraIsFixed });
},
1,
);
Expand Down
4 changes: 4 additions & 0 deletions tests/get-set.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ test('set({ cameraIsFixed })', async () => {
scatterplot.set({ cameraIsFixed: true });
expect(scatterplot.get('cameraIsFixed')).toBe(true);

// Adding this here to triple check that the programmatic zoom does not unset
// the camera fixed state
await scatterplot.zoomToOrigin();

canvas.dispatchEvent(new WheelEvent('wheel', { deltaY: -100 }));

await nextAnimationFrame();
Expand Down

0 comments on commit e2f0db8

Please sign in to comment.