mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-22 08:50:56 +02:00
feat: split gridSize
from enabled state & support custom gridStep
(#8364)
This commit is contained in:
@@ -40,7 +40,7 @@ import type { FileSystemHandle } from "./data/filesystem";
|
||||
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
||||
import type { ContextMenuItems } from "./components/ContextMenu";
|
||||
import type { SnapLine } from "./snapping";
|
||||
import type { Merge, MaybePromise, ValueOf } from "./utility-types";
|
||||
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types";
|
||||
import type { StoreActionType } from "./store";
|
||||
|
||||
export type Point = Readonly<RoughPoint>;
|
||||
@@ -176,6 +176,7 @@ export type StaticCanvasAppState = Readonly<
|
||||
exportScale: AppState["exportScale"];
|
||||
selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
|
||||
gridSize: AppState["gridSize"];
|
||||
gridStep: AppState["gridStep"];
|
||||
frameRendering: AppState["frameRendering"];
|
||||
currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
|
||||
}
|
||||
@@ -351,7 +352,10 @@ export interface AppState {
|
||||
toast: { message: string; closable?: boolean; duration?: number } | null;
|
||||
zenModeEnabled: boolean;
|
||||
theme: Theme;
|
||||
gridSize: number | null;
|
||||
/** grid cell px size */
|
||||
gridSize: number;
|
||||
gridStep: number;
|
||||
gridModeEnabled: boolean;
|
||||
viewModeEnabled: boolean;
|
||||
|
||||
/** top-most selected groups (i.e. does not include nested groups) */
|
||||
@@ -615,6 +619,7 @@ export type AppProps = Merge<
|
||||
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
|
||||
export type AppClassProperties = {
|
||||
props: AppProps;
|
||||
state: AppState;
|
||||
interactiveCanvas: HTMLCanvasElement | null;
|
||||
/** static canvas */
|
||||
canvas: HTMLCanvasElement;
|
||||
@@ -649,6 +654,7 @@ export type AppClassProperties = {
|
||||
getName: App["getName"];
|
||||
dismissLinearEditor: App["dismissLinearEditor"];
|
||||
flowChartCreator: App["flowChartCreator"];
|
||||
getEffectiveGridSize: App["getEffectiveGridSize"];
|
||||
};
|
||||
|
||||
export type PointerDownState = Readonly<{
|
||||
@@ -831,3 +837,8 @@ export type EmbedsValidationStatus = Map<
|
||||
export type ElementsPendingErasure = Set<ExcalidrawElement["id"]>;
|
||||
|
||||
export type PendingExcalidrawElements = ExcalidrawElement[];
|
||||
|
||||
/** Runtime gridSize value. Null indicates disabled grid. */
|
||||
export type NullableGridSize =
|
||||
| (AppState["gridSize"] & MakeBrand<"NullableGridSize">)
|
||||
| null;
|
||||
|
Reference in New Issue
Block a user