fix(M02): CAD 표 놓기 Esc 로 그만두면 면적 쪽 저장 안 한 고침 기다림 풂(104-3)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
This commit is contained in:
2026-10-08 16:53:23 +09:00
co-authored by Claude Sonnet 5.5
parent d669c0824e
commit c99a9a0ad4
9 changed files with 86 additions and 6 deletions
@@ -16,6 +16,13 @@ export function setPendingTable(table: TableEntity | null): void {
pending = table;
}
let onCancelled: (() => void) | null = null;
/** 놓지 않고 Esc 로 끝났을 때 한 번 부를 갈고리(부모에 알림) — 놓으면 버려진다 */
export function setPlaceCancelHandler(handler: (() => void) | null): void {
onCancelled = handler;
}
export function getPendingTable(): TableEntity | null {
return pending;
}
@@ -40,10 +47,18 @@ export const placeTableToolStateMachine = createSequenceTool({
steps: [{ kind: 'point', instructions: '표를 놓을 자리(왼쪽 위)를 누르십시오 · Esc 그만.' }],
helpers: true,
restart: false,
onCancel: () => {
if (!pending) return;
pending = null;
const notify = onCancelled;
onCancelled = null;
notify?.();
},
preview: (input) => (pending ? [tableAt(pending, input.cursor, getActiveLayerId())] : []),
commit: (input) => {
if (!pending) return;
addEntities([tableAt(pending, input.point(0), getActiveLayerId())], true);
pending = null;
onCancelled = null;
},
});