feat(plan): 날개벽 형식을 좌 · 우 1행으로 요약하고 "반대쪽에도 적용" 추가
- 선택 줄을 "날개벽 형식 좌 [일반형 · 단축형 · 없음] │ 우 [일반형 · 단축형 · 없음]" 한 줄로 합침 (작은 그림 타일). "좌우" · "편집할 측" 줄과 ① 쪽 / ⑤ 쪽 표시는 없앰 (위치는 모델창에서 확인) - 타일이나 "좌" / "우" 글자를 누르면 그 측이 편집 대상이 되고, 편집 중인 묶음은 진한 테두리로 표시. 아래 치수 입력과 측면 삽도가 그 측을 따름 - "좌우 같게" 삭제: 형식과 치수는 측별로만 저장. 예전 파일의 wingsLinked 값은 읽기만 하고 쓰지 않음 - 반대쪽에도 적용 (copyWingDims): 두께 · 끝 높이 · 헌치를 한 번 복사하고, 길이는 두 측 형식이 같을 때만 복사. 반대쪽이 없음이면 비활성 - 테스트 갱신. 전체 670건 통과, 타입 검사 · 빌드 통과. 브라우저 시각 확인은 미실시 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ef3650454
commit
886347471e
5 files changed
+101
-75
No files matched your search
+24
-19
@@ -33,23 +33,32 @@ export function applyAbutEdit(rec: AbutRecord, key: AbutEditKey, value: number):
|
||||
return next;
|
||||
}
|
||||
|
||||
/** 좌우 같게 (기본): the form and dims apply to both sides. Off: each side keeps its own. */
|
||||
export function wingsLinked(rec: AbutRecord): boolean {
|
||||
return rec.wingsLinked !== false;
|
||||
}
|
||||
|
||||
/** 날개벽 형식은 측별로 정한다 (2026-11-04: "좌우 같게" 없음). */
|
||||
export function setWingForm(rec: AbutRecord, side: 'left' | 'right', form: WingForm): AbutRecord {
|
||||
const current = rec.wings ?? { left: 'general' as WingForm, right: 'general' as WingForm };
|
||||
if (wingsLinked(rec)) return { ...rec, wings: { left: form, right: form } };
|
||||
return { ...rec, wings: { ...current, [side]: form } };
|
||||
}
|
||||
|
||||
/** Turns 좌우 같게 on or off. Turning it on copies the left side (form and dims) to the right. */
|
||||
export function setWingsLinked(rec: AbutRecord, linked: boolean): AbutRecord {
|
||||
if (!linked) return { ...rec, wingsLinked: false };
|
||||
const left = rec.wings?.left ?? 'general';
|
||||
const dims = rec.wingDims?.left;
|
||||
return { ...rec, wingsLinked: true, wings: { left, right: left }, wingDims: dims ? { left: { ...dims }, right: { ...dims } } : undefined };
|
||||
/**
|
||||
* 반대쪽에도 적용 (2026-11-04): copies this side's wing dims to the other side once (no lasting link).
|
||||
* 두께 · 끝 높이 · 헌치는 늘 복사하고, 길이는 두 측의 형식이 같을 때만 복사한다 (단축형 길이 기본 = 뒷굽 끝).
|
||||
* The other side must have a wing.
|
||||
*/
|
||||
export function copyWingDims(rec: AbutRecord, side: 'left' | 'right'): AbutRecord {
|
||||
const other = side === 'left' ? 'right' : 'left';
|
||||
const forms = rec.wings ?? { left: 'general' as WingForm, right: 'general' as WingForm };
|
||||
if (forms[other] === 'none') throw new Error('반대쪽 날개벽이 없습니다.');
|
||||
const from = rec.wingDims?.[side] ?? {};
|
||||
const to: Partial<WingDims> = { ...(rec.wingDims?.[other] ?? {}) };
|
||||
for (const key of ['thicknessMm', 'endHeightMm', 'haunchMm'] as const) {
|
||||
if (from[key] === undefined) delete to[key];
|
||||
else to[key] = from[key];
|
||||
}
|
||||
if (forms[side] === forms[other]) {
|
||||
if (from.lengthMm === undefined) delete to.lengthMm;
|
||||
else to.lengthMm = from.lengthMm;
|
||||
}
|
||||
return { ...rec, wingDims: { ...(rec.wingDims ?? {}), [other]: to } };
|
||||
}
|
||||
|
||||
/** 날개벽 치수 입력 칸 (② 날개벽 카드, 시안 순서). 단축형에는 끝 높이가 없다. */
|
||||
@@ -60,16 +69,12 @@ export const WING_DIM_FIELDS: { key: keyof WingDims; label: string; general: boo
|
||||
{ key: 'haunchMm', label: '헌치 (mm, 300 × 300의 한 변)', general: true, short: true },
|
||||
];
|
||||
|
||||
/** Changes one wing dim of a side (both sides when 좌우 같게). Length, thickness and end height must be > 0, the haunch ≥ 0. */
|
||||
/** Changes one wing dim of one side. Length, thickness and end height must be > 0, the haunch ≥ 0. */
|
||||
export function applyWingDim(rec: AbutRecord, side: 'left' | 'right', key: keyof WingDims, value: number): AbutRecord {
|
||||
if (!Number.isFinite(value)) throw new Error('숫자를 입력하세요.');
|
||||
const probe = { ...WING_DIMS_DEFAULT, [key]: value };
|
||||
const issues = wingDimsIssues(probe);
|
||||
const issues = wingDimsIssues({ ...WING_DIMS_DEFAULT, [key]: value });
|
||||
if (issues.length > 0) throw new Error(issues[0]);
|
||||
const sides: ('left' | 'right')[] = wingsLinked(rec) ? ['left', 'right'] : [side];
|
||||
const next = { left: { ...(rec.wingDims?.left ?? {}) }, right: { ...(rec.wingDims?.right ?? {}) } };
|
||||
for (const s of sides) next[s] = { ...next[s], [key]: value };
|
||||
return { ...rec, wingDims: next };
|
||||
return { ...rec, wingDims: { ...(rec.wingDims ?? {}), [side]: { ...(rec.wingDims?.[side] ?? {}), [key]: value } } };
|
||||
}
|
||||
|
||||
/** 받침 값 편집 (2026-11-03): z (패드 상면, m) or 교좌면 override (m, undefined = 자동 — 블럭 높이 규칙을 따른다). */
|
||||
|
||||
@@ -59,7 +59,7 @@ export interface AbutRecord {
|
||||
bearingRule?: Partial<AbutBearingRule>;
|
||||
/** 날개벽 치수 (② 날개벽 카드, 측별, mm). Only the changed values. */
|
||||
wingDims?: { left?: Partial<WingDims>; right?: Partial<WingDims> };
|
||||
/** 좌우 같게 (기본 true): 형식과 치수를 양쪽에 함께 적용한다. */
|
||||
/** 예전 "좌우 같게" 값 (2026-11-04 이전 파일). 지금은 읽기만 하고 쓰지 않는다. */
|
||||
wingsLinked?: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user