mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(draw): lock shape
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user