fix(B07 CAD·M02): 16장 점검 — 테마 어긋남 · 첫 맞춤 · 불러온 양식 떠나기 · 작도 영역 안내

- CAD 테마: 저장값이 없으면 부모 문서 테마(호스트 기본 밝음)를 따름 — 시스템 설정을 따라 CAD 만 어둡던 것
- 맞춤 뒤 화면을 안 옮겼으면 캔버스 크기가 바뀔 때 다시 맞춤 — 첫 표시 때 iframe 이 늦게 커져 어긋나던 것 · 빈 도면은 원점을 가운데로
- 도면 양식 📂 불러온 뒤 저장 안 하고 떠나면 물음
- 작도 영역 칸: 빈 칸 · 숫자 아님은 그 칸만 짚음
- 화면 검증용 창구에 기준점 · 보기 전용 상태 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019qWfH6MMhLwjhtLYnDVUXv
This commit is contained in:
2026-09-28 22:18:59 +09:00
co-authored by Claude Opus 5.5
parent 527e68db85
commit 26772b87bd
5 changed files with 70 additions and 6 deletions
@@ -41,6 +41,8 @@ export class ScreenCanvasDrawController implements DrawController {
private screenScale = 1;
private screenMouseLocation: Point;
private canvasSize: Point = new Point(100, 100);
/** 맞춤 뒤 사용자가 화면을 안 옮겼음 — 캔버스 크기가 바뀌면 다시 맞춘다(첫 표시 때 iframe 이 늦게 커짐). */
private viewFitted = false;
// Style-run batching (static scene rendering): consecutive stroke calls
// with the same style are collected into one Path2D and stroked once.
@@ -61,7 +63,9 @@ export class ScreenCanvasDrawController implements DrawController {
}
public setCanvasSize(newCanvasSize: Point) {
const changed = newCanvasSize.x !== this.canvasSize.x || newCanvasSize.y !== this.canvasSize.y;
this.canvasSize = newCanvasSize;
if (changed && this.viewFitted) this.zoomToFitScreen();
}
public getScreenScale() {
@@ -70,6 +74,7 @@ export class ScreenCanvasDrawController implements DrawController {
public setScreenScale(newScreenScale: number) {
this.screenScale = newScreenScale;
this.viewFitted = false;
triggerReactUpdate(StateVariable.screenZoom);
}
@@ -79,6 +84,7 @@ export class ScreenCanvasDrawController implements DrawController {
public setScreenOffset(newScreenOffset: Point) {
this.screenOffset = newScreenOffset;
this.viewFitted = false;
triggerReactUpdate(StateVariable.screenOffset);
}
@@ -96,6 +102,7 @@ export class ScreenCanvasDrawController implements DrawController {
}
public panScreen(screenOffsetX: number, screenOffsetY: number) {
this.viewFitted = false;
this.screenOffset = new Point(
this.screenOffset.x - screenOffsetX / this.screenScale,
this.screenOffset.y - screenOffsetY / this.screenScale
@@ -145,7 +152,14 @@ export class ScreenCanvasDrawController implements DrawController {
// 확정). 도각까지 넣으면 A1 한 장 전체가 잡혀 화면의 40%가 여백으로 간다.
const pickable = getPickableEntities();
const entities = pickable.length ? pickable : getEntities();
if (!entities.length) return;
if (!entities.length) {
// 빈 도면 — 원점(0,0)을 화면 가운데로. 안 옮기면 기준점 십자가 왼쪽 아래 귀퉁이에 잘린다.
const canvasSize = this.getCanvasSize();
const zoom = this.getScreenScale();
this.setScreenOffset(new Point(-canvasSize.x / 2 / zoom, -canvasSize.y / 2 / zoom));
this.viewFitted = true;
return;
}
const boundingBox = getBoundingBoxOfMultipleEntities(entities);
const boundingWidth = boundingBox.maxX - boundingBox.minX;
const boundingHeight = boundingBox.maxY - boundingBox.minY;
@@ -171,6 +185,7 @@ export class ScreenCanvasDrawController implements DrawController {
worldCenterY - canvasSize.y / 2 / zoomLevel
)
);
this.viewFitted = true;
}
/**