snapshot of https://github.com/excalidraw/excalidraw.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Tests / test (push) Failing after 15s
Some checks failed
Tests / test (push) Failing after 15s
This commit is contained in:
17
packages/excalidraw/scene/normalize.ts
Normal file
17
packages/excalidraw/scene/normalize.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { MAX_ZOOM, MIN_ZOOM } from "@excalidraw/common";
|
||||
|
||||
import { clamp, round } from "@excalidraw/math";
|
||||
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
|
||||
export const getNormalizedZoom = (zoom: number): NormalizedZoomValue => {
|
||||
return clamp(round(zoom, 6), MIN_ZOOM, MAX_ZOOM) as NormalizedZoomValue;
|
||||
};
|
||||
|
||||
export const getNormalizedGridSize = (gridStep: number) => {
|
||||
return clamp(Math.round(gridStep), 1, 100);
|
||||
};
|
||||
|
||||
export const getNormalizedGridStep = (gridStep: number) => {
|
||||
return clamp(Math.round(gridStep), 1, 100);
|
||||
};
|
||||
Reference in New Issue
Block a user