@things-factory/figure-ui 10.1.105 → 10.1.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/modeller/canvas.ts +6 -13
- package/client/modeller/editor.ts +13 -2
- package/client/modeller/figure-cavity-drawing.ts +16 -10
- package/client/modeller/figure-links.ts +49 -35
- package/client/modeller/figure-parts.ts +3 -3
- package/client/modeller/figure-section-editor.ts +106 -11
- package/client/modeller/section-drawing.ts +27 -4
- package/dist-client/modeller/canvas.d.ts +0 -2
- package/dist-client/modeller/canvas.js +6 -17
- package/dist-client/modeller/canvas.js.map +1 -1
- package/dist-client/modeller/clips.d.ts +1 -1
- package/dist-client/modeller/editor.js +15 -2
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/figure-cavity-drawing.js +14 -8
- package/dist-client/modeller/figure-cavity-drawing.js.map +1 -1
- package/dist-client/modeller/figure-links.d.ts +2 -2
- package/dist-client/modeller/figure-links.js +49 -34
- package/dist-client/modeller/figure-links.js.map +1 -1
- package/dist-client/modeller/figure-parts.d.ts +2 -1
- package/dist-client/modeller/figure-parts.js +2 -2
- package/dist-client/modeller/figure-parts.js.map +1 -1
- package/dist-client/modeller/figure-section-editor.d.ts +14 -1
- package/dist-client/modeller/figure-section-editor.js +109 -9
- package/dist-client/modeller/figure-section-editor.js.map +1 -1
- package/dist-client/modeller/section-drawing.d.ts +12 -1
- package/dist-client/modeller/section-drawing.js +23 -3
- package/dist-client/modeller/section-drawing.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/test/cavity-drawing.test.ts +5 -0
- package/test/command-preview.test.ts +11 -4
- package/test/first-minute.test.ts +6 -2
- package/test/layout.test.ts +11 -0
- package/test/section-editor.test.ts +29 -2
- package/translations/en.json +2 -9
- package/translations/ja.json +2 -9
- package/translations/ko.json +2 -9
- package/translations/ms.json +2 -9
- package/translations/zh.json +2 -9
|
@@ -1 +1 @@
|
|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,CAAC;;qDAAa;AAEX;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDAAsC;AAEtB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDAAe;AAMzC;IAAhB,KAAK,EAAE;;oDAAoF;AAC3E;IAAhB,KAAK,EAAE;;qDAAuC;AAC9B;IAAhB,KAAK,EAAE;;iDAAkB;AAxNf,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAkuB/B","sourcesContent":["import { css, html, LitElement, nothing, svg } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { figureCavitySectionOf, figureSectionSidesOf } from '@hatiolab/figure-model'\nimport type { FigureAuthoringAction, FigureEvaluatedShape, FigureSection, FigureSectionMeasure, FigureSectionPoint } from '@hatiolab/figure-model'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { apexOver, drawnOf, insertAfter, markedBy, movePoint, pointLabel, removePoint, sectionOf, workingIssuesOf, workingOf, type SectionWorking } from './section-drawing.js'\nimport { END_FACE } from './section-controls.js'\nimport { openPopup } from '@operato/layout'\nimport './figure-section-close-choice.js'\nimport type { SectionCloseChoice } from './figure-section-close-choice.js'\n\ntype Axis = 'x' | 'y' | 'z'\n\n/** How the section is laid on the screen, by the axis it is pushed along: across to the right, then down. */\nconst SCREEN: Record<Axis, [Axis, Axis]> = { y: ['x', 'z'], x: ['z', 'y'], z: ['x', 'y'] }\n\n/** The editor's width and room for the solid beside it: below this the two take turns. */\nexport const NARROW_BELOW = 900\n\n/**\n * 단면 편집 — a pushed part's section and length in one editor (ADR-0100 §3.2, stage 2).\n *\n * The outline is drawn flat, looking along the push, in millimetres from the part's origin; the figure behind stays in\n * view and shows the solid the working state makes (`command-live`, the same preview the section panel uses), so the 2D\n * and the 3D stand side by side. A drawn section's point is dragged or typed, a side pressed gains a point in its\n * middle, a point is deleted, never below three. A rectangle's width and depth and an ellipse's diameters are dragged by\n * their handles or typed; a circle's two are one. The push's length is typed, and the face it keeps is the one the\n * part's placement or fastening keeps (§4.1: read here, changed elsewhere). A measure that follows another value is\n * shown and not offered.\n *\n * A drawn section's end can be drawn to one point -- a pyramid, a tetrahedron from three points (§4.1.1, A5-1): the\n * apex is dragged or typed like a point, and is not offered while something is fastened to the end it takes away (the\n * kernel's own refusal, `pointBlocked`).\n *\n * What the kernel would refuse is marked on the outline and said in the list; apply is held back, and the solid shows\n * the last valid state, which the caption names. Apply sends one `set-section` command (one step of the history); cancel\n * or Esc sends nothing and lets the preview go -- after asking, when something was changed: apply it, let it go, or keep\n * editing (`requestClose`). The undo here is the editor's own. If the figure changes while the editor\n * is open, apply is refused until it is opened again.\n */\n@customElement('figure-section-editor')\nexport class FigureSectionEditor extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n position: absolute;\n left: 12px;\n top: 12px;\n bottom: 12px;\n z-index: 5;\n display: grid;\n grid-template-rows: auto auto minmax(0, 1fr) auto;\n width: min(560px, calc(100% - 24px));\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 12px;\n box-shadow: 0 8px 24px rgb(0 0 0 / 18%);\n overflow: hidden;\n }\n /* Each in its own row: the tabs are hidden on a wide screen, and without the rows named the body fell into theirs. */\n header {\n grid-row: 1;\n }\n nav[tabs] {\n grid-row: 2;\n }\n div[body] {\n grid-row: 3;\n }\n footer {\n grid-row: 4;\n }\n header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n padding: 10px 14px 4px;\n }\n header h2 {\n margin: 0;\n font-size: var(--ui-t-body);\n }\n header span {\n font-size: 0.72rem;\n color: var(--md-sys-color-on-surface-variant);\n }\n nav[tabs] {\n display: none;\n gap: 4px;\n padding: 0 14px 6px;\n }\n nav[tabs] button,\n footer button,\n li button {\n font: inherit;\n font-size: 0.78rem;\n min-height: 30px;\n padding: 0 12px;\n border-radius: 15px;\n border: 1px solid var(--md-sys-color-outline-variant);\n background: var(--md-sys-color-surface-container-lowest);\n color: var(--md-sys-color-on-surface);\n cursor: pointer;\n }\n nav[tabs] button[on] {\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n div[body] {\n display: grid;\n grid-template-rows: minmax(160px, 1fr) auto;\n min-height: 0;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n div[outline] {\n position: relative;\n min-height: 0;\n }\n svg {\n width: 100%;\n height: 100%;\n display: block;\n touch-action: none;\n user-select: none;\n }\n div[caption] {\n position: absolute;\n left: 8px;\n top: 6px;\n font-size: 0.68rem;\n color: var(--md-sys-color-on-surface-variant);\n pointer-events: none;\n }\n div[caption][last-valid] {\n color: var(--md-sys-color-error);\n font-weight: 600;\n }\n aside {\n max-height: 34vh;\n overflow: auto;\n padding: 8px 14px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n div[sizes] {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 6px;\n margin-bottom: 8px;\n }\n label[mm] {\n display: grid;\n gap: 2px;\n }\n label[mm] input {\n min-width: 0;\n font: inherit;\n }\n label[apex] {\n display: flex;\n align-items: center;\n gap: 6px;\n grid-column: 1 / -1;\n }\n label[apex] small {\n flex-basis: 100%;\n }\n ol[points] {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n }\n ol[points] li {\n display: grid;\n grid-template-columns: 2.2em minmax(0, 1fr) minmax(0, 1fr) auto;\n gap: 6px;\n align-items: center;\n padding: 2px 4px;\n border-radius: 6px;\n }\n ol[points] li[selected] {\n background: var(--md-sys-color-secondary-container);\n }\n ol[points] li[marked] b {\n color: var(--md-sys-color-error);\n }\n ol[points] input {\n min-width: 0;\n font: inherit;\n }\n ul[issues] {\n margin: 8px 0 0;\n padding: 0 0 0 16px;\n color: var(--md-sys-color-error);\n font-size: 0.76rem;\n }\n small {\n color: var(--md-sys-color-on-surface-variant);\n }\n footer {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 14px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n footer span[grow] {\n flex: 1;\n font-size: 0.72rem;\n color: var(--md-sys-color-on-surface-variant);\n }\n footer span[grow][stale] {\n color: var(--md-sys-color-error);\n }\n footer button[primary] {\n background: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n border-color: transparent;\n }\n button:disabled {\n opacity: 0.45;\n cursor: default;\n }\n /* Too little room beside the editor for the solid: the outline and the solid take turns (§7). */\n :host([narrow]) nav[tabs] {\n display: flex;\n }\n :host([narrow][show='solid']) div[body] {\n display: none;\n }\n :host([narrow][show='solid']) {\n bottom: auto;\n }\n `]\n\n /** The part and its evaluated shape as they stand when the editor opens. */\n @property({ attribute: false }) body?: { id: string; shape: FigureEvaluatedShape }\n /** Which of its measures can be set (figure-model's `figureSectionMeasuresOf`). */\n @property({ attribute: false }) measures?: { measures: Record<Axis, FigureSectionMeasure>; round: boolean }\n /** Along the push, the face a length change keeps: 1 its start, -1 its end, 0 its centre; undefined when it cannot be said. */\n @property({ attribute: false }) kept?: -1 | 0 | 1\n /** Why a push's end cannot be drawn to a point now, in the kernel's words (what is fastened to it); empty when it can. */\n @property({ attribute: false }) pointBlocked = ''\n /** The figure's revision now; the editor remembers the one it opened at. */\n @property({ type: Number }) revision = 0\n /** Narrow: the outline or the solid behind. */\n @property({ reflect: true }) show: 'outline' | 'solid' = 'outline'\n /** Set when the space the editor stands in leaves too little beside it to see the solid. */\n @property({ type: Boolean, reflect: true }) narrow = false\n private room = new ResizeObserver(([entry]) => {\n this.narrow = (entry?.contentRect.width ?? 0) < NARROW_BELOW\n if (!this.narrow) this.show = 'outline'\n })\n\n @state() private working: SectionWorking = { points: [], across: {}, length: 0, apex: null }\n @state() private selected: string | null = null\n @state() private note = ''\n private opened!: SectionWorking\n private history: SectionWorking[] = []\n private lastValid!: SectionWorking\n private openedAt = 0\n private dragging: string | null = null\n /** The state as it was when a drag began: kept once something moves, so a press alone is not a step back. */\n private dragFrom: SectionWorking | null = null\n private extent = 200\n\n private get axis(): Axis {\n return ((this.body && drawnOf(this.body.shape)?.axis) ?? 'y') as Axis\n }\n private get kind() {\n return this.body && drawnOf(this.body.shape)?.section.kind\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.working = workingOf(this.body!.shape)\n this.opened = this.working\n this.lastValid = this.working\n this.openedAt = this.revision\n this.extent = this.extentOf(this.working)\n window.addEventListener('keydown', this.keys, true)\n if (this.parentElement) this.room.observe(this.parentElement)\n }\n\n disconnectedCallback() {\n window.removeEventListener('keydown', this.keys, true)\n this.room.disconnect()\n super.disconnectedCallback()\n }\n\n /** How far the drawing reaches from the origin: the outline's farthest point with room around, in 50 mm steps. */\n private extentOf(w: SectionWorking): number {\n const [h, v] = SCREEN[this.axis]\n const far = Math.max(\n 1,\n ...w.points.flatMap(p => [Math.abs(p[h] ?? 0), Math.abs(p[v] ?? 0)]),\n ...Object.values(w.across).map(a => (a ?? 0) / 2),\n ...Object.values(w.apex ?? {}).map(a => Math.abs(a ?? 0))\n )\n return Math.ceil((far * 1.4 + 40) / 50) * 50\n }\n\n /*\n * Heard first (capture on the window), and a key the editor takes goes no further: the scene behind listens too, and\n * would take Esc as \"select nothing\" and Delete as \"delete the part\".\n */\n private keys = (e: KeyboardEvent) => {\n const inField = (e.composedPath()[0] as HTMLElement)?.tagName === 'INPUT'\n /* While the close is being asked, the question has the keys: Esc there is 계속 편집. */\n if (this.asking) return\n const take = () => (e.preventDefault(), e.stopImmediatePropagation())\n if (e.key === 'Escape') {\n take()\n this.requestClose()\n } else if ((e.key === 'Delete' || e.key === 'Backspace') && !inField && this.selected) {\n /* In a field the key deletes a character; outside, the chosen point. */\n take()\n this.removePoint(this.selected)\n } else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'z' && !inField) {\n take()\n this.back()\n }\n }\n\n private get stale() {\n return this.revision !== this.openedAt\n }\n\n private valid(w: SectionWorking) {\n return workingIssuesOf(this.body!.shape, w).words.length === 0\n }\n\n private change(next: SectionWorking) {\n this.history.push(this.working)\n this.working = next\n this.note = ''\n if (this.valid(next)) this.lastValid = next\n this.preview()\n }\n\n private back() {\n const before = this.history.pop()\n if (!before) return\n this.working = before\n if (this.valid(before)) this.lastValid = before\n this.preview()\n }\n\n /** The solid behind shows the working state, or the last valid one while the working one is refused. */\n private preview() {\n this.dispatchEvent(\n new CustomEvent('command-live', { detail: { action: this.action(this.lastValid) }, bubbles: true, composed: true })\n )\n }\n\n /** One command for everything changed since the editor opened; a measure not changed is not sent (it may follow another). */\n private action(w: SectionWorking): FigureAuthoringAction {\n const o = this.opened\n const changed = (a: number | undefined, b: number | undefined) => Math.abs((a ?? 0) - (b ?? 0)) > 1e-9\n const across = Object.fromEntries(Object.entries(w.across).filter(([k, v]) => changed(v, o.across[k as Axis])))\n const apexMoved = !w.apex !== !o.apex || (!!w.apex && Object.entries(w.apex).some(([k, v]) => changed(v, o.apex![k as Axis])))\n return {\n kind: 'set-section',\n part: this.body!.id,\n ...(this.kind === 'polygon' ? { points: w.points.map(p => ({ ...p })) } : {}),\n ...(Object.keys(across).length ? { across } : {}),\n ...(changed(w.length, o.length) ? { length: w.length } : {}),\n ...(apexMoved ? { apex: w.apex ? { ...w.apex } : null } : {})\n }\n }\n\n private removePoint(id: string) {\n const next = removePoint(this.working.points, id)\n if ('refused' in next) {\n this.note = i18next.t('figure.text.section-issue-too-few')\n return\n }\n this.selected = null\n this.change({ ...this.working, points: next })\n }\n\n /** A width across set: a circle's two are one. */\n private across(axis: Axis, value: number): SectionWorking {\n const [u, v] = SCREEN[this.axis]\n const both = this.measures?.round ? { [u]: value, [v]: value } : { [axis]: value }\n return { ...this.working, across: { ...this.working.across, ...both } }\n }\n\n private apply() {\n if (this.stale || !this.valid(this.working)) return\n this.dispatchEvent(new CustomEvent('command', { detail: { action: this.action(this.working) }, bubbles: true, composed: true }))\n this.close()\n }\n\n /** Whether anything was changed since the editor opened. */\n get dirty(): boolean {\n const key = (w: SectionWorking) =>\n JSON.stringify([\n w.points.map(p => [p.id, p.x ?? 0, p.y ?? 0, p.z ?? 0]),\n Object.entries(w.across).sort(),\n w.length,\n w.apex ? Object.entries(w.apex).sort() : null\n ])\n return !!this.opened && key(this.working) !== key(this.opened)\n }\n\n private asking = false\n /**\n * Close, asking first when something was changed (user 2026-10-01): apply it, let it go, or keep editing. True when the\n * editor closed; false when the person keeps editing.\n */\n async requestClose(): Promise<boolean> {\n if (!this.dirty) {\n this.cancel()\n return true\n }\n if (this.asking) return false\n const held = this.stale\n ? i18next.t('figure.text.section-editor-stale')\n : this.valid(this.working)\n ? ''\n : i18next.t('figure.text.section-editor-close-invalid')\n this.asking = true\n try {\n const choice = await openPopup<SectionCloseChoice>(html`<figure-section-close-choice .held=${held}></figure-section-close-choice>`, {\n backdrop: true,\n size: 'small',\n title: i18next.t('figure.label.section-editor')\n }).result\n if (choice === 'apply' && !held) {\n this.apply()\n return true\n }\n if (choice === 'discard') {\n this.cancel()\n return true\n }\n return false\n } finally {\n this.asking = false\n }\n }\n\n private cancel() {\n this.dispatchEvent(new CustomEvent('command-live', { detail: { action: null }, bubbles: true, composed: true }))\n this.close()\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('section-editor-close', { bubbles: true, composed: true }))\n }\n\n private svgPoint(e: PointerEvent): { h: number; v: number } {\n const el = this.renderRoot.querySelector('svg')!\n const pt = el.createSVGPoint()\n pt.x = e.clientX\n pt.y = e.clientY\n const p = pt.matrixTransform(el.getScreenCTM()!.inverse())\n return { h: Math.round(p.x), v: Math.round(p.y) }\n }\n\n /** Words for the face a length change keeps, by the part's relations; nothing when they cannot say. */\n private keptWords(): string {\n if (this.kept === undefined) return ''\n if (this.kept === 0) return i18next.t('figure.text.section-editor-keeps-centre')\n return i18next.t('figure.text.section-editor-keeps', {\n face: i18next.t('figure.label.face-' + END_FACE(this.axis, this.kept === 1 ? 'start' : 'end'))\n })\n }\n\n render() {\n if (!this.body) return nothing\n const { issues, words } = workingIssuesOf(this.body.shape, this.working)\n return html`\n <header>\n <h2>${i18next.t('figure.label.section-editor')}</h2>\n <span>${this.body.id}</span>\n </header>\n <nav tabs>\n ${(['outline', 'solid'] as const).map(\n one => html`<button ?on=${this.show === one} @click=${() => (this.show = one)}>${i18next.t(`figure.label.section-editor-${one}`)}</button>`\n )}\n </nav>\n <div body>\n <div outline>${this.drawing(issues, words.length > 0)}</div>\n <aside>${this.list(issues, words)}</aside>\n </div>\n <footer>\n <button ?disabled=${!this.history.length} @click=${() => this.back()}>${i18next.t('figure.button.section-editor-back')}</button>\n <span grow ?stale=${this.stale}>\n ${this.stale\n ? i18next.t('figure.text.section-editor-stale')\n : i18next.t(this.kind === 'polygon' ? 'figure.text.section-editor-hint' : 'figure.text.section-editor-hint-sized')}\n </span>\n <button @click=${() => this.requestClose()}>${i18next.t('figure.button.section-editor-cancel')}</button>\n <button primary ?disabled=${this.stale || words.length > 0} @click=${() => this.apply()}>${i18next.t('figure.button.section-editor-apply')}</button>\n </footer>\n `\n }\n\n /** A section drawn as the screen lays it: across to the right, then down. */\n private outline(section: FigureSection, attrs: { fill: string; stroke: string; width: number; dash?: string }, centre: Partial<Record<Axis, number>> = {}) {\n const [h, v] = SCREEN[this.axis]\n const ch = centre[h] ?? 0,\n cv = centre[v] ?? 0\n if (section.kind === 'polygon')\n return svg`<polygon points=${section.points.map(p => `${p[h]},${p[v]}`).join(' ')} fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n if (section.kind === 'ellipse')\n return svg`<ellipse cx=${ch} cy=${cv} rx=${section.radius[h]} ry=${section.radius[v]} fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n const w = section.size[h]!,\n d = section.size[v]!\n return svg`<rect x=${ch - w / 2} y=${cv - d / 2} width=${w} height=${d} rx=${section.corner?.[h] ?? 0} ry=${section.corner?.[v] ?? 0}\n fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n }\n\n private drawing(issues: ReturnType<typeof workingIssuesOf>['issues'], invalid: boolean) {\n const [h, v] = SCREEN[this.axis]\n const e = this.extent\n const marked = markedBy(issues)\n const w = this.working\n const section = sectionOf(this.body!.shape, w)\n const pts = w.points\n const sides = this.kind === 'polygon' && pts.length >= 2 ? figureSectionSidesOf({ kind: 'polygon', points: pts }, this.axis) : []\n const at = (id: string) => pts.find(p => p.id === id)!\n const grid = Math.max(10, Math.pow(10, Math.floor(Math.log10(e))) / 2)\n const lines: number[] = []\n for (let g = -Math.floor(e / grid) * grid; g <= e; g += grid) lines.push(g)\n const cavity = this.body!.shape.cavity\n const inside = cavity && !invalid ? figureCavitySectionOf(section, this.axis, cavity.wall) : undefined\n const sized = (axis: Axis) => this.measures?.measures[axis] === 'editable'\n return html`<div caption ?last-valid=${invalid}>\n ${invalid ? i18next.t('figure.text.section-editor-last-valid') : i18next.t('figure.text.section-editor-units', { h: h.toUpperCase(), v: v.toUpperCase() })}\n </div>\n <svg\n viewBox=${`${-e} ${-e} ${2 * e} ${2 * e}`}\n role=\"img\"\n aria-label=${i18next.t('figure.label.section-editor')}\n @pointermove=${(ev: PointerEvent) => {\n if (!this.dragging) return\n if (this.dragFrom) this.history.push(this.dragFrom), (this.dragFrom = null)\n const p = this.svgPoint(ev)\n const handle = /^handle:(.)$/.exec(this.dragging)\n this.working = handle\n ? this.across(handle[1] as Axis, Math.max(1, 2 * Math.abs(handle[1] === h ? p.h : p.v)))\n : this.dragging === 'apex'\n ? { ...this.working, apex: { [h]: p.h, [v]: p.v } }\n : { ...this.working, points: movePoint(this.working.points, this.dragging, { [h]: p.h, [v]: p.v }) }\n if (this.valid(this.working)) this.lastValid = this.working\n this.preview()\n }}\n @pointerup=${() => ((this.dragging = null), (this.dragFrom = null))}\n @pointerleave=${() => ((this.dragging = null), (this.dragFrom = null))}\n >\n ${svg`${lines.map(g => svg`<line x1=${g} y1=${-e} x2=${g} y2=${e} stroke=\"var(--md-sys-color-outline-variant)\" stroke-width=${e / 400} opacity=\"0.5\" />\n <line x1=${-e} y1=${g} x2=${e} y2=${g} stroke=\"var(--md-sys-color-outline-variant)\" stroke-width=${e / 400} opacity=\"0.5\" />`)}\n <line x1=${-e} y1=\"0\" x2=${e} y2=\"0\" stroke=\"var(--md-sys-color-outline)\" stroke-width=${e / 250} />\n <line x1=\"0\" y1=${-e} x2=\"0\" y2=${e} stroke=\"var(--md-sys-color-outline)\" stroke-width=${e / 250} />\n <text x=${e * 0.92} y=${-e * 0.02} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface-variant)\">${h.toUpperCase()}</text>\n <text x=${e * 0.02} y=${e * 0.95} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface-variant)\">${v.toUpperCase()}</text>\n ${invalid ? this.outline(sectionOf(this.body!.shape, this.lastValid), { fill: 'none', stroke: 'var(--md-sys-color-outline)', width: e / 250, dash: `${e / 50} ${e / 70}` }) : nothing}\n ${this.outline(section, {\n fill: invalid ? 'none' : 'color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent)',\n stroke: this.kind === 'polygon' ? 'none' : invalid ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)',\n width: e / 130\n })}\n ${inside && 'section' in inside\n ? this.outline(inside.section, { fill: 'var(--md-sys-color-surface)', stroke: 'var(--md-sys-color-primary)', width: e / 250, dash: `${e / 60} ${e / 90}` }, inside.centre)\n : nothing}\n ${sides.map(s => {\n const a = at(s.from!),\n b = at(s.to!)\n const bad = marked.sides.has(s.id)\n return svg`<line x1=${a[h]} y1=${a[v]} x2=${b[h]} y2=${b[v]}\n stroke=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)'} stroke-width=${e / (bad ? 90 : 130)}\n stroke-dasharray=${bad ? `${e / 40} ${e / 80}` : ''} />\n <line side=${s.id} x1=${a[h]} y1=${a[v]} x2=${b[h]} y2=${b[v]} stroke=\"transparent\" stroke-width=${e / 25} style=\"cursor: copy\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n const made = insertAfter(this.working.points, s.from!, this.axis)\n this.change({ ...this.working, points: made.points })\n this.selected = made.id\n }}><title>${i18next.t('figure.text.section-editor-add-here', { a: pointLabel(s.from!), b: pointLabel(s.to!) })}</title></line>`\n })}\n ${pts.map(p => {\n const bad = marked.points.has(p.id),\n on = this.selected === p.id\n return svg`<g point=${p.id} style=\"cursor: grab\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.selected = p.id\n this.dragging = p.id\n }}>\n <circle cx=${p[h]} cy=${p[v]} r=${e / (on ? 28 : 36)} fill=${bad ? 'var(--md-sys-color-error)' : on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-surface)'}\n stroke=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)'} stroke-width=${e / 250} />\n <text x=${p[h]! + e / 22} y=${p[v]! - e / 22} font-size=${e / 16} font-weight=\"600\"\n fill=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-on-surface)'}>${pointLabel(p.id)}</text>\n </g>`\n })}\n ${w.apex\n ? svg`${pts.map(p => svg`<line x1=${p[h]} y1=${p[v]} x2=${w.apex![h]} y2=${w.apex![v]} stroke=\"var(--md-sys-color-primary)\" stroke-width=${e / 300} stroke-dasharray=${`${e / 60} ${e / 90}`} />`)}\n <g apex style=\"cursor: grab\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.selected = null\n this.dragging = 'apex'\n }}>\n <rect x=${w.apex[h]! - e / 34} y=${w.apex[v]! - e / 34} width=${e / 17} height=${e / 17}\n transform=${`rotate(45 ${w.apex[h]} ${w.apex[v]})`} fill=\"var(--md-sys-color-tertiary)\" stroke=\"var(--md-sys-color-surface)\" stroke-width=${e / 250} />\n <text x=${w.apex[h]! + e / 22} y=${w.apex[v]! + e / 12} font-size=${e / 16} font-weight=\"600\" fill=\"var(--md-sys-color-on-surface)\">${i18next.t('figure.label.section-editor-apex-mark')}</text>\n <title>${i18next.t('figure.label.section-editor-apex-mark')}</title>\n </g>`\n : nothing}\n ${this.kind === 'polygon'\n ? nothing\n : ([h, v] as const).filter(sized).map(axis => {\n const half = (w.across[axis] ?? 0) / 2\n const cx = axis === h ? half : 0,\n cy = axis === h ? 0 : half\n return svg`<g handle=${axis} style=${`cursor: ${axis === h ? 'ew-resize' : 'ns-resize'}`}\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.dragging = `handle:${axis}`\n }}>\n <rect x=${cx - e / 40} y=${cy - e / 40} width=${e / 20} height=${e / 20} rx=${e / 120}\n fill=\"var(--md-sys-color-surface)\" stroke=\"var(--md-sys-color-primary)\" stroke-width=${e / 200} />\n <text x=${cx + e / 28} y=${cy - e / 28} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface)\">${Math.round((w.across[axis] ?? 0) * 10) / 10}</text>\n <title>${i18next.t('figure.label.section-editor-across', { axis: axis.toUpperCase() })}</title>\n </g>`\n })}`}\n </svg>`\n }\n\n /** A millimetre field: committed to the working state on change, a bad number put back. */\n private field(label: string, now: number, set: (value: number) => void, disabled = false, note = '') {\n return html`<label mm>\n <span>${label}</span>\n <input\n type=\"number\"\n step=\"any\"\n min=\"0\"\n inputmode=\"decimal\"\n aria-label=${label}\n .value=${live(String(Math.round(now * 1000) / 1000))}\n ?disabled=${disabled}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(now)\n return\n }\n set(value)\n }}\n />\n ${note ? html`<small>${note}</small>` : nothing}\n </label>`\n }\n\n /** A drawn section's end: the section again (a push) or one point (a pyramid), and where that point is. */\n private apexFields() {\n const [h, v] = SCREEN[this.axis]\n const apex = this.working.apex\n /* The kernel's refusal holds only for turning a push into a pyramid; a pyramid can always be made a push again. */\n const blocked = !apex && !this.opened?.apex ? this.pointBlocked : ''\n return html`<label apex>\n <input\n type=\"checkbox\"\n .checked=${live(!!apex)}\n ?disabled=${!!blocked}\n @change=${(ev: Event) => {\n const on = (ev.target as HTMLInputElement).checked\n this.change({ ...this.working, apex: on ? (this.opened.apex ?? apexOver(this.working.points, this.axis)) : null })\n }}\n />\n <span>${i18next.t('figure.label.section-editor-apex')}</span>\n ${blocked ? html`<small>${blocked}</small>` : nothing}\n </label>\n ${apex\n ? ([h, v] as const).map(axis =>\n html`<label mm>\n <span>${i18next.t('figure.label.section-editor-apex-at', { axis: axis.toUpperCase() })}</span>\n <input\n type=\"number\"\n step=\"any\"\n inputmode=\"decimal\"\n aria-label=${i18next.t('figure.label.section-editor-apex-at', { axis: axis.toUpperCase() })}\n .value=${live(String(apex[axis] ?? ''))}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(apex[axis] ?? '')\n return\n }\n this.change({ ...this.working, apex: { ...apex, [axis]: value } })\n }}\n />\n </label>`\n )\n : nothing}`\n }\n\n private list(issues: ReturnType<typeof workingIssuesOf>['issues'], words: ReturnType<typeof workingIssuesOf>['words']) {\n const [h, v] = SCREEN[this.axis]\n const marked = markedBy(issues)\n const m = this.measures?.measures\n const linked = i18next.t('figure.text.section-editor-linked')\n return html`<div sizes>\n ${this.field(\n i18next.t(this.working.apex ? 'figure.label.section-editor-height' : 'figure.label.section-editor-length'),\n this.working.length,\n value => this.change({ ...this.working, length: value }),\n m?.[this.axis] !== 'editable',\n m?.[this.axis] === 'linked' ? linked : this.keptWords()\n )}\n ${this.kind === 'polygon' ? this.apexFields() : nothing}\n ${this.kind === 'polygon'\n ? nothing\n : this.measures?.round\n ? this.field(i18next.t('figure.label.section-editor-diameter'), this.working.across[h] ?? 0, value => this.change(this.across(h, value)), m?.[h] !== 'editable', m?.[h] === 'linked' ? linked : '')\n : ([h, v] as const).map(axis =>\n this.field(\n i18next.t('figure.label.section-editor-across', { axis: axis.toUpperCase() }),\n this.working.across[axis] ?? 0,\n value => this.change(this.across(axis, value)),\n m?.[axis] !== 'editable',\n m?.[axis] === 'linked' ? linked : ''\n )\n )}\n </div>\n ${this.kind === 'polygon'\n ? html`<ol points aria-label=${i18next.t('figure.label.section-editor-points')}>\n ${this.working.points.map(\n p => html`<li ?selected=${this.selected === p.id} ?marked=${marked.points.has(p.id)} @focusin=${() => (this.selected = p.id)}>\n <b>${pointLabel(p.id)}</b>\n ${([h, v] as const).map(\n axis => html`<input\n type=\"number\"\n step=\"any\"\n inputmode=\"decimal\"\n aria-label=${i18next.t('figure.label.section-editor-coordinate', { point: pointLabel(p.id), axis: axis.toUpperCase() })}\n .value=${live(String(p[axis] ?? ''))}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(p[axis] ?? '')\n return\n }\n this.change({ ...this.working, points: movePoint(this.working.points, p.id, { [axis]: value }) })\n }}\n />`\n )}\n <button\n ?disabled=${this.working.points.length <= 3}\n title=${this.working.points.length <= 3 ? i18next.t('figure.text.section-issue-too-few') : ''}\n aria-label=${i18next.t('figure.button.section-editor-remove', { point: pointLabel(p.id) })}\n @click=${() => this.removePoint(p.id)}\n >\n ${i18next.t('figure.button.section-editor-remove', { point: pointLabel(p.id) })}\n </button>\n </li>`\n )}\n </ol>`\n : nothing}\n ${this.note ? html`<small role=\"status\">${this.note}</small>` : nothing}\n ${words.length\n ? html`<ul issues role=\"alert\">\n ${words.map(w => html`<li>${i18next.t(w.key, w.params)}</li>`)}\n </ul>`\n : nothing}`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AAK,EAAE;;iDAAkB;AA9Of,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CAwzB/B","sourcesContent":["import { css, html, LitElement, nothing, svg } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { figureCavitySectionOf, figureSectionSidesOf } from '@hatiolab/figure-model'\nimport type { FigureAuthoringAction, FigureEvaluatedShape, FigureSection, FigureSectionMeasure, FigureSectionPoint } from '@hatiolab/figure-model'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { apexOver, drawnOf, insertAfter, markedBy, movePoint, pointLabel, removePoint, sectionOf, workingIssuesOf, workingOf, workingShapeOf, type SectionWorking } from './section-drawing.js'\nimport { cavityDepthOf, cavityRequestOf, cavityResultOf, END_FACE, sameOf, sidesOf } from './section-controls.js'\nimport './figure-cavity-drawing.js'\nimport { openPopup } from '@operato/layout'\nimport './figure-section-close-choice.js'\nimport type { SectionCloseChoice } from './figure-section-close-choice.js'\n\ntype Axis = 'x' | 'y' | 'z'\n\n/** How the section is laid on the screen, by the axis it is pushed along: across to the right, then down. */\nconst SCREEN: Record<Axis, [Axis, Axis]> = { y: ['x', 'z'], x: ['z', 'y'], z: ['x', 'y'] }\n\n/** The inside said so two can be compared: its walls by side, its ends. */\nconst cavityKey = (w: SectionWorking) =>\n w.cavity ? [Object.entries(w.cavity.wall).sort(), w.cavity.start, w.cavity.end] : null\n\n/** The editor's width and room for the solid beside it: below this the two take turns. */\nexport const NARROW_BELOW = 900\n\n/**\n * 단면 편집 — a pushed part's section and length in one editor (ADR-0100 §3.2, stage 2).\n *\n * The outline is drawn flat, looking along the push, in millimetres from the part's origin; the figure behind stays in\n * view and shows the solid the working state makes (`command-live`, the same preview the section panel uses), so the 2D\n * and the 3D stand side by side. A drawn section's point is dragged or typed, a side pressed gains a point in its\n * middle, a point is deleted, never below three. A rectangle's width and depth and an ellipse's diameters are dragged by\n * their handles or typed; a circle's two are one. The push's length is typed, and the face it keeps is the one the\n * part's placement or fastening keeps (§4.1: read here, changed elsewhere). A measure that follows another value is\n * shown and not offered.\n *\n * A drawn section's end can be drawn to one point -- a pyramid, a tetrahedron from three points (§4.1.1, A5-1): the\n * apex is dragged or typed like a point, and is not offered while something is fastened to the end it takes away (the\n * kernel's own refusal, `pointBlocked`).\n *\n * A rectangle's or ellipse's inside is made, changed or taken away here too, by the same drawing the section panel has\n * (figure-cavity-drawing), drawn and judged on the widths being typed: walls that fit only a wider section are taken\n * with it, in the same command (figure-model `set-section`'s `cavity`).\n *\n * What the kernel would refuse is marked on the outline and said in the list; apply is held back, and the solid shows\n * the last valid state, which the caption names. Apply sends one `set-section` command (one step of the history); cancel\n * or Esc sends nothing and lets the preview go -- after asking, when something was changed: apply it, let it go, or keep\n * editing (`requestClose`). The undo here is the editor's own. If the figure changes while the editor\n * is open, apply is refused until it is opened again.\n */\n@customElement('figure-section-editor')\nexport class FigureSectionEditor extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n position: absolute;\n left: 12px;\n top: 12px;\n bottom: 12px;\n z-index: 5;\n display: grid;\n grid-template-rows: auto auto minmax(0, 1fr) auto;\n width: min(560px, calc(100% - 24px));\n background: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 12px;\n box-shadow: 0 8px 24px rgb(0 0 0 / 18%);\n overflow: hidden;\n }\n /* Each in its own row: the tabs are hidden on a wide screen, and without the rows named the body fell into theirs. */\n header {\n grid-row: 1;\n }\n nav[tabs] {\n grid-row: 2;\n }\n div[body] {\n grid-row: 3;\n }\n footer {\n grid-row: 4;\n }\n header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n padding: 10px 14px 4px;\n }\n header h2 {\n margin: 0;\n font-size: var(--ui-t-body);\n }\n header span {\n font-size: 0.72rem;\n color: var(--md-sys-color-on-surface-variant);\n }\n nav[tabs] {\n display: none;\n gap: 4px;\n padding: 0 14px 6px;\n }\n nav[tabs] button,\n footer button,\n li button {\n font: inherit;\n font-size: 0.78rem;\n min-height: 30px;\n padding: 0 12px;\n border-radius: 15px;\n border: 1px solid var(--md-sys-color-outline-variant);\n background: var(--md-sys-color-surface-container-lowest);\n color: var(--md-sys-color-on-surface);\n cursor: pointer;\n }\n nav[tabs] button[on] {\n background: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n div[body] {\n display: grid;\n grid-template-rows: minmax(160px, 1fr) auto;\n min-height: 0;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n div[outline] {\n position: relative;\n min-height: 0;\n }\n svg {\n width: 100%;\n height: 100%;\n display: block;\n touch-action: none;\n user-select: none;\n }\n div[caption] {\n position: absolute;\n left: 8px;\n top: 6px;\n font-size: 0.68rem;\n color: var(--md-sys-color-on-surface-variant);\n pointer-events: none;\n }\n div[caption][last-valid] {\n color: var(--md-sys-color-error);\n font-weight: 600;\n }\n aside {\n max-height: 34vh;\n overflow: auto;\n padding: 8px 14px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n div[sizes] {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 6px;\n margin-bottom: 8px;\n }\n label[mm] {\n display: grid;\n gap: 2px;\n }\n label[mm] input {\n min-width: 0;\n font: inherit;\n }\n label[apex] {\n display: flex;\n align-items: center;\n gap: 6px;\n grid-column: 1 / -1;\n }\n label[apex] small {\n flex-basis: 100%;\n }\n ol[points] {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n }\n ol[points] li {\n display: grid;\n grid-template-columns: 2.2em minmax(0, 1fr) minmax(0, 1fr) auto;\n gap: 6px;\n align-items: center;\n padding: 2px 4px;\n border-radius: 6px;\n }\n ol[points] li[selected] {\n background: var(--md-sys-color-secondary-container);\n }\n ol[points] li[marked] b {\n color: var(--md-sys-color-error);\n }\n ol[points] input {\n min-width: 0;\n font: inherit;\n }\n div[cavity] {\n display: grid;\n gap: 6px;\n margin-top: 10px;\n padding-top: 8px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n /* The panel's width: wider, the drawing pushed the outline out of view. */\n div[cavity] figure-cavity-drawing {\n max-width: 340px;\n }\n label[toggle] {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-wrap: wrap;\n }\n label[toggle] small[result] {\n margin-left: auto;\n }\n ul[issues] {\n margin: 8px 0 0;\n padding: 0 0 0 16px;\n color: var(--md-sys-color-error);\n font-size: 0.76rem;\n }\n small {\n color: var(--md-sys-color-on-surface-variant);\n }\n footer {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 14px;\n border-top: 1px solid var(--md-sys-color-outline-variant);\n }\n footer span[grow] {\n flex: 1;\n font-size: 0.72rem;\n color: var(--md-sys-color-on-surface-variant);\n }\n footer span[grow][stale] {\n color: var(--md-sys-color-error);\n }\n footer button[primary] {\n background: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n border-color: transparent;\n }\n button:disabled {\n opacity: 0.45;\n cursor: default;\n }\n /* Too little room beside the editor for the solid: the outline and the solid take turns (§7). */\n :host([narrow]) nav[tabs] {\n display: flex;\n }\n :host([narrow][show='solid']) div[body] {\n display: none;\n }\n :host([narrow][show='solid']) {\n bottom: auto;\n }\n `]\n\n /** The part and its evaluated shape as they stand when the editor opens. */\n @property({ attribute: false }) body?: { id: string; shape: FigureEvaluatedShape }\n /** Which of its measures can be set (figure-model's `figureSectionMeasuresOf`). */\n @property({ attribute: false }) measures?: { measures: Record<Axis, FigureSectionMeasure>; round: boolean }\n /** Along the push, the face a length change keeps: 1 its start, -1 its end, 0 its centre; undefined when it cannot be said. */\n @property({ attribute: false }) kept?: -1 | 0 | 1\n /** Why a push's end cannot be drawn to a point now, in the kernel's words (what is fastened to it); empty when it can. */\n @property({ attribute: false }) pointBlocked = ''\n /** The figure's revision now; the editor remembers the one it opened at. */\n @property({ type: Number }) revision = 0\n /** Narrow: the outline or the solid behind. */\n @property({ reflect: true }) show: 'outline' | 'solid' = 'outline'\n /** Set when the space the editor stands in leaves too little beside it to see the solid. */\n @property({ type: Boolean, reflect: true }) narrow = false\n private room = new ResizeObserver(([entry]) => {\n this.narrow = (entry?.contentRect.width ?? 0) < NARROW_BELOW\n if (!this.narrow) this.show = 'outline'\n })\n\n @state() private working: SectionWorking = { points: [], across: {}, length: 0, apex: null, cavity: null }\n /** Walls one per side in the inside's drawing; on when they open differing. */\n @state() private perSide = false\n @state() private selected: string | null = null\n @state() private note = ''\n private opened!: SectionWorking\n private history: SectionWorking[] = []\n private lastValid!: SectionWorking\n private openedAt = 0\n private dragging: string | null = null\n /** The state as it was when a drag began: kept once something moves, so a press alone is not a step back. */\n private dragFrom: SectionWorking | null = null\n private extent = 200\n\n private get axis(): Axis {\n return ((this.body && drawnOf(this.body.shape)?.axis) ?? 'y') as Axis\n }\n private get kind() {\n return this.body && drawnOf(this.body.shape)?.section.kind\n }\n /** A pushed rectangle or ellipse can have an inside; a drawn section's is a later stage. */\n private get hollowable() {\n return !!this.body?.shape.extrusion && (this.kind === 'rectangle' || this.kind === 'ellipse')\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.working = workingOf(this.body!.shape)\n this.opened = this.working\n this.lastValid = this.working\n this.openedAt = this.revision\n this.extent = this.extentOf(this.working)\n this.perSide = !!this.working.cavity && sameOf(Object.values(this.working.cavity.wall)) === undefined\n window.addEventListener('keydown', this.keys, true)\n if (this.parentElement) this.room.observe(this.parentElement)\n }\n\n disconnectedCallback() {\n window.removeEventListener('keydown', this.keys, true)\n this.room.disconnect()\n super.disconnectedCallback()\n }\n\n /** How far the drawing reaches from the origin: the outline's farthest point with room around, in 50 mm steps. */\n private extentOf(w: SectionWorking): number {\n const [h, v] = SCREEN[this.axis]\n const far = Math.max(\n 1,\n ...w.points.flatMap(p => [Math.abs(p[h] ?? 0), Math.abs(p[v] ?? 0)]),\n ...Object.values(w.across).map(a => (a ?? 0) / 2),\n ...Object.values(w.apex ?? {}).map(a => Math.abs(a ?? 0))\n )\n return Math.ceil((far * 1.4 + 40) / 50) * 50\n }\n\n /*\n * Heard first (capture on the window), and a key the editor takes goes no further: the scene behind listens too, and\n * would take Esc as \"select nothing\" and Delete as \"delete the part\".\n */\n private keys = (e: KeyboardEvent) => {\n const inField = (e.composedPath()[0] as HTMLElement)?.tagName === 'INPUT'\n /* A number being typed in the inside's drawing: Esc there puts the number back, not the editor away. */\n if (inField && e.composedPath().some(el => (el as HTMLElement).tagName === 'FIGURE-CAVITY-DRAWING')) return\n /* While the close is being asked, the question has the keys: Esc there is 계속 편집. */\n if (this.asking) return\n const take = () => (e.preventDefault(), e.stopImmediatePropagation())\n if (e.key === 'Escape') {\n take()\n this.requestClose()\n } else if ((e.key === 'Delete' || e.key === 'Backspace') && !inField && this.selected) {\n /* In a field the key deletes a character; outside, the chosen point. */\n take()\n this.removePoint(this.selected)\n } else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'z' && !inField) {\n take()\n this.back()\n }\n }\n\n private get stale() {\n return this.revision !== this.openedAt\n }\n\n private valid(w: SectionWorking) {\n return workingIssuesOf(this.body!.shape, w).words.length === 0\n }\n\n private change(next: SectionWorking) {\n this.history.push(this.working)\n this.working = next\n this.note = ''\n if (this.valid(next)) this.lastValid = next\n this.preview()\n }\n\n private back() {\n const before = this.history.pop()\n if (!before) return\n this.working = before\n if (this.valid(before)) this.lastValid = before\n this.preview()\n }\n\n /** The solid behind shows the working state, or the last valid one while the working one is refused. */\n private preview(w = this.lastValid) {\n this.dispatchEvent(new CustomEvent('command-live', { detail: { action: this.action(w) }, bubbles: true, composed: true }))\n }\n\n /** One command for everything changed since the editor opened; a measure not changed is not sent (it may follow another). */\n private action(w: SectionWorking): FigureAuthoringAction {\n const o = this.opened\n const changed = (a: number | undefined, b: number | undefined) => Math.abs((a ?? 0) - (b ?? 0)) > 1e-9\n const across = Object.fromEntries(Object.entries(w.across).filter(([k, v]) => changed(v, o.across[k as Axis])))\n const apexMoved = !w.apex !== !o.apex || (!!w.apex && Object.entries(w.apex).some(([k, v]) => changed(v, o.apex![k as Axis])))\n const cavityMoved = JSON.stringify(cavityKey(w)) !== JSON.stringify(cavityKey(o))\n return {\n kind: 'set-section',\n part: this.body!.id,\n ...(this.kind === 'polygon' ? { points: w.points.map(p => ({ ...p })) } : {}),\n ...(Object.keys(across).length ? { across } : {}),\n ...(changed(w.length, o.length) ? { length: w.length } : {}),\n ...(apexMoved ? { apex: w.apex ? { ...w.apex } : null } : {}),\n ...(cavityMoved ? { cavity: w.cavity ? { wall: { ...w.cavity.wall }, start: w.cavity.start, end: w.cavity.end } : null } : {})\n }\n }\n\n private removePoint(id: string) {\n const next = removePoint(this.working.points, id)\n if ('refused' in next) {\n this.note = i18next.t('figure.text.section-issue-too-few')\n return\n }\n this.selected = null\n this.change({ ...this.working, points: next })\n }\n\n /** A width across set: a circle's two are one. */\n private across(axis: Axis, value: number): SectionWorking {\n const [u, v] = SCREEN[this.axis]\n const both = this.measures?.round ? { [u]: value, [v]: value } : { [axis]: value }\n return { ...this.working, across: { ...this.working.across, ...both } }\n }\n\n private apply() {\n if (this.stale || !this.valid(this.working)) return\n this.dispatchEvent(new CustomEvent('command', { detail: { action: this.action(this.working) }, bubbles: true, composed: true }))\n this.close()\n }\n\n /** Whether anything was changed since the editor opened. */\n get dirty(): boolean {\n const key = (w: SectionWorking) =>\n JSON.stringify([\n w.points.map(p => [p.id, p.x ?? 0, p.y ?? 0, p.z ?? 0]),\n Object.entries(w.across).sort(),\n w.length,\n w.apex ? Object.entries(w.apex).sort() : null,\n cavityKey(w)\n ])\n return !!this.opened && key(this.working) !== key(this.opened)\n }\n\n private asking = false\n /**\n * Close, asking first when something was changed (user 2026-10-01): apply it, let it go, or keep editing. True when the\n * editor closed; false when the person keeps editing.\n */\n async requestClose(): Promise<boolean> {\n if (!this.dirty) {\n this.cancel()\n return true\n }\n if (this.asking) return false\n const held = this.stale\n ? i18next.t('figure.text.section-editor-stale')\n : this.valid(this.working)\n ? ''\n : i18next.t('figure.text.section-editor-close-invalid')\n this.asking = true\n try {\n const choice = await openPopup<SectionCloseChoice>(html`<figure-section-close-choice .held=${held}></figure-section-close-choice>`, {\n backdrop: true,\n size: 'small',\n title: i18next.t('figure.label.section-editor')\n }).result\n if (choice === 'apply' && !held) {\n this.apply()\n return true\n }\n if (choice === 'discard') {\n this.cancel()\n return true\n }\n return false\n } finally {\n this.asking = false\n }\n }\n\n private cancel() {\n this.dispatchEvent(new CustomEvent('command-live', { detail: { action: null }, bubbles: true, composed: true }))\n this.close()\n }\n\n private close() {\n this.dispatchEvent(new CustomEvent('section-editor-close', { bubbles: true, composed: true }))\n }\n\n private svgPoint(e: PointerEvent): { h: number; v: number } {\n const el = this.renderRoot.querySelector('svg')!\n const pt = el.createSVGPoint()\n pt.x = e.clientX\n pt.y = e.clientY\n const p = pt.matrixTransform(el.getScreenCTM()!.inverse())\n return { h: Math.round(p.x), v: Math.round(p.y) }\n }\n\n /** Words for the face a length change keeps, by the part's relations; nothing when they cannot say. */\n private keptWords(): string {\n if (this.kept === undefined) return ''\n if (this.kept === 0) return i18next.t('figure.text.section-editor-keeps-centre')\n return i18next.t('figure.text.section-editor-keeps', {\n face: i18next.t('figure.label.face-' + END_FACE(this.axis, this.kept === 1 ? 'start' : 'end'))\n })\n }\n\n render() {\n if (!this.body) return nothing\n const { issues, words } = workingIssuesOf(this.body.shape, this.working)\n return html`\n <header>\n <h2>${i18next.t('figure.label.section-editor')}</h2>\n <span>${this.body.id}</span>\n </header>\n <nav tabs>\n ${(['outline', 'solid'] as const).map(\n one => html`<button ?on=${this.show === one} @click=${() => (this.show = one)}>${i18next.t(`figure.label.section-editor-${one}`)}</button>`\n )}\n </nav>\n <div body>\n <div outline>${this.drawing(issues, words.length > 0)}</div>\n <aside>${this.list(issues, words)}</aside>\n </div>\n <footer>\n <button ?disabled=${!this.history.length} @click=${() => this.back()}>${i18next.t('figure.button.section-editor-back')}</button>\n <span grow ?stale=${this.stale}>\n ${this.stale\n ? i18next.t('figure.text.section-editor-stale')\n : i18next.t(this.kind === 'polygon' ? 'figure.text.section-editor-hint' : 'figure.text.section-editor-hint-sized')}\n </span>\n <button @click=${() => this.requestClose()}>${i18next.t('figure.button.section-editor-cancel')}</button>\n <button primary ?disabled=${this.stale || words.length > 0} @click=${() => this.apply()}>${i18next.t('figure.button.section-editor-apply')}</button>\n </footer>\n `\n }\n\n /** A section drawn as the screen lays it: across to the right, then down. */\n private outline(section: FigureSection, attrs: { fill: string; stroke: string; width: number; dash?: string }, centre: Partial<Record<Axis, number>> = {}) {\n const [h, v] = SCREEN[this.axis]\n const ch = centre[h] ?? 0,\n cv = centre[v] ?? 0\n if (section.kind === 'polygon')\n return svg`<polygon points=${section.points.map(p => `${p[h]},${p[v]}`).join(' ')} fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n if (section.kind === 'ellipse')\n return svg`<ellipse cx=${ch} cy=${cv} rx=${section.radius[h]} ry=${section.radius[v]} fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n const w = section.size[h]!,\n d = section.size[v]!\n return svg`<rect x=${ch - w / 2} y=${cv - d / 2} width=${w} height=${d} rx=${section.corner?.[h] ?? 0} ry=${section.corner?.[v] ?? 0}\n fill=${attrs.fill} stroke=${attrs.stroke} stroke-width=${attrs.width} stroke-dasharray=${attrs.dash ?? ''} />`\n }\n\n private drawing(issues: ReturnType<typeof workingIssuesOf>['issues'], invalid: boolean) {\n const [h, v] = SCREEN[this.axis]\n const e = this.extent\n const marked = markedBy(issues)\n const w = this.working\n const section = sectionOf(this.body!.shape, w)\n const pts = w.points\n const sides = this.kind === 'polygon' && pts.length >= 2 ? figureSectionSidesOf({ kind: 'polygon', points: pts }, this.axis) : []\n const at = (id: string) => pts.find(p => p.id === id)!\n const grid = Math.max(10, Math.pow(10, Math.floor(Math.log10(e))) / 2)\n const lines: number[] = []\n for (let g = -Math.floor(e / grid) * grid; g <= e; g += grid) lines.push(g)\n const inside = w.cavity && !invalid ? figureCavitySectionOf(section, this.axis, w.cavity.wall) : undefined\n const sized = (axis: Axis) => this.measures?.measures[axis] === 'editable'\n return html`<div caption ?last-valid=${invalid}>\n ${invalid ? i18next.t('figure.text.section-editor-last-valid') : i18next.t('figure.text.section-editor-units', { h: h.toUpperCase(), v: v.toUpperCase() })}\n </div>\n <svg\n viewBox=${`${-e} ${-e} ${2 * e} ${2 * e}`}\n role=\"img\"\n aria-label=${i18next.t('figure.label.section-editor')}\n @pointermove=${(ev: PointerEvent) => {\n if (!this.dragging) return\n if (this.dragFrom) this.history.push(this.dragFrom), (this.dragFrom = null)\n const p = this.svgPoint(ev)\n const handle = /^handle:(.)$/.exec(this.dragging)\n this.working = handle\n ? this.across(handle[1] as Axis, Math.max(1, 2 * Math.abs(handle[1] === h ? p.h : p.v)))\n : this.dragging === 'apex'\n ? { ...this.working, apex: { [h]: p.h, [v]: p.v } }\n : { ...this.working, points: movePoint(this.working.points, this.dragging, { [h]: p.h, [v]: p.v }) }\n if (this.valid(this.working)) this.lastValid = this.working\n this.preview()\n }}\n @pointerup=${() => ((this.dragging = null), (this.dragFrom = null))}\n @pointerleave=${() => ((this.dragging = null), (this.dragFrom = null))}\n >\n ${svg`${lines.map(g => svg`<line x1=${g} y1=${-e} x2=${g} y2=${e} stroke=\"var(--md-sys-color-outline-variant)\" stroke-width=${e / 400} opacity=\"0.5\" />\n <line x1=${-e} y1=${g} x2=${e} y2=${g} stroke=\"var(--md-sys-color-outline-variant)\" stroke-width=${e / 400} opacity=\"0.5\" />`)}\n <line x1=${-e} y1=\"0\" x2=${e} y2=\"0\" stroke=\"var(--md-sys-color-outline)\" stroke-width=${e / 250} />\n <line x1=\"0\" y1=${-e} x2=\"0\" y2=${e} stroke=\"var(--md-sys-color-outline)\" stroke-width=${e / 250} />\n <text x=${e * 0.92} y=${-e * 0.02} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface-variant)\">${h.toUpperCase()}</text>\n <text x=${e * 0.02} y=${e * 0.95} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface-variant)\">${v.toUpperCase()}</text>\n ${invalid ? this.outline(sectionOf(this.body!.shape, this.lastValid), { fill: 'none', stroke: 'var(--md-sys-color-outline)', width: e / 250, dash: `${e / 50} ${e / 70}` }) : nothing}\n ${this.outline(section, {\n fill: invalid ? 'none' : 'color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent)',\n stroke: this.kind === 'polygon' ? 'none' : invalid ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)',\n width: e / 130\n })}\n ${inside && 'section' in inside\n ? this.outline(inside.section, { fill: 'var(--md-sys-color-surface)', stroke: 'var(--md-sys-color-primary)', width: e / 250, dash: `${e / 60} ${e / 90}` }, inside.centre)\n : nothing}\n ${sides.map(s => {\n const a = at(s.from!),\n b = at(s.to!)\n const bad = marked.sides.has(s.id)\n return svg`<line x1=${a[h]} y1=${a[v]} x2=${b[h]} y2=${b[v]}\n stroke=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)'} stroke-width=${e / (bad ? 90 : 130)}\n stroke-dasharray=${bad ? `${e / 40} ${e / 80}` : ''} />\n <line side=${s.id} x1=${a[h]} y1=${a[v]} x2=${b[h]} y2=${b[v]} stroke=\"transparent\" stroke-width=${e / 25} style=\"cursor: copy\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n const made = insertAfter(this.working.points, s.from!, this.axis)\n this.change({ ...this.working, points: made.points })\n this.selected = made.id\n }}><title>${i18next.t('figure.text.section-editor-add-here', { a: pointLabel(s.from!), b: pointLabel(s.to!) })}</title></line>`\n })}\n ${pts.map(p => {\n const bad = marked.points.has(p.id),\n on = this.selected === p.id\n return svg`<g point=${p.id} style=\"cursor: grab\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.selected = p.id\n this.dragging = p.id\n }}>\n <circle cx=${p[h]} cy=${p[v]} r=${e / (on ? 28 : 36)} fill=${bad ? 'var(--md-sys-color-error)' : on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-surface)'}\n stroke=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-primary)'} stroke-width=${e / 250} />\n <text x=${p[h]! + e / 22} y=${p[v]! - e / 22} font-size=${e / 16} font-weight=\"600\"\n fill=${bad ? 'var(--md-sys-color-error)' : 'var(--md-sys-color-on-surface)'}>${pointLabel(p.id)}</text>\n </g>`\n })}\n ${w.apex\n ? svg`${pts.map(p => svg`<line x1=${p[h]} y1=${p[v]} x2=${w.apex![h]} y2=${w.apex![v]} stroke=\"var(--md-sys-color-primary)\" stroke-width=${e / 300} stroke-dasharray=${`${e / 60} ${e / 90}`} />`)}\n <g apex style=\"cursor: grab\"\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.selected = null\n this.dragging = 'apex'\n }}>\n <rect x=${w.apex[h]! - e / 34} y=${w.apex[v]! - e / 34} width=${e / 17} height=${e / 17}\n transform=${`rotate(45 ${w.apex[h]} ${w.apex[v]})`} fill=\"var(--md-sys-color-tertiary)\" stroke=\"var(--md-sys-color-surface)\" stroke-width=${e / 250} />\n <text x=${w.apex[h]! + e / 22} y=${w.apex[v]! + e / 12} font-size=${e / 16} font-weight=\"600\" fill=\"var(--md-sys-color-on-surface)\">${i18next.t('figure.label.section-editor-apex-mark')}</text>\n <title>${i18next.t('figure.label.section-editor-apex-mark')}</title>\n </g>`\n : nothing}\n ${this.kind === 'polygon'\n ? nothing\n : ([h, v] as const).filter(sized).map(axis => {\n const half = (w.across[axis] ?? 0) / 2\n const cx = axis === h ? half : 0,\n cy = axis === h ? 0 : half\n return svg`<g handle=${axis} style=${`cursor: ${axis === h ? 'ew-resize' : 'ns-resize'}`}\n @pointerdown=${(ev: PointerEvent) => {\n ev.stopPropagation()\n ;(ev.target as Element).setPointerCapture?.(ev.pointerId)\n this.dragFrom = this.working\n this.dragging = `handle:${axis}`\n }}>\n <rect x=${cx - e / 40} y=${cy - e / 40} width=${e / 20} height=${e / 20} rx=${e / 120}\n fill=\"var(--md-sys-color-surface)\" stroke=\"var(--md-sys-color-primary)\" stroke-width=${e / 200} />\n <text x=${cx + e / 28} y=${cy - e / 28} font-size=${e / 18} fill=\"var(--md-sys-color-on-surface)\">${Math.round((w.across[axis] ?? 0) * 10) / 10}</text>\n <title>${i18next.t('figure.label.section-editor-across', { axis: axis.toUpperCase() })}</title>\n </g>`\n })}`}\n </svg>`\n }\n\n /** A millimetre field: committed to the working state on change, a bad number put back. */\n private field(label: string, now: number, set: (value: number) => void, disabled = false, note = '') {\n return html`<label mm>\n <span>${label}</span>\n <input\n type=\"number\"\n step=\"any\"\n min=\"0\"\n inputmode=\"decimal\"\n aria-label=${label}\n .value=${live(String(Math.round(now * 1000) / 1000))}\n ?disabled=${disabled}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(now)\n return\n }\n set(value)\n }}\n />\n ${note ? html`<small>${note}</small>` : nothing}\n </label>`\n }\n\n /** A drawn section's end: the section again (a push) or one point (a pyramid), and where that point is. */\n private apexFields() {\n const [h, v] = SCREEN[this.axis]\n const apex = this.working.apex\n /* The kernel's refusal holds only for turning a push into a pyramid; a pyramid can always be made a push again. */\n const blocked = !apex && !this.opened?.apex ? this.pointBlocked : ''\n return html`<label apex>\n <input\n type=\"checkbox\"\n .checked=${live(!!apex)}\n ?disabled=${!!blocked}\n @change=${(ev: Event) => {\n const on = (ev.target as HTMLInputElement).checked\n this.change({ ...this.working, apex: on ? (this.opened.apex ?? apexOver(this.working.points, this.axis)) : null })\n }}\n />\n <span>${i18next.t('figure.label.section-editor-apex')}</span>\n ${blocked ? html`<small>${blocked}</small>` : nothing}\n </label>\n ${apex\n ? ([h, v] as const).map(axis =>\n html`<label mm>\n <span>${i18next.t('figure.label.section-editor-apex-at', { axis: axis.toUpperCase() })}</span>\n <input\n type=\"number\"\n step=\"any\"\n inputmode=\"decimal\"\n aria-label=${i18next.t('figure.label.section-editor-apex-at', { axis: axis.toUpperCase() })}\n .value=${live(String(apex[axis] ?? ''))}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(apex[axis] ?? '')\n return\n }\n this.change({ ...this.working, apex: { ...apex, [axis]: value } })\n }}\n />\n </label>`\n )\n : nothing}`\n }\n\n /** The inside, as the section panel shows it, on the working section: on or off, what it makes, its drawing. */\n private cavityBlock(invalid: boolean) {\n const w = this.working\n const shape = workingShapeOf(this.body!.shape, w)\n return html`<div cavity>\n <label toggle>\n <input\n type=\"checkbox\"\n .checked=${live(!!w.cavity)}\n @change=${(ev: Event) => {\n const on = (ev.target as HTMLInputElement).checked\n const ask = cavityRequestOf(shape, {})\n const wall = typeof ask.wall === 'number' ? Object.fromEntries(sidesOf(this.axis).map(side => [side, ask.wall as number])) : (ask.wall as Record<string, number>)\n this.change({ ...w, cavity: on ? { wall, start: ask.start, end: ask.end } : null })\n }}\n />\n ${i18next.t('figure.label.section-cavity')}\n ${w.cavity && !invalid\n ? html`<small result>\n ${i18next.t('figure.text.section-depth', {\n result: i18next.t(`figure.label.section-result-${cavityResultOf(shape.cavity!)}`),\n depth: String(cavityDepthOf(shape))\n })}\n </small>`\n : nothing}\n </label>\n ${w.cavity\n ? html`<figure-cavity-drawing\n .body=${{ id: this.body!.id, shape }}\n .perSide=${this.perSide}\n @command-live=${(ev: CustomEvent) => {\n ev.stopPropagation()\n const c = this.cavityOf(ev.detail.action)\n this.preview(c && this.valid({ ...this.working, cavity: c }) ? { ...this.working, cavity: c } : this.lastValid)\n }}\n @command=${(ev: CustomEvent) => {\n ev.stopPropagation()\n const c = this.cavityOf(ev.detail.action)\n if (c) this.change({ ...this.working, cavity: c })\n }}\n ></figure-cavity-drawing>\n <label toggle>\n <input type=\"checkbox\" .checked=${live(this.perSide)} @change=${(ev: Event) => (this.perSide = (ev.target as HTMLInputElement).checked)} />\n ${i18next.t('figure.label.section-wall-per-side')}\n </label>`\n : nothing}\n </div>`\n }\n\n /** The inside a drawing's set-cavity asks for, every wall written out; the drawing's commands stay in the editor. */\n private cavityOf(action: FigureAuthoringAction | null): SectionWorking['cavity'] | undefined {\n if (action?.kind !== 'set-cavity' || !action.cavity) return undefined\n const { wall, start, end } = action.cavity\n return { wall: typeof wall === 'number' ? Object.fromEntries(sidesOf(this.axis).map(side => [side, wall])) : ({ ...wall } as Record<string, number>), start, end }\n }\n\n private list(issues: ReturnType<typeof workingIssuesOf>['issues'], words: ReturnType<typeof workingIssuesOf>['words']) {\n const [h, v] = SCREEN[this.axis]\n const marked = markedBy(issues)\n const m = this.measures?.measures\n const linked = i18next.t('figure.text.section-editor-linked')\n return html`<div sizes>\n ${this.field(\n i18next.t(this.working.apex ? 'figure.label.section-editor-height' : 'figure.label.section-editor-length'),\n this.working.length,\n value => this.change({ ...this.working, length: value }),\n m?.[this.axis] !== 'editable',\n m?.[this.axis] === 'linked' ? linked : this.keptWords()\n )}\n ${this.kind === 'polygon' ? this.apexFields() : nothing}\n ${this.kind === 'polygon'\n ? nothing\n : this.measures?.round\n ? this.field(i18next.t('figure.label.section-editor-diameter'), this.working.across[h] ?? 0, value => this.change(this.across(h, value)), m?.[h] !== 'editable', m?.[h] === 'linked' ? linked : '')\n : ([h, v] as const).map(axis =>\n this.field(\n i18next.t('figure.label.section-editor-across', { axis: axis.toUpperCase() }),\n this.working.across[axis] ?? 0,\n value => this.change(this.across(axis, value)),\n m?.[axis] !== 'editable',\n m?.[axis] === 'linked' ? linked : ''\n )\n )}\n </div>\n ${this.kind === 'polygon'\n ? html`<ol points aria-label=${i18next.t('figure.label.section-editor-points')}>\n ${this.working.points.map(\n p => html`<li ?selected=${this.selected === p.id} ?marked=${marked.points.has(p.id)} @focusin=${() => (this.selected = p.id)}>\n <b>${pointLabel(p.id)}</b>\n ${([h, v] as const).map(\n axis => html`<input\n type=\"number\"\n step=\"any\"\n inputmode=\"decimal\"\n aria-label=${i18next.t('figure.label.section-editor-coordinate', { point: pointLabel(p.id), axis: axis.toUpperCase() })}\n .value=${live(String(p[axis] ?? ''))}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value)) {\n input.value = String(p[axis] ?? '')\n return\n }\n this.change({ ...this.working, points: movePoint(this.working.points, p.id, { [axis]: value }) })\n }}\n />`\n )}\n <button\n ?disabled=${this.working.points.length <= 3}\n title=${this.working.points.length <= 3 ? i18next.t('figure.text.section-issue-too-few') : ''}\n aria-label=${i18next.t('figure.button.section-editor-remove', { point: pointLabel(p.id) })}\n @click=${() => this.removePoint(p.id)}\n >\n ${i18next.t('figure.button.section-editor-remove', { point: pointLabel(p.id) })}\n </button>\n </li>`\n )}\n </ol>`\n : nothing}\n ${this.hollowable ? this.cavityBlock(words.length > 0) : nothing}\n ${this.note ? html`<small role=\"status\">${this.note}</small>` : nothing}\n ${words.length\n ? html`<ul issues role=\"alert\">\n ${words.map(w => html`<li>${i18next.t(w.key, w.params)}</li>`)}\n </ul>`\n : nothing}`\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FigureEvaluatedShape, FigureSection, FigureSectionIssue, FigureSectionPoint } from '@hatiolab/figure-model';
|
|
1
|
+
import type { FigureCavityRequest, FigureEvaluatedShape, FigureSection, FigureSectionIssue, FigureSectionPoint } from '@hatiolab/figure-model';
|
|
2
2
|
type Axis = 'x' | 'y' | 'z';
|
|
3
3
|
export type Points = readonly FigureSectionPoint[];
|
|
4
4
|
/** The number a point is shown by: its name's number. */
|
|
@@ -38,6 +38,12 @@ export interface SectionWorking {
|
|
|
38
38
|
length: number;
|
|
39
39
|
/** A drawn section's end drawn to one point (a pyramid), across the plane axes; null for a push. */
|
|
40
40
|
apex: Partial<Record<Axis, number>> | null;
|
|
41
|
+
/** A pushed rectangle's or ellipse's inside, every side's wall written out; null for none or a drawn section. */
|
|
42
|
+
cavity: {
|
|
43
|
+
wall: Record<string, number>;
|
|
44
|
+
start: FigureCavityRequest['start'];
|
|
45
|
+
end: FigureCavityRequest['end'];
|
|
46
|
+
} | null;
|
|
41
47
|
}
|
|
42
48
|
/** A pushed part's section, axis and ends -- or a pyramid's, whose end is its apex (figure-model `loft@1`). */
|
|
43
49
|
export declare function drawnOf(shape: FigureEvaluatedShape): {
|
|
@@ -51,6 +57,11 @@ export declare function drawnOf(shape: FigureEvaluatedShape): {
|
|
|
51
57
|
export declare function apexOver(points: Points, axis: Axis): Partial<Record<Axis, number>>;
|
|
52
58
|
/** The working state of a pushed part as it stands. */
|
|
53
59
|
export declare function workingOf(shape: FigureEvaluatedShape): SectionWorking;
|
|
60
|
+
/**
|
|
61
|
+
* The part as the working state would make it: its section, its length from the same start, its inside -- what the
|
|
62
|
+
* inside's drawing reads, so its walls are judged against the widths being typed and not the ones the editor opened with.
|
|
63
|
+
*/
|
|
64
|
+
export declare function workingShapeOf(shape: FigureEvaluatedShape, w: SectionWorking): FigureEvaluatedShape;
|
|
54
65
|
/** The section the working state makes, of the part's own kind: its corners kept, its points or widths the working ones. */
|
|
55
66
|
export declare function sectionOf(shape: FigureEvaluatedShape, w: SectionWorking): FigureSection;
|
|
56
67
|
/** What would be refused, as words, with the section's own issues for marking points and sides. By the kernel's checks. */
|
|
@@ -105,7 +105,27 @@ export function workingOf(shape) {
|
|
|
105
105
|
: s.kind === 'ellipse'
|
|
106
106
|
? { [u]: 2 * s.radius[u], [v]: 2 * s.radius[v] }
|
|
107
107
|
: {};
|
|
108
|
-
|
|
108
|
+
const c = shape.extrusion && shape.cavity;
|
|
109
|
+
return {
|
|
110
|
+
points: s.kind === 'polygon' ? s.points.map(p => ({ ...p })) : [],
|
|
111
|
+
across,
|
|
112
|
+
length: e.end - e.start,
|
|
113
|
+
apex: e.apex ? { ...e.apex } : null,
|
|
114
|
+
cavity: c ? { wall: { ...c.wall }, start: c.start, end: c.end } : null
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The part as the working state would make it: its section, its length from the same start, its inside -- what the
|
|
119
|
+
* inside's drawing reads, so its walls are judged against the widths being typed and not the ones the editor opened with.
|
|
120
|
+
*/
|
|
121
|
+
export function workingShapeOf(shape, w) {
|
|
122
|
+
const e = shape.extrusion;
|
|
123
|
+
const { cavity: _, ...rest } = shape;
|
|
124
|
+
return {
|
|
125
|
+
...rest,
|
|
126
|
+
extrusion: { ...e, section: sectionOf(shape, w), end: e.start + w.length },
|
|
127
|
+
...(w.cavity ? { cavity: { id: shape.cavity?.id ?? 'inside', wall: { ...w.cavity.wall }, start: w.cavity.start, end: w.cavity.end } } : {})
|
|
128
|
+
};
|
|
109
129
|
}
|
|
110
130
|
/** The section the working state makes, of the part's own kind: its corners kept, its points or widths the working ones. */
|
|
111
131
|
export function sectionOf(shape, w) {
|
|
@@ -128,8 +148,8 @@ export function workingIssuesOf(shape, w) {
|
|
|
128
148
|
words.push({ key: 'figure.text.section-issue-length', params: {} });
|
|
129
149
|
if (w.apex && !Object.values(w.apex).every(n => Number.isFinite(n)))
|
|
130
150
|
words.push({ key: 'figure.text.section-issue-number', params: {} });
|
|
131
|
-
if (!issues.length && words.length === 0 &&
|
|
132
|
-
const made = figureExtrusionFeaturesOf({ axis: e.axis, section, start: e.start, end: e.start + w.length }, [
|
|
151
|
+
if (!issues.length && words.length === 0 && w.cavity) {
|
|
152
|
+
const made = figureExtrusionFeaturesOf({ axis: e.axis, section, start: e.start, end: e.start + w.length }, [{ id: 'inside', ...w.cavity }]);
|
|
133
153
|
if ('refused' in made) {
|
|
134
154
|
const r = made.refused;
|
|
135
155
|
words.push({ key: r.code === 'CAVITY_NO_LENGTH' ? 'figure.text.section-issue-cavity-length' : 'figure.text.section-issue-cavity-walls', params: {} });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-drawing.js","sourceRoot":"","sources":["../../client/modeller/section-drawing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAa9J,yDAAyD;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAExE,kHAAkH;AAClH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;AAC3F,CAAC;AAED,0HAA0H;AAC1H,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY,EAAE,IAAU;IAClE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACzC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAA;IAC9C,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAE,EAClB,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAE,CAAA;IACtC,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAG,EAAE,EA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@hatiolab/figure-model'\nimport type { FigureEvaluatedShape, FigureSection, FigureSectionIssue, FigureSectionPoint } from '@hatiolab/figure-model'\n\n/*\n * What the section editor does to a drawn section's points, and how it says what is wrong with them (ADR-0100 §3.2).\n * The points are the kernel's own (`{ id, x, z }` for a push along Y), their validity is the kernel's own check, and a\n * point's number on screen is its own name's number (Q9): p3 is 「3」 before and after any edit, and deleting it leaves\n * 1, 2 and 4.\n */\n\ntype Axis = 'x' | 'y' | 'z'\nexport type Points = readonly FigureSectionPoint[]\n\n/** The number a point is shown by: its name's number. */\nexport const pointLabel = (id: string) => /^p(\\d+)$/.exec(id)?.[1] ?? id\n\n/** The next point's name: one past the highest number the loop has, so a new point never takes a gap's number. */\nexport function nextPointId(points: Points): string {\n return `p${Math.max(0, ...points.map(p => Number(/^p(\\d+)$/.exec(p.id)?.[1] ?? 0))) + 1}`\n}\n\n/** A point in the middle of the side from `from` to the point after it, whole millimetres; the new point's id with it. */\nexport function insertAfter(points: Points, from: string, axis: Axis): { points: FigureSectionPoint[]; id: string } {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const i = points.findIndex(p => p.id === from)\n const a = points[i]!,\n b = points[(i + 1) % points.length]!\n const id = nextPointId(points)\n const mid = { id, [u]: Math.round((a[u]! + b[u]!) / 2), [v]: Math.round((a[v]! + b[v]!) / 2) } as FigureSectionPoint\n return { points: [...points.slice(0, i + 1), mid, ...points.slice(i + 1)], id }\n}\n\n/** The points less one, or why not: a section is three points or more. */\nexport function removePoint(points: Points, id: string): FigureSectionPoint[] | { refused: 'too-few' } {\n if (points.length <= 3) return { refused: 'too-few' }\n return points.filter(p => p.id !== id)\n}\n\nexport function movePoint(points: Points, id: string, at: Partial<Record<Axis, number>>): FigureSectionPoint[] {\n return points.map(p => (p.id === id ? { ...p, ...at } : p))\n}\n\n/** What is wrong with the points, by the kernel's own check. */\nexport const issuesOf = (points: Points, axis: Axis) => checkFigureSection({ kind: 'polygon', points: [...points] }, axis)\n\n/** A side said in the loop's order, 3–4 not 4–3: its id is the pair in name order, which a person never sees. */\nfunction sideLabel(points: Points, axis: Axis, side: string): string {\n const s = figureSectionSidesOf({ kind: 'polygon', points: [...points] }, axis).find(x => x.id === side)\n const [a, b] = s?.from ? [s.from, s.to!] : side.split('~')\n return `${pointLabel(a!)}–${pointLabel(b!)}`\n}\n\n/** An issue as the words that say it: an i18n key and its values. */\nexport function issueWords(issue: FigureSectionIssue, points: Points, axis: Axis): { key: string; params: Record<string, string> } {\n const line = (s: string) => sideLabel(points, axis, s)\n switch (issue.code) {\n case 'SIDES_CROSS':\n return { key: 'figure.text.section-issue-cross', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'SIDES_TOUCH':\n return { key: 'figure.text.section-issue-touch', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'SIDES_FOLD':\n return { key: 'figure.text.section-issue-fold', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'ZERO_LENGTH_SIDE':\n return { key: 'figure.text.section-issue-zero-length', params: { a: line(issue.side) } }\n case 'ZERO_AREA':\n return { key: 'figure.text.section-issue-zero-area', params: {} }\n case 'TOO_FEW_POINTS':\n return { key: 'figure.text.section-issue-too-few', params: {} }\n case 'TOO_MANY_POINTS':\n return { key: 'figure.text.section-issue-too-many', params: { limit: String(issue.limit) } }\n case 'CORNER_TOO_LARGE':\n return { key: 'figure.text.section-issue-corner', params: { max: String(Math.round(issue.max * 1000) / 1000) } }\n default:\n return { key: 'figure.text.section-issue-number', params: {} }\n }\n}\n\n/** Every side and point an issue names, to mark on the drawing -- by more than colour: the list says them too. */\nexport function markedBy(issues: readonly FigureSectionIssue[]): { sides: Set<string>; points: Set<string> } {\n const sides = new Set<string>(),\n points = new Set<string>()\n for (const i of issues) {\n if ('sides' in i) for (const s of i.sides) sides.add(s)\n if ('side' in i) sides.add(i.side)\n if ('point' in i) points.add(i.point)\n if ('at' in i) points.add(String(i.at).split('.')[0]!)\n }\n for (const s of sides) for (const p of s.split('~')) points.add(p)\n return { sides, points }\n}\n\n/** How far the drawing reaches from the origin: the points' farthest coordinate with room around, in 50 mm steps. */\nexport function extentOf(points: Points, axis: Axis): number {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const far = Math.max(1, ...points.flatMap(p => [Math.abs(p[u] ?? 0), Math.abs(p[v] ?? 0)]))\n return Math.ceil((far * 1.4 + 40) / 50) * 50\n}\n\nexport const POINT_LIMIT = FIGURE_SECTION_POINT_LIMIT\n\n/** What the section editor holds while it is open: the points of a drawn section, the widths across, the length. */\nexport interface SectionWorking {\n points: FigureSectionPoint[]\n /** Along each plane axis: a rectangle's size, an ellipse's diameter. Empty for a drawn section. */\n across: Partial<Record<Axis, number>>\n length: number\n /** A drawn section's end drawn to one point (a pyramid), across the plane axes; null for a push. */\n apex: Partial<Record<Axis, number>> | null\n}\n\n/** A pushed part's section, axis and ends -- or a pyramid's, whose end is its apex (figure-model `loft@1`). */\nexport function drawnOf(shape: FigureEvaluatedShape):\n | { axis: Axis; section: FigureSection; start: number; end: number; apex: Partial<Record<Axis, number>> | null }\n | undefined {\n if (shape.extrusion) return { ...shape.extrusion, apex: null }\n if (shape.loft) return { ...shape.loft, apex: shape.loft.apex }\n return undefined\n}\n\n/** Where a new apex goes: over the middle of the points' span, whole millimetres. */\nexport function apexOver(points: Points, axis: Axis): Partial<Record<Axis, number>> {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const mid = (x: Axis) => Math.round((Math.min(...points.map(p => p[x]!)) + Math.max(...points.map(p => p[x]!))) / 2)\n return { [u]: mid(u), [v]: mid(v) }\n}\n\n/** The working state of a pushed part as it stands. */\nexport function workingOf(shape: FigureEvaluatedShape): SectionWorking {\n const e = drawnOf(shape)!\n const s = e.section\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n const across =\n s.kind === 'rectangle'\n ? { [u]: s.size[u]!, [v]: s.size[v]! }\n : s.kind === 'ellipse'\n ? { [u]: 2 * s.radius[u]!, [v]: 2 * s.radius[v]! }\n : {}\n return { points: s.kind === 'polygon' ? s.points.map(p => ({ ...p })) : [], across, length: e.end - e.start, apex: e.apex ? { ...e.apex } : null }\n}\n\n/** The section the working state makes, of the part's own kind: its corners kept, its points or widths the working ones. */\nexport function sectionOf(shape: FigureEvaluatedShape, w: SectionWorking): FigureSection {\n const e = drawnOf(shape)!\n const s = e.section\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n if (s.kind === 'polygon') return { kind: 'polygon', points: w.points }\n if (s.kind === 'ellipse') return { kind: 'ellipse', radius: { [u]: w.across[u]! / 2, [v]: w.across[v]! / 2 } }\n return { kind: 'rectangle', size: { [u]: w.across[u]!, [v]: w.across[v]! }, ...(s.corner ? { corner: s.corner } : {}) }\n}\n\n/** What would be refused, as words, with the section's own issues for marking points and sides. By the kernel's checks. */\nexport function workingIssuesOf(\n shape: FigureEvaluatedShape,\n w: SectionWorking\n): { issues: FigureSectionIssue[]; words: Array<{ key: string; params: Record<string, string> }> } {\n const e = drawnOf(shape)!\n const section = sectionOf(shape, w)\n const issues = checkFigureSection(section, e.axis)\n const words = issues.map(i => issueWords(i, w.points, e.axis))\n if (!(Number.isFinite(w.length) && w.length > 0)) words.push({ key: 'figure.text.section-issue-length', params: {} })\n if (w.apex && !Object.values(w.apex).every(n => Number.isFinite(n))) words.push({ key: 'figure.text.section-issue-number', params: {} })\n if (!issues.length && words.length === 0 && shape.cavity) {\n const made = figureExtrusionFeaturesOf({ axis: e.axis, section, start: e.start, end: e.start + w.length }, [shape.cavity])\n if ('refused' in made) {\n const r = made.refused\n words.push({ key: r.code === 'CAVITY_NO_LENGTH' ? 'figure.text.section-issue-cavity-length' : 'figure.text.section-issue-cavity-walls', params: {} })\n }\n }\n return { issues, words }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"section-drawing.js","sourceRoot":"","sources":["../../client/modeller/section-drawing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,yBAA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,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,yBAAyB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QAC3I,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAA;YACtB,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC,CAAC,wCAAwC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;QACvJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC","sourcesContent":["import { FIGURE_SECTION_PLANE, FIGURE_SECTION_POINT_LIMIT, checkFigureSection, figureExtrusionFeaturesOf, figureSectionSidesOf } from '@hatiolab/figure-model'\nimport type { FigureCavityRequest, FigureEvaluatedShape, FigureSection, FigureSectionIssue, FigureSectionPoint } from '@hatiolab/figure-model'\n\n/*\n * What the section editor does to a drawn section's points, and how it says what is wrong with them (ADR-0100 §3.2).\n * The points are the kernel's own (`{ id, x, z }` for a push along Y), their validity is the kernel's own check, and a\n * point's number on screen is its own name's number (Q9): p3 is 「3」 before and after any edit, and deleting it leaves\n * 1, 2 and 4.\n */\n\ntype Axis = 'x' | 'y' | 'z'\nexport type Points = readonly FigureSectionPoint[]\n\n/** The number a point is shown by: its name's number. */\nexport const pointLabel = (id: string) => /^p(\\d+)$/.exec(id)?.[1] ?? id\n\n/** The next point's name: one past the highest number the loop has, so a new point never takes a gap's number. */\nexport function nextPointId(points: Points): string {\n return `p${Math.max(0, ...points.map(p => Number(/^p(\\d+)$/.exec(p.id)?.[1] ?? 0))) + 1}`\n}\n\n/** A point in the middle of the side from `from` to the point after it, whole millimetres; the new point's id with it. */\nexport function insertAfter(points: Points, from: string, axis: Axis): { points: FigureSectionPoint[]; id: string } {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const i = points.findIndex(p => p.id === from)\n const a = points[i]!,\n b = points[(i + 1) % points.length]!\n const id = nextPointId(points)\n const mid = { id, [u]: Math.round((a[u]! + b[u]!) / 2), [v]: Math.round((a[v]! + b[v]!) / 2) } as FigureSectionPoint\n return { points: [...points.slice(0, i + 1), mid, ...points.slice(i + 1)], id }\n}\n\n/** The points less one, or why not: a section is three points or more. */\nexport function removePoint(points: Points, id: string): FigureSectionPoint[] | { refused: 'too-few' } {\n if (points.length <= 3) return { refused: 'too-few' }\n return points.filter(p => p.id !== id)\n}\n\nexport function movePoint(points: Points, id: string, at: Partial<Record<Axis, number>>): FigureSectionPoint[] {\n return points.map(p => (p.id === id ? { ...p, ...at } : p))\n}\n\n/** What is wrong with the points, by the kernel's own check. */\nexport const issuesOf = (points: Points, axis: Axis) => checkFigureSection({ kind: 'polygon', points: [...points] }, axis)\n\n/** A side said in the loop's order, 3–4 not 4–3: its id is the pair in name order, which a person never sees. */\nfunction sideLabel(points: Points, axis: Axis, side: string): string {\n const s = figureSectionSidesOf({ kind: 'polygon', points: [...points] }, axis).find(x => x.id === side)\n const [a, b] = s?.from ? [s.from, s.to!] : side.split('~')\n return `${pointLabel(a!)}–${pointLabel(b!)}`\n}\n\n/** An issue as the words that say it: an i18n key and its values. */\nexport function issueWords(issue: FigureSectionIssue, points: Points, axis: Axis): { key: string; params: Record<string, string> } {\n const line = (s: string) => sideLabel(points, axis, s)\n switch (issue.code) {\n case 'SIDES_CROSS':\n return { key: 'figure.text.section-issue-cross', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'SIDES_TOUCH':\n return { key: 'figure.text.section-issue-touch', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'SIDES_FOLD':\n return { key: 'figure.text.section-issue-fold', params: { a: line(issue.sides[0]), b: line(issue.sides[1]) } }\n case 'ZERO_LENGTH_SIDE':\n return { key: 'figure.text.section-issue-zero-length', params: { a: line(issue.side) } }\n case 'ZERO_AREA':\n return { key: 'figure.text.section-issue-zero-area', params: {} }\n case 'TOO_FEW_POINTS':\n return { key: 'figure.text.section-issue-too-few', params: {} }\n case 'TOO_MANY_POINTS':\n return { key: 'figure.text.section-issue-too-many', params: { limit: String(issue.limit) } }\n case 'CORNER_TOO_LARGE':\n return { key: 'figure.text.section-issue-corner', params: { max: String(Math.round(issue.max * 1000) / 1000) } }\n default:\n return { key: 'figure.text.section-issue-number', params: {} }\n }\n}\n\n/** Every side and point an issue names, to mark on the drawing -- by more than colour: the list says them too. */\nexport function markedBy(issues: readonly FigureSectionIssue[]): { sides: Set<string>; points: Set<string> } {\n const sides = new Set<string>(),\n points = new Set<string>()\n for (const i of issues) {\n if ('sides' in i) for (const s of i.sides) sides.add(s)\n if ('side' in i) sides.add(i.side)\n if ('point' in i) points.add(i.point)\n if ('at' in i) points.add(String(i.at).split('.')[0]!)\n }\n for (const s of sides) for (const p of s.split('~')) points.add(p)\n return { sides, points }\n}\n\n/** How far the drawing reaches from the origin: the points' farthest coordinate with room around, in 50 mm steps. */\nexport function extentOf(points: Points, axis: Axis): number {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const far = Math.max(1, ...points.flatMap(p => [Math.abs(p[u] ?? 0), Math.abs(p[v] ?? 0)]))\n return Math.ceil((far * 1.4 + 40) / 50) * 50\n}\n\nexport const POINT_LIMIT = FIGURE_SECTION_POINT_LIMIT\n\n/** What the section editor holds while it is open: the points of a drawn section, the widths across, the length. */\nexport interface SectionWorking {\n points: FigureSectionPoint[]\n /** Along each plane axis: a rectangle's size, an ellipse's diameter. Empty for a drawn section. */\n across: Partial<Record<Axis, number>>\n length: number\n /** A drawn section's end drawn to one point (a pyramid), across the plane axes; null for a push. */\n apex: Partial<Record<Axis, number>> | null\n /** A pushed rectangle's or ellipse's inside, every side's wall written out; null for none or a drawn section. */\n cavity: { wall: Record<string, number>; start: FigureCavityRequest['start']; end: FigureCavityRequest['end'] } | null\n}\n\n/** A pushed part's section, axis and ends -- or a pyramid's, whose end is its apex (figure-model `loft@1`). */\nexport function drawnOf(shape: FigureEvaluatedShape):\n | { axis: Axis; section: FigureSection; start: number; end: number; apex: Partial<Record<Axis, number>> | null }\n | undefined {\n if (shape.extrusion) return { ...shape.extrusion, apex: null }\n if (shape.loft) return { ...shape.loft, apex: shape.loft.apex }\n return undefined\n}\n\n/** Where a new apex goes: over the middle of the points' span, whole millimetres. */\nexport function apexOver(points: Points, axis: Axis): Partial<Record<Axis, number>> {\n const [u, v] = FIGURE_SECTION_PLANE[axis]\n const mid = (x: Axis) => Math.round((Math.min(...points.map(p => p[x]!)) + Math.max(...points.map(p => p[x]!))) / 2)\n return { [u]: mid(u), [v]: mid(v) }\n}\n\n/** The working state of a pushed part as it stands. */\nexport function workingOf(shape: FigureEvaluatedShape): SectionWorking {\n const e = drawnOf(shape)!\n const s = e.section\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n const across =\n s.kind === 'rectangle'\n ? { [u]: s.size[u]!, [v]: s.size[v]! }\n : s.kind === 'ellipse'\n ? { [u]: 2 * s.radius[u]!, [v]: 2 * s.radius[v]! }\n : {}\n const c = shape.extrusion && shape.cavity\n return {\n points: s.kind === 'polygon' ? s.points.map(p => ({ ...p })) : [],\n across,\n length: e.end - e.start,\n apex: e.apex ? { ...e.apex } : null,\n cavity: c ? { wall: { ...c.wall }, start: c.start, end: c.end } : null\n }\n}\n\n/**\n * The part as the working state would make it: its section, its length from the same start, its inside -- what the\n * inside's drawing reads, so its walls are judged against the widths being typed and not the ones the editor opened with.\n */\nexport function workingShapeOf(shape: FigureEvaluatedShape, w: SectionWorking): FigureEvaluatedShape {\n const e = shape.extrusion!\n const { cavity: _, ...rest } = shape\n return {\n ...rest,\n extrusion: { ...e, section: sectionOf(shape, w), end: e.start + w.length },\n ...(w.cavity ? { cavity: { id: shape.cavity?.id ?? 'inside', wall: { ...w.cavity.wall }, start: w.cavity.start, end: w.cavity.end } } : {})\n } as FigureEvaluatedShape\n}\n\n/** The section the working state makes, of the part's own kind: its corners kept, its points or widths the working ones. */\nexport function sectionOf(shape: FigureEvaluatedShape, w: SectionWorking): FigureSection {\n const e = drawnOf(shape)!\n const s = e.section\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n if (s.kind === 'polygon') return { kind: 'polygon', points: w.points }\n if (s.kind === 'ellipse') return { kind: 'ellipse', radius: { [u]: w.across[u]! / 2, [v]: w.across[v]! / 2 } }\n return { kind: 'rectangle', size: { [u]: w.across[u]!, [v]: w.across[v]! }, ...(s.corner ? { corner: s.corner } : {}) }\n}\n\n/** What would be refused, as words, with the section's own issues for marking points and sides. By the kernel's checks. */\nexport function workingIssuesOf(\n shape: FigureEvaluatedShape,\n w: SectionWorking\n): { issues: FigureSectionIssue[]; words: Array<{ key: string; params: Record<string, string> }> } {\n const e = drawnOf(shape)!\n const section = sectionOf(shape, w)\n const issues = checkFigureSection(section, e.axis)\n const words = issues.map(i => issueWords(i, w.points, e.axis))\n if (!(Number.isFinite(w.length) && w.length > 0)) words.push({ key: 'figure.text.section-issue-length', params: {} })\n if (w.apex && !Object.values(w.apex).every(n => Number.isFinite(n))) words.push({ key: 'figure.text.section-issue-number', params: {} })\n if (!issues.length && words.length === 0 && w.cavity) {\n const made = figureExtrusionFeaturesOf({ axis: e.axis, section, start: e.start, end: e.start + w.length }, [{ id: 'inside', ...w.cavity }])\n if ('refused' in made) {\n const r = made.refused\n words.push({ key: r.code === 'CAVITY_NO_LENGTH' ? 'figure.text.section-issue-cavity-length' : 'figure.text.section-issue-cavity-walls', params: {} })\n }\n }\n return { issues, words }\n}\n"]}
|