feat: disable animations during zooms out of translate canvas

This commit is contained in:
Arnošt Pleskot
2024-02-09 20:57:18 +01:00
parent 78d2a6ecc0
commit d6710ded04
3 changed files with 43 additions and 29 deletions

View File

@@ -100,18 +100,21 @@ export const actionZoomIn = register({
trackEvent: { category: "canvas" },
perform: (_elements, appState, _, app) => {
return {
appState: {
...appState,
...getStateForZoom(
{
viewportX: appState.width / 2 + appState.offsetLeft,
viewportY: appState.height / 2 + appState.offsetTop,
nextZoom: getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
},
appState,
),
userToFollow: null,
},
appState: constrainScrollState(
{
...appState,
...getStateForZoom(
{
viewportX: appState.width / 2 + appState.offsetLeft,
viewportY: appState.height / 2 + appState.offsetTop,
nextZoom: getNormalizedZoom(appState.zoom.value + ZOOM_STEP),
},
appState,
),
userToFollow: null,
},
{ disableAnimation: true },
),
commitToHistory: false,
};
},
@@ -138,18 +141,21 @@ export const actionZoomOut = register({
trackEvent: { category: "canvas" },
perform: (_elements, appState, _, app) => {
return {
appState: constrainScrollState({
...appState,
...getStateForZoom(
{
viewportX: appState.width / 2 + appState.offsetLeft,
viewportY: appState.height / 2 + appState.offsetTop,
nextZoom: getNormalizedZoom(appState.zoom.value - ZOOM_STEP),
},
appState,
),
userToFollow: null,
}),
appState: constrainScrollState(
{
...appState,
...getStateForZoom(
{
viewportX: appState.width / 2 + appState.offsetLeft,
viewportY: appState.height / 2 + appState.offsetTop,
nextZoom: getNormalizedZoom(appState.zoom.value - ZOOM_STEP),
},
appState,
),
userToFollow: null,
},
{ disableAnimation: true },
),
commitToHistory: false,
};
},