Files
Aislo/B08_DesignDetail/openwebcad/test/helpers/replay-recording.ts
T
eomsangdonandClaude Fable 5 2a248ff742 refactor(B07,B08): 도면 코드 B08_DesignDetail 이동 + 수량 슬롯 B07_Quantity 확보
- B07_wf4_DesignDetail(8파일+openwebcad) -> B08_DesignDetail로 git mv (이력 보존)
- B08_wf5_Quantity -> B07_Quantity (구 수량 백업 zip 보관 폴더)
- 파생 문자열 일괄 전환: /b07-cad -> /b08-cad 정적 서빙, CAD 레이어 b07-* -> b08-*,
  postMessage aislo:b07:* -> aislo:b08:*, 패키지명 aislo-b08-cad, CSS .b08-*,
  라우트 키/슬러그(B08_DESIGN_DETAIL/b08-design-detail, B07_QUANTITY/b07-quantity)
- 상세설계 워크플로우 stage 4 -> 5 (확정/무효화 전이 3곳), 확정 완료 시 B09로 이동
- WORKFLOW_STEP_ROUTES 순서 재배열: index4=수량(B07), index5=상세설계(B08)
- [임시] B08 이동 테스트 버튼 제거, openwebcad dist 재빌드
- 주석 의미 정렬: 수량 인계 주석 B08->B07, 도면 참조 B07->B08

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 10:10:10 +09:00

77 lines
2.2 KiB
TypeScript

import type {InputController} from '../../src/inputController/input-controller';
import {Tool} from '../../src/tools';
import {click} from './click';
import type {Recording, Step} from './replay-recording.types';
import {setActiveTool} from './set-active-tool';
const DATA_ID_TO_TOOL_NAME: Record<string, Tool | null> = {
'select-button': Tool.SELECT,
'line-button': Tool.LINE,
'rectangle-button': Tool.RECTANGLE,
'circle-button': Tool.CIRCLE,
'move-button': Tool.MOVE,
'scale-button': Tool.SCALE,
'rotate-button': Tool.ROTATE,
'measurement-button': Tool.MEASUREMENT,
'undo-button': null,
'redo-button': null,
'delete-segment-button': Tool.ERASER,
'line-color-button': null,
'line-width-button': null,
'angle-guide-button': null,
'angle-guide-5-button': null,
'angle-guide-15-button': null,
'angle-guide-30-button': null,
'angle-guide-45-button': null,
'angle-guide-90-button': null,
'zoom-level-button': null,
'import-image-button': null,
'json-open-button': null,
'json-save-button': null,
'svg-export-button': null,
'png-export-button': null,
'pdf-export-button': null,
'github-link-button': null,
};
function handleClick(inputController: InputController, step: Step) {
const firstSelector = step.selectors[0][0];
if (firstSelector.startsWith('[data-id')) {
// clicked a button or the canvas
const dataId = step.selectors[0][0].split("'")[1];
if (dataId === 'canvas') {
click(inputController, step.offsetX, step.offsetY);
} else if (DATA_ID_TO_TOOL_NAME[dataId]) {
setActiveTool(DATA_ID_TO_TOOL_NAME[dataId]);
} else {
console.error('Failed to replay step: ', step);
}
} else {
console.error('Failed to replay step without data id: ', step);
}
}
function handleKeyUp(inputController: InputController, step: Step) {
inputController.handleKeyStroke({
key: step.key,
preventDefault: () => {},
stopPropagation: () => {},
ctrlKey: false,
shiftKey: false,
} as KeyboardEvent);
}
export function replayRecording(inputController: InputController, recording: Recording) {
for (const step of recording.steps) {
switch (step.type) {
case 'click':
handleClick(inputController, step);
break;
case 'keyUp':
handleKeyUp(inputController, step);
break;
}
}
}