feat(draw): lock shape

This commit is contained in:
alt1o committed 2022-07-28 18:56:39 +08:00
1 parent 5a78afceb2
commit fbce0e11dc
7 files changed
+170 -1

No files matched your search

@@ -3577,6 +3577,24 @@ export class TldrawApp extends StateManager<TDSnapshot> {
);
};
lock = (ids = this.selectedIds): this => {
if (ids.length === 0) {
return this;
}
return this.set_state(
this.commands.setShapesLockStatus(this, ids, true)
);
};
unlock = (ids = this.selectedIds): this => {
if (ids.length === 0) {
return this;
}
return this.set_state(
this.commands.setShapesLockStatus(this, ids, false)
);
};
/**
* Toggle the fixed-aspect-ratio property of one or more shapes.
* @param ids The ids to change (defaults to selection).
@@ -102,4 +102,9 @@ export interface Commands {
updates: ({ id: string } & Partial<TDShape>)[],
pageId: string
): TldrawCommand;
setShapesLockStatus(
app: TldrawApp,
ids: string[],
isLocked: boolean
): TldrawCommand;
}