fix(refboard): full sync audit — batch multi-drag, persist resize, sync lock
- Batch broadcastTransform: sends all selected items in one emit instead of throttle-dropping all but the first (multi-select drag now syncs all) - TransformBox onDragEnd: persist+sync final state after resize/rotate (was only broadcasting ephemeral transforms, never the final position) - Layer lock toggle: add missing onCanvasChange() call for sync+save - Receiver handles both batched and legacy single-item transform formats
This commit is contained in:
@@ -40,6 +40,7 @@ export class SelectionManager {
|
||||
private _bandGfx: Graphics;
|
||||
private _onSelectionChange: ((ids: string[]) => void) | null = null;
|
||||
private _onItemTransform: ((item: SceneItem) => void) | null = null;
|
||||
private _onItemsTransform: ((items: SceneItem[]) => void) | null = null;
|
||||
|
||||
// Pointer state
|
||||
private _pointerDown = false;
|
||||
@@ -116,6 +117,11 @@ export class SelectionManager {
|
||||
this._onItemTransform = fn;
|
||||
}
|
||||
|
||||
/** Called during drag with ALL moved items for batched sync broadcast. */
|
||||
set onItemsTransform(fn: (items: SceneItem[]) => void) {
|
||||
this._onItemsTransform = fn;
|
||||
}
|
||||
|
||||
/** Called on double-click of a text item (for inline editing). */
|
||||
set onDoubleClickText(fn: (item: SceneItem) => void) {
|
||||
this._onDoubleClickText = fn;
|
||||
@@ -260,13 +266,17 @@ export class SelectionManager {
|
||||
ddy += snap.dy;
|
||||
this._snapGuides.drawGuides(snap.guides, this._viewport);
|
||||
|
||||
// Move all selected items by corrected delta and broadcast transforms
|
||||
// Move all selected items by corrected delta and broadcast all together
|
||||
for (const item of selected) {
|
||||
item.displayObject.x += ddx;
|
||||
item.displayObject.y += ddy;
|
||||
item.data.x = item.displayObject.x;
|
||||
item.data.y = item.displayObject.y;
|
||||
this._onItemTransform?.(item);
|
||||
}
|
||||
if (this._onItemsTransform) {
|
||||
this._onItemsTransform(selected);
|
||||
} else if (this._onItemTransform) {
|
||||
for (const item of selected) this._onItemTransform(item);
|
||||
}
|
||||
this.transformBox.update(selected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user