fix(whiteboard): editor init size when creating new editor

This commit is contained in:
austaras
2022-08-04 11:24:28 +08:00
committed by Austaras
parent fbe9add924
commit 62cd0b4424
4 changed files with 16 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ import { StateManager } from './manager/state-manager';
import { getClipboard, setClipboard } from './idb-clipboard';
import type { Commands } from './types/commands';
import type { BaseTool } from './types/tool';
import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core';
const uuid = Utils.uniqueId();
@@ -178,6 +179,7 @@ export interface TldrawAppCtorProps {
getSession: (type: SessionType) => {
new (app: TldrawApp, ...args: any[]): BaseSessionType;
};
editorShapeInitSize?: number;
commands: Commands;
tools: Record<string, { new (app: TldrawApp): BaseTool }>;
}
@@ -223,6 +225,8 @@ export class TldrawApp extends StateManager<TDSnapshot> {
fileSystemHandle: FileSystemHandle | null = null;
editorShapeInitSize = MIN_PAGE_WIDTH;
viewport = Utils.getBoundsFromPoints([
[0, 0],
[100, 100],
@@ -285,6 +289,10 @@ export class TldrawApp extends StateManager<TDSnapshot> {
return acc;
}, {} as Record<string, BaseTool>);
this.currentTool = this.tools['select'];
if (props.editorShapeInitSize) {
this.editorShapeInitSize = props.editorShapeInitSize;
}
}
/* -------------------- Internal -------------------- */