task(C3fin2): snap marks and selection handles wired to canvas events
This commit is contained in:
@@ -154,6 +154,30 @@ const CanvasArea: React.FC<CanvasAreaProps> = ({
|
||||
hitTest: (wx, wy, tol) => renderEngine.hitTest(wx, wy, tol),
|
||||
}),
|
||||
});
|
||||
|
||||
// ── Task C3fin: Snap-Marks + Selection-Handles im Pixi-Overlay ──
|
||||
if (pixi && USE_PIXI_RENDERER) {
|
||||
// Snap-Marks bei Mausbewegung (wenn ein V2-Tool aktiv ist):
|
||||
const snapMove = (e: PointerEvent) => {
|
||||
if (!dispatcherRef.current?.getActive()) return;
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const world = zoomPan.screenToWorld(e.clientX - rect.left, e.clientY - rect.top);
|
||||
const snapResult = snapEngine.snap(world.x, world.y);
|
||||
const marks = snapResult.point
|
||||
? [{ x: snapResult.point.x, y: snapResult.point.y, type: (snapResult.point as { type?: string }).type ?? 'snap' }]
|
||||
: [];
|
||||
pixi!.setSnapPoints(marks);
|
||||
};
|
||||
canvas.addEventListener('pointermove', snapMove);
|
||||
|
||||
// Selection-Handles bei Änderung:
|
||||
const origSetIds = selectionEngine.selectByIds.bind(selectionEngine);
|
||||
selectionEngine.selectByIds = (ids: string[], additive: boolean) => {
|
||||
origSetIds(ids, additive);
|
||||
const selected = v2Doc.getAllElements().filter((el) => ids.includes(el.id));
|
||||
pixi!.setSelection({ selectedIds: ids, elements: selected });
|
||||
};
|
||||
}
|
||||
logger.info('InteractionDispatcher v2 aktiviert (VITE_TOOL_DISPATCHER=v2)');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user