mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 11:59:51 +08:00
init: the first public commit for AFFiNE
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import type { TldrawCommand } from '@toeverything/components/board-types';
|
||||
import { TLDR } from '@toeverything/components/board-state';
|
||||
import type { TldrawApp } from '@toeverything/components/board-state';
|
||||
|
||||
export function resetBounds(
|
||||
app: TldrawApp,
|
||||
ids: string[],
|
||||
pageId: string
|
||||
): TldrawCommand {
|
||||
const { currentPageId } = app;
|
||||
|
||||
const { before, after } = TLDR.mutate_shapes(
|
||||
app.state,
|
||||
ids,
|
||||
shape => app.getShapeUtil(shape).onDoubleClickBoundsHandle?.(shape),
|
||||
pageId
|
||||
);
|
||||
|
||||
return {
|
||||
id: 'reset_bounds',
|
||||
before: {
|
||||
document: {
|
||||
pages: {
|
||||
[currentPageId]: { shapes: before },
|
||||
},
|
||||
pageStates: {
|
||||
[currentPageId]: {
|
||||
selectedIds: ids,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
after: {
|
||||
document: {
|
||||
pages: {
|
||||
[currentPageId]: { shapes: after },
|
||||
},
|
||||
pageStates: {
|
||||
[currentPageId]: {
|
||||
selectedIds: ids,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user