From 99df7c25125fb6aa5220c4b265198bce60b02000 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 19 Oct 2026 22:13:08 +0900 Subject: [PATCH] =?UTF-8?q?feat(488-2=20CAD=20=EC=84=A0=20=EC=86=8D?= =?UTF-8?q?=EC=84=B1):=20=EC=83=89=20=C2=B7=20=EC=84=A0=20=EB=91=90?= =?UTF-8?q?=EA=BB=98=20=C2=B7=20=EC=84=A0=EC=A2=85=EB=A5=98=20=3D=20?= =?UTF-8?q?=EA=B3=A0=EB=A5=B8=20=EA=B2=83=EC=9D=98=20=EA=B0=92(=EB=8B=A4?= =?UTF-8?q?=EB=A5=B4=EB=A9=B4=20=EB=B9=88=20=EC=B9=B8=20=C2=B7=20=EC=83=89?= =?UTF-8?q?=20=3D=20=EC=A0=90=EC=84=A0=20=EB=B9=88=20=EA=B2=AC=EB=B3=B8)?= =?UTF-8?q?=20=C2=B7=20=EA=B3=A0=EB=A5=B8=20=EA=B2=83=EB=A7=8C=20=EB=B0=94?= =?UTF-8?q?=EA=BF=88=20=C2=B7=20=ED=8F=B4=EB=A6=AC=EC=84=A0=20=EC=9E=90?= =?UTF-8?q?=EC=8B=9D=EA=B9=8C=EC=A7=80=20=C2=B7=20=EC=82=AC=EB=B3=B8=20?= =?UTF-8?q?=EA=B0=88=EC=95=84=20=EB=81=BC=EC=9B=80=EC=9C=BC=EB=A1=9C=20Ctr?= =?UTF-8?q?l+Z=20=ED=95=9C=20=EB=B2=88=20=3D=20=EC=98=9B=20=EA=B0=92=20?= =?UTF-8?q?=E2=80=94=20=EC=83=88=20helpers/selection-style.ts=20=EB=A5=BC?= =?UTF-8?q?=20=EB=A6=AC=EB=B3=B8=20=C2=B7=20=ED=8A=B9=EC=84=B1=20=ED=8C=90?= =?UTF-8?q?=20=C2=B7=20COLOR=20=C2=B7=20LINETYPE=20=C2=B7=20LWEIGHT=20?= =?UTF-8?q?=C2=B7=20TRANSPARENCY=20=C2=B7=20MATCHPROP=20=C2=B7=20SETBYLAYE?= =?UTF-8?q?R=20=C2=B7=20LAYMCH=20=C2=B7=20LAYCUR=20=EA=B0=80=20=EA=B0=99?= =?UTF-8?q?=EC=9D=B4=20=EC=94=80=20=C2=B7=20=EC=8B=9C=ED=97=98=20selection?= =?UTF-8?q?-style.test.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- B07_DesignDetail/openwebcad/src/App.css | 2 + .../src/components/PropertiesEditor.tsx | 42 +++--- .../src/components/RibbonWidgets.tsx | 89 ++++++------- .../openwebcad/src/helpers/selection-style.ts | 107 ++++++++++++++++ .../src/tools/modify/property-tools.ts | 24 ++-- .../src/tools/utility/layer-tools.ts | 11 +- .../src/tools/utility/property-tools.ts | 23 ++-- resources/tester/cad/selection-style.test.ts | 121 ++++++++++++++++++ 8 files changed, 322 insertions(+), 97 deletions(-) create mode 100644 B07_DesignDetail/openwebcad/src/helpers/selection-style.ts create mode 100644 resources/tester/cad/selection-style.test.ts diff --git a/B07_DesignDetail/openwebcad/src/App.css b/B07_DesignDetail/openwebcad/src/App.css index 7c36bfacc..21519acc1 100644 --- a/B07_DesignDetail/openwebcad/src/App.css +++ b/B07_DesignDetail/openwebcad/src/App.css @@ -334,6 +334,8 @@ body > canvas[data-id="canvas"] { border-radius: 3px; cursor: pointer; } +/* 고른 것들 색이 다름(488) — 빈 견본(투명 · 점선 테두리) */ +input[type="color"][data-mixed="true"]::-webkit-color-swatch { background: transparent !important; border: 1px dashed var(--cad-text-muted); } /* 위젯 패널 안의 작은 명령 버튼은 한 줄 높이에 맞춘다 */ .cad-ribbon-props .cad-tool[data-size="small"] { height: 22px; diff --git a/B07_DesignDetail/openwebcad/src/components/PropertiesEditor.tsx b/B07_DesignDetail/openwebcad/src/components/PropertiesEditor.tsx index 2512617f9..ae9191758 100644 --- a/B07_DesignDetail/openwebcad/src/components/PropertiesEditor.tsx +++ b/B07_DesignDetail/openwebcad/src/components/PropertiesEditor.tsx @@ -2,25 +2,31 @@ import type { FC } from 'react'; import type { Entity } from '../entities/Entity'; import { polylineLength, sampleEntityPoints } from '../helpers/geometry/sample-entity'; -import { getEntities, getLayers, getSelectedEntities, setEntities } from '../state'; -import { dashToLineType, LINE_TYPES, LINE_WIDTHS } from './RibbonWidgets'; +import { + commonValue, + LINE_TYPES, + LINE_WIDTHS, + restyle, + selectionLineStyle, + styleTargets, +} from '../helpers/selection-style'; +import { getLayers, getSelectedEntities } from '../state'; interface PropertiesEditorProps { compact?: boolean; } -function applyToSelection(mutate: (entity: Entity) => void): void { - const selected = getSelectedEntities(); - if (!selected.length) return; - for (const entity of selected) mutate(entity); - setEntities([...getEntities()], true); -} +/** 고른 것을 사본으로 바꿈 — 되돌리기 한 칸(488) · 선 특성은 글 뺌 */ +const applyToSelection = (mutate: (entity: Entity) => void) => restyle(getSelectedEntities(), mutate); +const applyToLines = (mutate: (entity: Entity) => void) => + restyle(styleTargets(getSelectedEntities()), mutate); -/** 여러 객체가 값이 다르면 '*가지각색' 대신 첫 객체 값을 보여 준다 (AutoCAD와 같은 관행) */ +/** 여러 객체가 값이 다르면 빈 칸(488 · 리본과 같은 규칙 · 고르면 모두에 적용) */ export const PropertiesEditor: FC = ({ compact = false }) => { const selected = getSelectedEntities(); const layers = getLayers(); const first = selected[0]; + const view = selectionLineStyle(); if (!first) { return

선택된 객체가 없습니다.

; @@ -39,9 +45,10 @@ export const PropertiesEditor: FC = ({ compact = false }) 색상 - applyToSelection((entity) => { + applyToLines((entity) => { entity.lineColor = event.target.value; }) } @@ -51,13 +58,14 @@ export const PropertiesEditor: FC = ({ compact = false })