mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: split gridSize
from enabled state & support custom gridStep
(#8364)
This commit is contained in:
parent
4320a3cf41
commit
3cfcc7b489
31 changed files with 737 additions and 278 deletions
15
packages/excalidraw/scene/normalize.ts
Normal file
15
packages/excalidraw/scene/normalize.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { MAX_ZOOM, MIN_ZOOM } from "../constants";
|
||||
import { clamp, round } from "../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);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue