feat(b07): 횡단 장 안내선 보이기 / 숨기기 단추 — 점선 작도 영역 + 붉은 넘침 틀 · 숨김이면 넘침 토스트 없음(180-3)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
This commit is contained in:
@@ -7,7 +7,8 @@ import { getCanvas, getScreenCanvasDrawController } from '../state.ts';
|
||||
*
|
||||
* 도면 개체가 아니라 그리기 겹판(기준점 십자와 같은 자리)이라 저장 · DXF · 인쇄에 안 섞인다.
|
||||
* `editable` 이면 모서리 · 변을 끌어 영역을 고치고, 고친 값은 부모(숫자 칸)에 알린다.
|
||||
* 부모 짝 = `ui_template/cad_host/cad_host.ts` `guide` 곁값 · `setGuideArea` · `onGuideChange`.
|
||||
* 부모 짝 = `ui_template/cad_host/cad_host.ts` `guide` 곁값 · `setGuideArea` · `onGuideChange` ·
|
||||
* `setGuideVisible`(180-3 — 점선 영역 + 붉은 넘침 틀 보이기 / 숨기기 · 도각 칸선은 도면 개체라 그대로).
|
||||
*/
|
||||
|
||||
/** [왼쪽 x, 아래 y, 오른쪽 x, 위 y] — 도면 좌표 mm */
|
||||
@@ -32,6 +33,8 @@ const GRAB_PIXELS = 9;
|
||||
export const GUIDE_MIN_MM = 10;
|
||||
|
||||
let guide: Guide | null = null;
|
||||
/** 안내선(점선 영역 + 붉은 틀) 보임 — 싣기 때 안 지움 · 숨김이면 그리지도 · 집지도 않음 */
|
||||
let guideVisible = true;
|
||||
|
||||
const isArea = (value: unknown): value is GuideArea =>
|
||||
Array.isArray(value) &&
|
||||
@@ -42,6 +45,13 @@ const isArea = (value: unknown): value is GuideArea =>
|
||||
|
||||
export const getGuide = (): Guide | null => guide;
|
||||
|
||||
export const isGuideVisible = (): boolean => guideVisible;
|
||||
|
||||
/** 부모 단추(180-3) — `true` 만 보임 · 그 밖 값은 보임으로 */
|
||||
export function setGuideVisible(visible: unknown): void {
|
||||
guideVisible = visible !== false;
|
||||
}
|
||||
|
||||
/** 싣기 때 — 어긋난 값이면 가이드 없음 */
|
||||
export function setGuide(next: unknown): void {
|
||||
const candidate = next as Partial<Guide> | null | undefined;
|
||||
@@ -103,7 +113,7 @@ function strokeRect(drawController: ScreenCanvasDrawController, area: GuideArea)
|
||||
|
||||
/** 그리기 겹판 — 엔티티 장면 위에 매 장 그림(`helpers/draw.ts`) */
|
||||
export function drawGuide(drawController: ScreenCanvasDrawController): void {
|
||||
if (!guide) return;
|
||||
if (!guide || !guideVisible) return;
|
||||
drawController.setOpacity(0.9);
|
||||
drawController.setLineStyles(false, false, GUIDE_COLOR, 1, [8, 5]);
|
||||
strokeRect(drawController, guide.area);
|
||||
@@ -142,7 +152,7 @@ export function registerGuideDrag(notify: (area: GuideArea) => void): void {
|
||||
window.addEventListener(
|
||||
'mousedown',
|
||||
(event: MouseEvent) => {
|
||||
if (event.button !== 0 || event.target !== canvas || !guide?.editable) return;
|
||||
if (event.button !== 0 || event.target !== canvas || !guide?.editable || !guideVisible) return;
|
||||
const world = worldAt(event);
|
||||
if (!world) return;
|
||||
const tolerance = GRAB_PIXELS / getScreenCanvasDrawController().getScreenScale();
|
||||
|
||||
Reference in New Issue
Block a user