Files
Aislo/B07_DesignDetail/openwebcad/test/helpers/replay-recording.ts
T
eomsangdonandClaude Fable 5 6e195afb69 feat(B07,B08): 워크플로 순서 교환 — 상세설계를 수량산출 앞으로
횡단설계(B06) 다음을 상세설계 → 수량산출 → 설계도서 순으로 재배열하고,
폴더 번호가 흐름과 일치하도록 이름을 맞바꾼다.

- B08_DesignDetail → B07_DesignDetail, B07_Quantity → B08_Quantity
  (파일 접두어·식별자·라우트·locale 키 전량 스왑)
- STAGE_KEYS 4=DESIGN_DETAIL, 5=QUANTITY 스왑 + 라우터 stage 리터럴 교체
- CAD 마운트 /b08-cad → /b07-cad (main.py·vite proxy·iframe URL),
  openwebcad Toolbar 라벨 B07로 수정 후 재빌드
- 유지: openwebcad postMessage 프로토콜 aislo:b08:*·패키지명(내부 식별자)
- 기존 프로젝트 storage 폴더 rename + project_manifest 갱신,
  DB project_workflow_stages stage_no 4↔5 행 스왑 완료

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 16:16:46 +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;
}
}
}