mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-18 06:50:31 +02:00

With the infinite scroll behavior, it's easy to scroll super far away from where the content is and have a hard time getting back. This PR adds a button to refocus on the center of the scene when no elements are visible anymore.
37 lines
935 B
TypeScript
37 lines
935 B
TypeScript
import { AppState } from "./types";
|
|
import { getDateTime } from "./utils";
|
|
|
|
const DEFAULT_PROJECT_NAME = `excalidraw-${getDateTime()}`;
|
|
|
|
export function getDefaultAppState(): AppState {
|
|
return {
|
|
draggingElement: null,
|
|
resizingElement: null,
|
|
multiElement: null,
|
|
editingElement: null,
|
|
elementType: "selection",
|
|
elementLocked: false,
|
|
exportBackground: true,
|
|
currentItemStrokeColor: "#000000",
|
|
currentItemBackgroundColor: "transparent",
|
|
currentItemFillStyle: "hachure",
|
|
currentItemStrokeWidth: 1,
|
|
currentItemRoughness: 1,
|
|
currentItemOpacity: 100,
|
|
currentItemFont: "20px Virgil",
|
|
viewBackgroundColor: "#ffffff",
|
|
scrollX: 0,
|
|
scrollY: 0,
|
|
cursorX: 0,
|
|
cursorY: 0,
|
|
scrolledOutside: false,
|
|
name: DEFAULT_PROJECT_NAME,
|
|
};
|
|
}
|
|
|
|
export function cleanAppStateForExport(appState: AppState) {
|
|
return {
|
|
viewBackgroundColor: appState.viewBackgroundColor,
|
|
};
|
|
}
|