From 9bf6de9b1069ba3963fd08162eca1caf7aeccb61 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 31 Aug 2026 15:48:08 +0900 Subject: [PATCH] =?UTF-8?q?fix(B07):=20=EC=9E=A0=EA=B8=88=20=EB=8F=84?= =?UTF-8?q?=EB=A9=B4=EC=B8=B5=EC=9D=84=20=EC=A7=91=EB=8D=98=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EB=8B=A4=EC=84=AF=20=EA=B3=B3=EC=9D=84=20=EB=A7=88?= =?UTF-8?q?=EC=A0=80=20=EB=8B=AB=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 앞선 감사가 불완전했다. 같은 부류로 도각·원지반을 건드리던 곳이 더 있었다. - select-tool.helpers pickEntityAt: 클릭 선택 후보에 잠금 객체가 섞여 도각을 물면 아무 일도 안 일어나는 죽은 클릭이 됐다. - eraser-tool: 자르기의 교차점 계산이 도각 선을 절단 경계로 썼다. - property-tools OVERKILL: 선택이 없으면 전체가 대상이라 도각까지 지웠다. - text-tools 찾기/바꾸기: 도각 표제란 글자를 바꿔 버렸다. - selection-tools 유형/유사 선택: 잠금 객체까지 세어 토스트 개수가 틀렸다. 전부 getPickableEntities()로 바꾼다. Co-Authored-By: Claude Opus 5 (1M context) --- .../openwebcad/src/tools/annotate/text-tools.ts | 16 +++++++++++++--- .../openwebcad/src/tools/eraser-tool.ts | 7 +++++-- .../src/tools/modify/property-tools.ts | 3 ++- .../openwebcad/src/tools/select-tool.helpers.ts | 3 ++- .../src/tools/utility/selection-tools.ts | 9 +++++---- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/B07_DesignDetail/openwebcad/src/tools/annotate/text-tools.ts b/B07_DesignDetail/openwebcad/src/tools/annotate/text-tools.ts index 00305825..add2367b 100644 --- a/B07_DesignDetail/openwebcad/src/tools/annotate/text-tools.ts +++ b/B07_DesignDetail/openwebcad/src/tools/annotate/text-tools.ts @@ -5,7 +5,13 @@ import { getAnnotationScale } from '../../commands/dim-settings'; import { EntityName } from '../../entities/Entity'; import type { Entity } from '../../entities/Entity'; import type { TextEntity } from '../../entities/TextEntity'; -import { addEntities, getActiveTextStyle, getEntities, setEntities } from '../../state'; +import { + addEntities, + getActiveTextStyle, + getEntities, + getPickableEntities, + setEntities, +} from '../../state'; import { Tool } from '../../tools'; import { textEntity } from '../factories/entity-factory'; import { createSequenceTool } from '../factories/sequence-tool'; @@ -80,14 +86,18 @@ export const findToolStateMachine = createSequenceTool({ helpers: false, steps: [ { kind: 'text', instructions: '찾을 문자열을 입력하십시오.' }, - { kind: 'text', instructions: '바꿀 문자열을 입력하십시오 (그대로 두려면 ENTER).', defaultValue: '' }, + { + kind: 'text', + instructions: '바꿀 문자열을 입력하십시오 (그대로 두려면 ENTER).', + defaultValue: '', + }, ], commit: (input) => { const needle = input.text(0); const replacement = input.text(1); let found = 0; let replaced = 0; - for (const entity of getEntities()) { + for (const entity of getPickableEntities()) { if (entity.getType() !== EntityName.Text) continue; const text = entity as TextEntity; if (!text.getLabel().includes(needle)) continue; diff --git a/B07_DesignDetail/openwebcad/src/tools/eraser-tool.ts b/B07_DesignDetail/openwebcad/src/tools/eraser-tool.ts index be0e5fb6..5aedd089 100644 --- a/B07_DesignDetail/openwebcad/src/tools/eraser-tool.ts +++ b/B07_DesignDetail/openwebcad/src/tools/eraser-tool.ts @@ -100,7 +100,7 @@ export function handleMouseClick(worldMouseLocation: Point) { const clickedPointOnShape = closestEntity.segment.start; // Find entities that intersect with the closest entity - const intersections = getAllIntersectionPoints(closestEntity.entity, getEntities()); + const intersections = getAllIntersectionPoints(closestEntity.entity, getPickableEntities()); const entityType = closestEntity.entity.getType(); switch (entityType) { @@ -139,7 +139,10 @@ export function handleMouseClick(worldMouseLocation: Point) { addEntities(segmentEntities, false); // Remove (a segment) of the 4th line closest to the cursor - const lineIntersections = getAllIntersectionPoints(closestSegmentInfo.entity, getEntities()); + const lineIntersections = getAllIntersectionPoints( + closestSegmentInfo.entity, + getPickableEntities() + ); eraseLineSegment( closestSegmentInfo.entity as LineEntity, clickedPointOnShape, diff --git a/B07_DesignDetail/openwebcad/src/tools/modify/property-tools.ts b/B07_DesignDetail/openwebcad/src/tools/modify/property-tools.ts index e5194d35..b2e6d9c4 100644 --- a/B07_DesignDetail/openwebcad/src/tools/modify/property-tools.ts +++ b/B07_DesignDetail/openwebcad/src/tools/modify/property-tools.ts @@ -7,6 +7,7 @@ import { addEntities, deleteEntities, getEntities, + getPickableEntities, getLayerById, setEntities, setSelectedEntityIds, @@ -112,7 +113,7 @@ export const overkillToolStateMachine = createSequenceTool({ steps: [{ kind: 'selection', instructions: '중복을 정리할 객체를 선택한 뒤 ENTER.' }], commit: (input) => { const selected = input.entities(0); - const target = selected.length ? selected : getEntities(); + const target = selected.length ? selected : getPickableEntities(); const duplicates = findDuplicateEntities(target); if (!duplicates.length) { toast.info('중복된 객체가 없습니다.'); diff --git a/B07_DesignDetail/openwebcad/src/tools/select-tool.helpers.ts b/B07_DesignDetail/openwebcad/src/tools/select-tool.helpers.ts index edde415a..e3fdbea4 100644 --- a/B07_DesignDetail/openwebcad/src/tools/select-tool.helpers.ts +++ b/B07_DesignDetail/openwebcad/src/tools/select-tool.helpers.ts @@ -18,6 +18,7 @@ import { pickRadius } from '../helpers/pick-radius'; import { getActiveLayerId, getEntities, + getPickableEntities, getLayers, getSelectedEntities, getSelectedEntityIds, @@ -36,7 +37,7 @@ let pickCycleIndex = 0; function pickEntityAt(worldPoint: Point): Entity | null { const radius = pickRadius(); - const candidates = findEntitiesWithinDistance(worldPoint, getEntities(), radius); + const candidates = findEntitiesWithinDistance(worldPoint, getPickableEntities(), radius); if (!candidates.length) { lastPickPoint = null; return null; diff --git a/B07_DesignDetail/openwebcad/src/tools/utility/selection-tools.ts b/B07_DesignDetail/openwebcad/src/tools/utility/selection-tools.ts index 6988f0f9..80fa9b49 100644 --- a/B07_DesignDetail/openwebcad/src/tools/utility/selection-tools.ts +++ b/B07_DesignDetail/openwebcad/src/tools/utility/selection-tools.ts @@ -2,7 +2,7 @@ import { toast } from 'react-toastify'; import type { Entity } from '../../entities/Entity'; import { hideEntities, isolateEntities, showAllEntities } from '../../helpers/visibility'; -import { getEntities, setEntities, setSelectedEntityIds } from '../../state'; +import { getEntities, getPickableEntities, setEntities, setSelectedEntityIds } from '../../state'; import { Tool } from '../../tools'; import { createSequenceTool } from '../factories/sequence-tool'; @@ -12,12 +12,13 @@ export const qSelectToolStateMachine = createSequenceTool({ steps: [ { kind: 'text', - instructions: '선택할 객체 유형을 입력하십시오 (Line · Circle · Arc · Text · PolyLine · Hatch).', + instructions: + '선택할 객체 유형을 입력하십시오 (Line · Circle · Arc · Text · PolyLine · Hatch).', }, ], commit: (input) => { const wanted = input.text(0).trim().toLowerCase(); - const matched = getEntities().filter( + const matched = getPickableEntities().filter( (entity) => entity.getType().toLowerCase() === wanted ); if (!matched.length) { @@ -35,7 +36,7 @@ export const selectSimilarToolStateMachine = createSequenceTool({ steps: [{ kind: 'entity', instructions: '기준이 될 객체를 선택하십시오.' }], commit: (input) => { const reference = input.entity(0); - const similar = getEntities().filter( + const similar = getPickableEntities().filter( (entity) => entity.getType() === reference.getType() && entity.lineColor === reference.lineColor &&