feat: add constraints on canvas actions

This commit is contained in:
Arnošt Pleskot 2024-02-09 20:09:00 +01:00
parent 213134bbca
commit 78d2a6ecc0
No known key found for this signature in database

View file

@ -22,6 +22,7 @@ import {
import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors"; import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
import { SceneBounds } from "../element/bounds"; import { SceneBounds } from "../element/bounds";
import { setCursor } from "../cursor"; import { setCursor } from "../cursor";
import { constrainScrollState } from "../scene/scrollConstraints";
export const actionChangeViewBackgroundColor = register({ export const actionChangeViewBackgroundColor = register({
name: "changeViewBackgroundColor", name: "changeViewBackgroundColor",
@ -137,7 +138,7 @@ export const actionZoomOut = register({
trackEvent: { category: "canvas" }, trackEvent: { category: "canvas" },
perform: (_elements, appState, _, app) => { perform: (_elements, appState, _, app) => {
return { return {
appState: { appState: constrainScrollState({
...appState, ...appState,
...getStateForZoom( ...getStateForZoom(
{ {
@ -148,7 +149,7 @@ export const actionZoomOut = register({
appState, appState,
), ),
userToFollow: null, userToFollow: null,
}, }),
commitToHistory: false, commitToHistory: false,
}; };
}, },