mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-08 14:54:31 +01:00
feat: disable animations during zooms out of translate canvas
This commit is contained in:
@@ -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,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user