@things-factory/figure-ui 10.1.92 → 10.1.94
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/fasten-geometry.ts +152 -0
- package/client/modeller/figure-cavity-drawing.ts +259 -0
- package/client/modeller/figure-fasten-drawing.ts +412 -0
- package/client/modeller/figure-links.ts +71 -35
- package/client/modeller/figure-section-panel.ts +2 -0
- package/client/modeller/section-controls.ts +19 -0
- package/dist-client/modeller/fasten-geometry.d.ts +60 -0
- package/dist-client/modeller/fasten-geometry.js +138 -0
- package/dist-client/modeller/fasten-geometry.js.map +1 -0
- package/dist-client/modeller/figure-cavity-drawing.d.ts +48 -0
- package/dist-client/modeller/figure-cavity-drawing.js +253 -0
- package/dist-client/modeller/figure-cavity-drawing.js.map +1 -0
- package/dist-client/modeller/figure-fasten-drawing.d.ts +74 -0
- package/dist-client/modeller/figure-fasten-drawing.js +460 -0
- package/dist-client/modeller/figure-fasten-drawing.js.map +1 -0
- package/dist-client/modeller/figure-links.d.ts +7 -0
- package/dist-client/modeller/figure-links.js +70 -33
- package/dist-client/modeller/figure-links.js.map +1 -1
- package/dist-client/modeller/figure-section-panel.d.ts +1 -0
- package/dist-client/modeller/figure-section-panel.js +2 -0
- package/dist-client/modeller/figure-section-panel.js.map +1 -1
- package/dist-client/modeller/section-controls.d.ts +10 -0
- package/dist-client/modeller/section-controls.js +17 -0
- package/dist-client/modeller/section-controls.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/browser/acceptance-page.js +10 -0
- package/test/cavity-drawing.test.ts +69 -0
- package/test/fasten-drawing.test.ts +45 -0
- package/test/fasten-geometry.test.ts +79 -0
- package/test/links.test.ts +3 -1
- package/translations/en.json +11 -1
- package/translations/ja.json +11 -1
- package/translations/ko.json +11 -1
- package/translations/ms.json +11 -1
- package/translations/zh.json +11 -1
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing, svg } from 'lit';
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
+
import { i18next, localize } from '@operato/i18n';
|
|
5
|
+
import { alignmentAt, offsetOf, overhangOf, screenOf } from './fasten-geometry.js';
|
|
6
|
+
const SEEN = [
|
|
7
|
+
['top', 'M60 30 L100 10 L200 10 L160 30 Z'],
|
|
8
|
+
['front', 'M60 30 L160 30 L160 100 L60 100 Z'],
|
|
9
|
+
['right', 'M160 30 L200 10 L200 80 L160 100 Z']
|
|
10
|
+
];
|
|
11
|
+
/** The faces the drawing cannot show on the box, as tags beside it where they are. */
|
|
12
|
+
/* The box is drawn a little left of its picture's middle, and the viewBox shifts it back to the panel's centre. */
|
|
13
|
+
const HIDDEN = [
|
|
14
|
+
['bottom', 30, 114],
|
|
15
|
+
['left', 24, 62],
|
|
16
|
+
['back', 236, 14]
|
|
17
|
+
];
|
|
18
|
+
const PANEL_W = 300;
|
|
19
|
+
/**
|
|
20
|
+
* 붙이기 그림 (user 2026-10-01) — which face of what the part is fastened to, how, and where on it; each of them chosen
|
|
21
|
+
* by pressing or dragging the drawing, none by a list of faces.
|
|
22
|
+
*
|
|
23
|
+
* The target is drawn as a box whose faces are pressed (the three it hides as tags beside it), or as the one plane the
|
|
24
|
+
* figure stands by. How is three small side views -- set on it, flush with it, its centre on it (only for a part that
|
|
25
|
+
* turns about a joint) -- and the chosen one's gap is dragged. Where is the face seen from above with the part's
|
|
26
|
+
* footprint on it: dragged, caught at the centre and at the edges from inside and outside, a guide drawn where it is
|
|
27
|
+
* caught and a dimension where it is not, which is pressed to type the number. It may go past the edges: the part that
|
|
28
|
+
* does is shaded, and a part off the face altogether is said so. Nothing is decided here: every change goes to the form
|
|
29
|
+
* (`fasten-change`), and a press or a drag let go says so (`fasten-release`), for the form to apply a fastening it holds.
|
|
30
|
+
*/
|
|
31
|
+
let FigureFastenDrawing = class FigureFastenDrawing extends localize(i18next)(LitElement) {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/** The target's name, or empty for the plane the figure stands by. */
|
|
35
|
+
this.target = '';
|
|
36
|
+
/** The plane's name by the figure's placement: 바닥 · 천장 · 벽 · 중심. */
|
|
37
|
+
this.planeWord = '';
|
|
38
|
+
this.faces = [];
|
|
39
|
+
this.face = '';
|
|
40
|
+
this.modes = ['meet', 'flush'];
|
|
41
|
+
this.mode = 'meet';
|
|
42
|
+
this.align = {};
|
|
43
|
+
this.alignMm = {};
|
|
44
|
+
this.gap = 0;
|
|
45
|
+
/** The part being fastened (not `part`: that is every element's own). */
|
|
46
|
+
this.partName = '';
|
|
47
|
+
this.locked = false;
|
|
48
|
+
/** The form already says how the fastening it has lies on the face: the drawing says it only while dragging. */
|
|
49
|
+
this.said = false;
|
|
50
|
+
this.scale = 1;
|
|
51
|
+
}
|
|
52
|
+
static { this.styles = css `
|
|
53
|
+
:host {
|
|
54
|
+
display: grid;
|
|
55
|
+
gap: 8px;
|
|
56
|
+
outline: none;
|
|
57
|
+
}
|
|
58
|
+
svg {
|
|
59
|
+
width: 100%;
|
|
60
|
+
display: block;
|
|
61
|
+
touch-action: none;
|
|
62
|
+
user-select: none;
|
|
63
|
+
}
|
|
64
|
+
svg text {
|
|
65
|
+
font: inherit;
|
|
66
|
+
}
|
|
67
|
+
div[modes] {
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
|
|
70
|
+
gap: 6px;
|
|
71
|
+
}
|
|
72
|
+
div[modes] svg {
|
|
73
|
+
width: 64px;
|
|
74
|
+
height: 44px;
|
|
75
|
+
}
|
|
76
|
+
div[modes] button {
|
|
77
|
+
display: grid;
|
|
78
|
+
justify-items: center;
|
|
79
|
+
align-content: center;
|
|
80
|
+
gap: 2px;
|
|
81
|
+
padding: 2px 4px 4px;
|
|
82
|
+
font: inherit;
|
|
83
|
+
font-size: 0.72rem;
|
|
84
|
+
color: var(--md-sys-color-on-surface);
|
|
85
|
+
background: none;
|
|
86
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
div[modes] button[on] {
|
|
91
|
+
border: 1.5px solid var(--md-sys-color-primary);
|
|
92
|
+
background: var(--md-sys-color-primary-container);
|
|
93
|
+
color: var(--md-sys-color-on-primary-container);
|
|
94
|
+
}
|
|
95
|
+
div[where] {
|
|
96
|
+
position: relative;
|
|
97
|
+
}
|
|
98
|
+
div[where] input {
|
|
99
|
+
position: absolute;
|
|
100
|
+
width: 72px;
|
|
101
|
+
font: inherit;
|
|
102
|
+
font-size: 0.75rem;
|
|
103
|
+
}
|
|
104
|
+
small[warn] {
|
|
105
|
+
color: var(--md-sys-color-tertiary);
|
|
106
|
+
}
|
|
107
|
+
small[off] {
|
|
108
|
+
color: var(--md-sys-color-error);
|
|
109
|
+
}
|
|
110
|
+
`; }
|
|
111
|
+
change(detail) {
|
|
112
|
+
this.dispatchEvent(new CustomEvent('fasten-change', { detail, bubbles: true, composed: true }));
|
|
113
|
+
}
|
|
114
|
+
released() {
|
|
115
|
+
this.dispatchEvent(new CustomEvent('fasten-release', { bubbles: true, composed: true }));
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
return html `${this.renderTarget()}${this.renderModes()}${this.renderWhere()}`;
|
|
119
|
+
}
|
|
120
|
+
/** The target box, its faces pressed; or the plane. */
|
|
121
|
+
renderTarget() {
|
|
122
|
+
/* The plane is one face, named in the list and on the face drawn below: nothing to pick, so no picture of it. */
|
|
123
|
+
if (!this.target)
|
|
124
|
+
return nothing;
|
|
125
|
+
const has = (f) => this.faces.includes(f);
|
|
126
|
+
/* A press is a whole change, as a drag let go is: the form applies a fastening the part already has. */
|
|
127
|
+
const pick = (f) => () => {
|
|
128
|
+
if (this.locked || !has(f) || f === this.face)
|
|
129
|
+
return;
|
|
130
|
+
this.change({ targetFace: f });
|
|
131
|
+
this.released();
|
|
132
|
+
};
|
|
133
|
+
const seen = SEEN.map(([f, d]) => {
|
|
134
|
+
const on = this.face === f;
|
|
135
|
+
return svg `<path face=${f} d=${d} @click=${pick(f)}
|
|
136
|
+
style=${`cursor:${has(f) ? 'pointer' : 'default'};fill:${on ? 'var(--md-sys-color-primary-container)' : 'var(--md-sys-color-surface-container)'};fill-opacity:${has(f) ? 1 : 0.4};stroke:${on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-outline)'};stroke-width:${on ? 2 : 1}`}>
|
|
137
|
+
<title>${i18next.t('figure.label.face-' + f)}</title></path>`;
|
|
138
|
+
});
|
|
139
|
+
const hidden = HIDDEN.map(([f, x, y]) => {
|
|
140
|
+
const on = this.face === f;
|
|
141
|
+
return svg `<g face=${f} @click=${pick(f)} style=${`cursor:${has(f) ? 'pointer' : 'default'};opacity:${has(f) ? 1 : 0.35}`}>
|
|
142
|
+
<rect x=${x - 26} y=${y - 10} width="52" height="20" rx="10"
|
|
143
|
+
style=${`fill:${on ? 'var(--md-sys-color-primary-container)' : 'transparent'};stroke:${on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-outline)'};stroke-dasharray:${on ? '' : '3 2'}`} />
|
|
144
|
+
<text x=${x} y=${y + 4} text-anchor="middle" font-size="11" style=${`fill:${on ? 'var(--md-sys-color-on-primary-container)' : 'var(--md-sys-color-on-surface-variant)'}`}>${i18next.t('figure.label.face-' + f)}</text>
|
|
145
|
+
</g>`;
|
|
146
|
+
});
|
|
147
|
+
/* A shape's faces beyond its six outer ones -- a door frame's opening -- are tags of their own under the box. */
|
|
148
|
+
const others = this.faces.filter(f => !SEEN.some(([s]) => s === f) && !HIDDEN.some(([h]) => h === f));
|
|
149
|
+
return html `${svg `<svg viewBox="-20 0 ${PANEL_W} 126" role="img" aria-label=${this.target}>
|
|
150
|
+
${seen}
|
|
151
|
+
<text x="110" y="70" text-anchor="middle" font-size="12" pointer-events="none" style="fill:var(--md-sys-color-on-surface)">${this.target}</text>
|
|
152
|
+
${hidden}
|
|
153
|
+
</svg>`}
|
|
154
|
+
${others.length
|
|
155
|
+
? html `<div modes>
|
|
156
|
+
${others.map(f => html `<button ?on=${f === this.face} ?disabled=${this.locked} @click=${pick(f)}>${i18next.t('figure.label.face-' + f, { defaultValue: f })}</button>`)}
|
|
157
|
+
</div>`
|
|
158
|
+
: nothing}`;
|
|
159
|
+
}
|
|
160
|
+
/** How: three side views; the chosen one's gap is dragged. */
|
|
161
|
+
renderModes() {
|
|
162
|
+
/* One way only (the plane is set on): the sentence says it; a single choice is not offered as a button. */
|
|
163
|
+
if (this.modes.length < 2)
|
|
164
|
+
return nothing;
|
|
165
|
+
const icon = (m, on) => {
|
|
166
|
+
const g = on && m !== 'centre' ? Math.min(this.gap / 4, 10) : 0;
|
|
167
|
+
const base = svg `<rect x="6" y="30" width="52" height="14" style="fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary)" />`;
|
|
168
|
+
const gapDrag = on && !this.locked ? 'ns-resize' : 'pointer';
|
|
169
|
+
if (m === 'meet')
|
|
170
|
+
return svg `<svg viewBox="0 0 64 48">${base}<rect gap x="22" y=${18 - g} width="20" height="12" style=${`fill:var(--md-sys-color-surface);stroke:currentColor;cursor:${gapDrag}`} />
|
|
171
|
+
${g ? svg `<text x="46" y=${26 - g / 2} font-size="10" style="fill:currentColor">${this.gap}</text>` : nothing}</svg>`;
|
|
172
|
+
if (m === 'flush')
|
|
173
|
+
return svg `<svg viewBox="0 0 64 48">${base}<rect gap x="22" y=${30 - g} width="20" height="10" style=${`fill:var(--md-sys-color-surface);stroke:currentColor;cursor:${gapDrag}`} />
|
|
174
|
+
<line x1="4" y1="30" x2="60" y2="30" style="stroke:currentColor;stroke-dasharray:2 2" /></svg>`;
|
|
175
|
+
return svg `<svg viewBox="0 0 64 48">${base}<circle cx="32" cy="30" r="11" style="fill:var(--md-sys-color-surface);fill-opacity:.85;stroke:currentColor" /><circle cx="32" cy="30" r="2" style="fill:currentColor" /></svg>`;
|
|
176
|
+
};
|
|
177
|
+
return html `<div modes>
|
|
178
|
+
${this.modes.map(m => {
|
|
179
|
+
const on = m === this.mode;
|
|
180
|
+
return html `<button mode=${m} ?on=${on} ?disabled=${this.locked}
|
|
181
|
+
@click=${() => {
|
|
182
|
+
if (on)
|
|
183
|
+
return;
|
|
184
|
+
this.change({ mode: m });
|
|
185
|
+
this.released();
|
|
186
|
+
}}
|
|
187
|
+
@pointerdown=${(ev) => {
|
|
188
|
+
if (!on || this.locked || !ev.target.hasAttribute?.('gap'))
|
|
189
|
+
return;
|
|
190
|
+
ev.preventDefault();
|
|
191
|
+
ev.currentTarget.setPointerCapture(ev.pointerId);
|
|
192
|
+
this.gapFrom = { y: ev.clientY, gap: this.gap };
|
|
193
|
+
}}
|
|
194
|
+
@pointermove=${(ev) => {
|
|
195
|
+
if (!this.gapFrom)
|
|
196
|
+
return;
|
|
197
|
+
this.change({ gap: Math.max(0, Math.round(this.gapFrom.gap + (this.gapFrom.y - ev.clientY) * 2)) });
|
|
198
|
+
}}
|
|
199
|
+
@pointerup=${() => {
|
|
200
|
+
if (!this.gapFrom)
|
|
201
|
+
return;
|
|
202
|
+
this.gapFrom = undefined;
|
|
203
|
+
this.released();
|
|
204
|
+
}}>
|
|
205
|
+
${icon(m, on)}<span>${i18next.t('figure.label.fasten-mode-' + m)}</span>
|
|
206
|
+
</button>`;
|
|
207
|
+
})}
|
|
208
|
+
</div>`;
|
|
209
|
+
}
|
|
210
|
+
/** Where the part's centre is on each axis now: the drag's, or the form's. */
|
|
211
|
+
centreOf(view) {
|
|
212
|
+
if (this.dragged)
|
|
213
|
+
return this.dragged.at;
|
|
214
|
+
const at = { x: 0, y: 0, z: 0 };
|
|
215
|
+
for (const a of view.axes)
|
|
216
|
+
at[a] = offsetOf(this.align[a], this.alignMm[a], view.face[a], view.part[a]);
|
|
217
|
+
return at;
|
|
218
|
+
}
|
|
219
|
+
/** What each axis is caught by now: at the centre, level with an edge, touching one from outside, or nothing. */
|
|
220
|
+
caughtOf(view, at) {
|
|
221
|
+
if (this.dragged)
|
|
222
|
+
return this.dragged.caught;
|
|
223
|
+
const out = {};
|
|
224
|
+
for (const a of view.axes) {
|
|
225
|
+
const how = this.align[a] ?? 'centre';
|
|
226
|
+
if (how === 'centre')
|
|
227
|
+
out[a] = 'centre';
|
|
228
|
+
else if (how === 'min' || how === 'max')
|
|
229
|
+
out[a] = 'inside';
|
|
230
|
+
else if (view.face[a] !== undefined && Math.abs(Math.abs(at[a]) - (view.face[a] + view.part[a]) / 2) < 0.5)
|
|
231
|
+
out[a] = 'outside';
|
|
232
|
+
}
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
renderWhere() {
|
|
236
|
+
const view = this.view;
|
|
237
|
+
if (!view)
|
|
238
|
+
return nothing;
|
|
239
|
+
const { h, v, sign } = screenOf(view.axes);
|
|
240
|
+
const W = PANEL_W, H = 180;
|
|
241
|
+
/* Room around the face for the part to go past its edges by about half itself; a plane with no size, three parts wide. */
|
|
242
|
+
const span = (a) => (view.face[a] !== undefined ? view.face[a] + view.part[a] : view.part[a] * 3);
|
|
243
|
+
const k = Math.min((W - 40) / span(h), (H - 40) / span(v));
|
|
244
|
+
this.scale = k;
|
|
245
|
+
const cx = W / 2, cy = H / 2;
|
|
246
|
+
const at = this.centreOf(view);
|
|
247
|
+
const caught = this.caughtOf(view, at);
|
|
248
|
+
const fw = (view.face[h] ?? 0) * k, fh = (view.face[v] ?? 0) * k;
|
|
249
|
+
const pw = view.part[h] * k, ph = view.part[v] * k;
|
|
250
|
+
const px = cx + sign[h] * at[h] * k - pw / 2, py = cy + sign[v] * at[v] * k - ph / 2;
|
|
251
|
+
const faceSized = view.face[h] !== undefined && view.face[v] !== undefined;
|
|
252
|
+
const fx = cx - fw / 2, fy = cy - fh / 2;
|
|
253
|
+
const ix = Math.max(fx, px), iy = Math.max(fy, py);
|
|
254
|
+
const iw = Math.min(fx + fw, px + pw) - ix, ih = Math.min(fy + fh, py + ph) - iy;
|
|
255
|
+
const { touching, sides } = faceSized ? overhangOf(view, at) : { touching: true, sides: [] };
|
|
256
|
+
const round = this.mode === 'centre';
|
|
257
|
+
const guide = (a) => {
|
|
258
|
+
const c = caught[a];
|
|
259
|
+
if (!c)
|
|
260
|
+
return nothing;
|
|
261
|
+
const along = a === h;
|
|
262
|
+
const edge = c === 'centre' ? 0 : Math.sign(at[a]) * (view.face[a] ?? 0) / 2;
|
|
263
|
+
const pos = (along ? cx : cy) + sign[a] * edge * k;
|
|
264
|
+
const style = `stroke:var(--md-sys-color-primary);stroke-width:${c === 'centre' ? 1 : 2.5};stroke-dasharray:${c === 'centre' ? '4 3' : ''}`;
|
|
265
|
+
return along ? svg `<line x1=${pos} y1="4" x2=${pos} y2=${H - 4} style=${style} />` : svg `<line x1="4" y1=${pos} x2=${W - 4} y2=${pos} style=${style} />`;
|
|
266
|
+
};
|
|
267
|
+
const dim = (a) => {
|
|
268
|
+
/* Caught by the centre or an edge, the guide says where it is; a number only where nothing caught it. */
|
|
269
|
+
if (caught[a])
|
|
270
|
+
return nothing;
|
|
271
|
+
const along = a === h;
|
|
272
|
+
const mm = Math.round(at[a]);
|
|
273
|
+
const label = `${mm > 0 ? '+' : ''}${mm} mm`;
|
|
274
|
+
const to = sign[a] * at[a] * k;
|
|
275
|
+
const tx = along ? cx + to / 2 : 8, ty = along ? H - 6 : cy + to / 2 + 4;
|
|
276
|
+
return svg `${along
|
|
277
|
+
? svg `<line x1=${cx} y1=${H - 16} x2=${cx + to} y2=${H - 16} style="stroke:var(--md-sys-color-on-surface)" />`
|
|
278
|
+
: svg `<line x1="20" y1=${cy} x2="20" y2=${cy + to} style="stroke:var(--md-sys-color-on-surface)" />`}
|
|
279
|
+
<text dim=${a} x=${tx} y=${ty} font-size="11" text-anchor=${along ? 'middle' : 'start'}
|
|
280
|
+
style="fill:var(--md-sys-color-primary);cursor:text;text-decoration:underline dotted" @click=${() => !this.locked && (this.typing = a)}>${label}</text>`;
|
|
281
|
+
};
|
|
282
|
+
const faceName = this.target ? `${this.target} ${i18next.t('figure.label.face-' + this.face)}` : this.planeWord;
|
|
283
|
+
const sizeWords = faceSized ? ` ${Math.round(view.face[h])} × ${Math.round(view.face[v])}` : '';
|
|
284
|
+
return html `<div where tabindex="0" @keydown=${(ev) => this.keys(ev, view)}>
|
|
285
|
+
${svg `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label=${faceName}
|
|
286
|
+
@pointermove=${(ev) => this.drag(ev, view, cx, cy)}
|
|
287
|
+
@pointerup=${() => this.drop()} @pointercancel=${() => this.drop()}>
|
|
288
|
+
${faceSized
|
|
289
|
+
? svg `<rect x=${fx} y=${fy} width=${fw} height=${fh} rx="4" style="fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary);stroke-width:2" />`
|
|
290
|
+
: svg `<rect x="1" y="1" width=${W - 2} height=${H - 2} rx="8" style="fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary);stroke-width:2" />`}
|
|
291
|
+
<text x=${faceSized ? fx + 4 : 10} y=${faceSized ? fy + fh - 6 : 18} font-size="11" pointer-events="none" style="fill:var(--md-sys-color-primary)">${faceName}${sizeWords}</text>
|
|
292
|
+
${guide(h)}${guide(v)}
|
|
293
|
+
<g footprint style=${`cursor:${this.locked ? 'default' : 'grab'}`} @pointerdown=${(ev) => this.grab(ev, at, caught)}>
|
|
294
|
+
<rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2} style="fill:var(--md-sys-color-tertiary-container)" />
|
|
295
|
+
${faceSized && iw > 0 && ih > 0
|
|
296
|
+
? svg `<rect x=${ix} y=${iy} width=${iw} height=${ih} rx=${round ? Math.min(iw, ih) / 2 : 2} style="fill:var(--md-sys-color-surface)" />`
|
|
297
|
+
: !faceSized
|
|
298
|
+
? svg `<rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2} style="fill:var(--md-sys-color-surface)" />`
|
|
299
|
+
: nothing}
|
|
300
|
+
<rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2}
|
|
301
|
+
style=${`fill:none;stroke:var(--md-sys-color-on-surface);stroke-width:1.5;stroke-dasharray:${touching ? '' : '4 3'}`} />
|
|
302
|
+
<text x=${px + pw / 2} y=${py + ph / 2 + 4} text-anchor="middle" font-size="12" pointer-events="none" style="fill:var(--md-sys-color-on-surface)">${this.partName}</text>
|
|
303
|
+
</g>
|
|
304
|
+
${dim(h)}${dim(v)}
|
|
305
|
+
</svg>`}
|
|
306
|
+
${this.typing ? this.renderTyping(view, this.typing, at) : nothing}
|
|
307
|
+
</div>
|
|
308
|
+
${this.said && !this.dragged
|
|
309
|
+
? nothing
|
|
310
|
+
: !touching
|
|
311
|
+
? html `<small off role="status">${i18next.t('figure.text.fasten-off-face', { face: faceName })}</small>`
|
|
312
|
+
: sides.length
|
|
313
|
+
? html `<small warn role="status">${i18next.t('figure.text.fasten-past-edges', {
|
|
314
|
+
sides: sides.map(s => i18next.t(`figure.text.overhang-side-${s.side}`, { axis: s.axis.toUpperCase(), mm: String(s.mm) })).join(' · ')
|
|
315
|
+
})}</small>`
|
|
316
|
+
: nothing}`;
|
|
317
|
+
}
|
|
318
|
+
renderTyping(view, a, at) {
|
|
319
|
+
const along = a === screenOf(view.axes).h;
|
|
320
|
+
return html `<input type="number" step="1" aria-label=${`${a.toUpperCase()} mm`} .value=${String(Math.round(at[a]))}
|
|
321
|
+
style=${along ? 'left: calc(50% - 36px); bottom: 0' : 'left: 4px; top: calc(50% - 12px)'}
|
|
322
|
+
@keydown=${(ev) => {
|
|
323
|
+
ev.stopPropagation();
|
|
324
|
+
if (ev.key === 'Escape')
|
|
325
|
+
this.typing = undefined;
|
|
326
|
+
if (ev.key !== 'Enter')
|
|
327
|
+
return;
|
|
328
|
+
const value = Number(ev.target.value);
|
|
329
|
+
this.typing = undefined;
|
|
330
|
+
if (!Number.isFinite(value))
|
|
331
|
+
return;
|
|
332
|
+
this.change({ axis: a, how: 'mm', mm: Math.round(value) });
|
|
333
|
+
this.released();
|
|
334
|
+
}}
|
|
335
|
+
@blur=${() => (this.typing = undefined)} />`;
|
|
336
|
+
}
|
|
337
|
+
grab(ev, at, caught) {
|
|
338
|
+
if (this.locked)
|
|
339
|
+
return;
|
|
340
|
+
ev.currentTarget.closest('svg').setPointerCapture(ev.pointerId);
|
|
341
|
+
this.dragged = { at: { ...at }, caught: { ...caught } };
|
|
342
|
+
}
|
|
343
|
+
/** The footprint follows the pointer, caught at the centre and edges within a few pixels. */
|
|
344
|
+
drag(ev, view, cx, cy) {
|
|
345
|
+
if (!this.dragged)
|
|
346
|
+
return;
|
|
347
|
+
const svgEl = ev.currentTarget;
|
|
348
|
+
const pt = svgEl.createSVGPoint();
|
|
349
|
+
pt.x = ev.clientX;
|
|
350
|
+
pt.y = ev.clientY;
|
|
351
|
+
const p = pt.matrixTransform(svgEl.getScreenCTM().inverse());
|
|
352
|
+
const { h, v, sign } = screenOf(view.axes);
|
|
353
|
+
const at = { ...this.dragged.at }, caught = {};
|
|
354
|
+
for (const [a, d] of [
|
|
355
|
+
[h, (sign[h] * (p.x - cx)) / this.scale],
|
|
356
|
+
[v, (sign[v] * (p.y - cy)) / this.scale]
|
|
357
|
+
]) {
|
|
358
|
+
const got = alignmentAt(d, view.face[a], view.part[a], view.edges[a], 8 / this.scale);
|
|
359
|
+
at[a] = offsetOf(got.how, got.mm, view.face[a], view.part[a]);
|
|
360
|
+
if (got.caught)
|
|
361
|
+
caught[a] = got.caught;
|
|
362
|
+
}
|
|
363
|
+
this.dragged = { at, caught };
|
|
364
|
+
}
|
|
365
|
+
drop() {
|
|
366
|
+
const d = this.dragged;
|
|
367
|
+
if (!d || !this.view)
|
|
368
|
+
return;
|
|
369
|
+
this.dragged = undefined;
|
|
370
|
+
for (const a of this.view.axes) {
|
|
371
|
+
const got = alignmentAt(d.at[a], this.view.face[a], this.view.part[a], this.view.edges[a], 0.5);
|
|
372
|
+
this.change({ axis: a, how: got.how, ...(got.how === 'mm' ? { mm: got.mm } : {}) });
|
|
373
|
+
}
|
|
374
|
+
this.released();
|
|
375
|
+
}
|
|
376
|
+
/** Arrows move the part a millimetre, ten with Shift; the centre and edges still catch it. */
|
|
377
|
+
keys(ev, view) {
|
|
378
|
+
const step = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[ev.key];
|
|
379
|
+
if (!step || this.locked || this.typing)
|
|
380
|
+
return;
|
|
381
|
+
ev.preventDefault();
|
|
382
|
+
ev.stopPropagation();
|
|
383
|
+
const by = ev.shiftKey ? 10 : 1;
|
|
384
|
+
const at = this.centreOf(view);
|
|
385
|
+
const { h, v, sign } = screenOf(view.axes);
|
|
386
|
+
[h, v].forEach((a, i) => {
|
|
387
|
+
if (!step[i])
|
|
388
|
+
return;
|
|
389
|
+
/* Up the screen is up the face: a Y that rises goes up with the arrow. */
|
|
390
|
+
const got = alignmentAt(at[a] + sign[a] * step[i] * by, view.face[a], view.part[a], view.edges[a], by / 2);
|
|
391
|
+
this.change({ axis: a, how: got.how, ...(got.how === 'mm' ? { mm: got.mm } : {}) });
|
|
392
|
+
});
|
|
393
|
+
this.released();
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
__decorate([
|
|
397
|
+
property(),
|
|
398
|
+
__metadata("design:type", Object)
|
|
399
|
+
], FigureFastenDrawing.prototype, "target", void 0);
|
|
400
|
+
__decorate([
|
|
401
|
+
property(),
|
|
402
|
+
__metadata("design:type", Object)
|
|
403
|
+
], FigureFastenDrawing.prototype, "planeWord", void 0);
|
|
404
|
+
__decorate([
|
|
405
|
+
property({ attribute: false }),
|
|
406
|
+
__metadata("design:type", Array)
|
|
407
|
+
], FigureFastenDrawing.prototype, "faces", void 0);
|
|
408
|
+
__decorate([
|
|
409
|
+
property(),
|
|
410
|
+
__metadata("design:type", Object)
|
|
411
|
+
], FigureFastenDrawing.prototype, "face", void 0);
|
|
412
|
+
__decorate([
|
|
413
|
+
property({ attribute: false }),
|
|
414
|
+
__metadata("design:type", Array)
|
|
415
|
+
], FigureFastenDrawing.prototype, "modes", void 0);
|
|
416
|
+
__decorate([
|
|
417
|
+
property(),
|
|
418
|
+
__metadata("design:type", String)
|
|
419
|
+
], FigureFastenDrawing.prototype, "mode", void 0);
|
|
420
|
+
__decorate([
|
|
421
|
+
property({ attribute: false }),
|
|
422
|
+
__metadata("design:type", Object)
|
|
423
|
+
], FigureFastenDrawing.prototype, "view", void 0);
|
|
424
|
+
__decorate([
|
|
425
|
+
property({ attribute: false }),
|
|
426
|
+
__metadata("design:type", Object)
|
|
427
|
+
], FigureFastenDrawing.prototype, "align", void 0);
|
|
428
|
+
__decorate([
|
|
429
|
+
property({ attribute: false }),
|
|
430
|
+
__metadata("design:type", Object)
|
|
431
|
+
], FigureFastenDrawing.prototype, "alignMm", void 0);
|
|
432
|
+
__decorate([
|
|
433
|
+
property({ type: Number }),
|
|
434
|
+
__metadata("design:type", Object)
|
|
435
|
+
], FigureFastenDrawing.prototype, "gap", void 0);
|
|
436
|
+
__decorate([
|
|
437
|
+
property(),
|
|
438
|
+
__metadata("design:type", Object)
|
|
439
|
+
], FigureFastenDrawing.prototype, "partName", void 0);
|
|
440
|
+
__decorate([
|
|
441
|
+
property({ type: Boolean }),
|
|
442
|
+
__metadata("design:type", Object)
|
|
443
|
+
], FigureFastenDrawing.prototype, "locked", void 0);
|
|
444
|
+
__decorate([
|
|
445
|
+
property({ type: Boolean }),
|
|
446
|
+
__metadata("design:type", Object)
|
|
447
|
+
], FigureFastenDrawing.prototype, "said", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
state(),
|
|
450
|
+
__metadata("design:type", Object)
|
|
451
|
+
], FigureFastenDrawing.prototype, "dragged", void 0);
|
|
452
|
+
__decorate([
|
|
453
|
+
state(),
|
|
454
|
+
__metadata("design:type", String)
|
|
455
|
+
], FigureFastenDrawing.prototype, "typing", void 0);
|
|
456
|
+
FigureFastenDrawing = __decorate([
|
|
457
|
+
customElement('figure-fasten-drawing')
|
|
458
|
+
], FigureFastenDrawing);
|
|
459
|
+
export { FigureFastenDrawing };
|
|
460
|
+
//# sourceMappingURL=figure-fasten-drawing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure-fasten-drawing.js","sourceRoot":"","sources":["../../client/modeller/figure-fasten-drawing.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAkC,MAAM,sBAAsB,CAAA;AAYlH,MAAM,IAAI,GAAgC;IACxC,CAAC,KAAK,EAAE,kCAAkC,CAAC;IAC3C,CAAC,OAAO,EAAE,mCAAmC,CAAC;IAC9C,CAAC,OAAO,EAAE,oCAAoC,CAAC;CAChD,CAAA;AACD,sFAAsF;AACtF,mHAAmH;AACnH,MAAM,MAAM,GAAwC;IAClD,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC;IACnB,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;IAChB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;CAClB,CAAA;AACD,MAAM,OAAO,GAAG,GAAG,CAAA;AAGnB;;;;;;;;;;;GAWG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA/D;;QA6DL,sEAAsE;QAC1D,WAAM,GAAG,EAAE,CAAA;QACvB,oEAAoE;QACxD,cAAS,GAAG,EAAE,CAAA;QACM,UAAK,GAAa,EAAE,CAAA;QACxC,SAAI,GAAG,EAAE,CAA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AQ,EAAE,CAAA;IACjB,CAAC;;AA9SW;IAAX,QAAQ,EAAE;;mDAAY;AAEX;IAAX,QAAQ,EAAE;;sDAAe;AACM;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAAqB;AACxC;IAAX,QAAQ,EAAE;;iDAAU;AACW;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAAwC;AAC3D;IAAX,QAAQ,EAAE;;iDAA0B;AACL;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;iDAAgB;AACf;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAA6C;AAC5C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;oDAA4C;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAQ;AAEvB;IAAX,QAAQ,EAAE;;qDAAc;AACI;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mDAAe;AAEd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;iDAAa;AAGxB;IAAhB,KAAK,EAAE;;oDAAsF;AAC7E;IAAhB,KAAK,EAAE;;mDAAsB;AAjFnB,mBAAmB;IAD/B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,mBAAmB,CA6W/B","sourcesContent":["import { css, html, LitElement, nothing, svg } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureFace } from '@hatiolab/figure-model'\n\nimport { alignmentAt, offsetOf, overhangOf, screenOf, type FaceView, type FastenMode } from './fasten-geometry.js'\nimport type { Alignment } from './links.js'\n\ntype Axis = 'x' | 'y' | 'z'\n\n/** A change the drawing asks of the fastening form. */\nexport type FastenChange =\n | { targetFace: string }\n | { mode: FastenMode }\n | { axis: Axis; how: Alignment; mm?: number }\n | { gap: number }\n\nconst SEEN: Array<[FigureFace, string]> = [\n ['top', 'M60 30 L100 10 L200 10 L160 30 Z'],\n ['front', 'M60 30 L160 30 L160 100 L60 100 Z'],\n ['right', 'M160 30 L200 10 L200 80 L160 100 Z']\n]\n/** The faces the drawing cannot show on the box, as tags beside it where they are. */\n/* The box is drawn a little left of its picture's middle, and the viewBox shifts it back to the panel's centre. */\nconst HIDDEN: Array<[FigureFace, number, number]> = [\n ['bottom', 30, 114],\n ['left', 24, 62],\n ['back', 236, 14]\n]\nconst PANEL_W = 300\n\n\n/**\n * 붙이기 그림 (user 2026-10-01) — which face of what the part is fastened to, how, and where on it; each of them chosen\n * by pressing or dragging the drawing, none by a list of faces.\n *\n * The target is drawn as a box whose faces are pressed (the three it hides as tags beside it), or as the one plane the\n * figure stands by. How is three small side views -- set on it, flush with it, its centre on it (only for a part that\n * turns about a joint) -- and the chosen one's gap is dragged. Where is the face seen from above with the part's\n * footprint on it: dragged, caught at the centre and at the edges from inside and outside, a guide drawn where it is\n * caught and a dimension where it is not, which is pressed to type the number. It may go past the edges: the part that\n * does is shaded, and a part off the face altogether is said so. Nothing is decided here: every change goes to the form\n * (`fasten-change`), and a press or a drag let go says so (`fasten-release`), for the form to apply a fastening it holds.\n */\n@customElement('figure-fasten-drawing')\nexport class FigureFastenDrawing extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: grid;\n gap: 8px;\n outline: none;\n }\n svg {\n width: 100%;\n display: block;\n touch-action: none;\n user-select: none;\n }\n svg text {\n font: inherit;\n }\n div[modes] {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));\n gap: 6px;\n }\n div[modes] svg {\n width: 64px;\n height: 44px;\n }\n div[modes] button {\n display: grid;\n justify-items: center;\n align-content: center;\n gap: 2px;\n padding: 2px 4px 4px;\n font: inherit;\n font-size: 0.72rem;\n color: var(--md-sys-color-on-surface);\n background: none;\n border: 1px solid var(--md-sys-color-outline-variant);\n border-radius: 8px;\n cursor: pointer;\n }\n div[modes] button[on] {\n border: 1.5px solid var(--md-sys-color-primary);\n background: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n div[where] {\n position: relative;\n }\n div[where] input {\n position: absolute;\n width: 72px;\n font: inherit;\n font-size: 0.75rem;\n }\n small[warn] {\n color: var(--md-sys-color-tertiary);\n }\n small[off] {\n color: var(--md-sys-color-error);\n }\n `\n\n /** The target's name, or empty for the plane the figure stands by. */\n @property() target = ''\n /** The plane's name by the figure's placement: 바닥 · 천장 · 벽 · 중심. */\n @property() planeWord = ''\n @property({ attribute: false }) faces: string[] = []\n @property() face = ''\n @property({ attribute: false }) modes: FastenMode[] = ['meet', 'flush']\n @property() mode: FastenMode = 'meet'\n @property({ attribute: false }) view?: FaceView\n @property({ attribute: false }) align: Partial<Record<Axis, Alignment>> = {}\n @property({ attribute: false }) alignMm: Partial<Record<Axis, number>> = {}\n @property({ type: Number }) gap = 0\n /** The part being fastened (not `part`: that is every element's own). */\n @property() partName = ''\n @property({ type: Boolean }) locked = false\n /** The form already says how the fastening it has lies on the face: the drawing says it only while dragging. */\n @property({ type: Boolean }) said = false\n\n /** Where the footprint is while dragging, and what it is caught by; undefined when nothing is dragged. */\n @state() private dragged?: { at: Record<Axis, number>; caught: Partial<Record<Axis, string>> }\n @state() private typing?: Axis\n private scale = 1\n private gapFrom?: { y: number; gap: number }\n\n private change(detail: FastenChange) {\n this.dispatchEvent(new CustomEvent('fasten-change', { detail, bubbles: true, composed: true }))\n }\n private released() {\n this.dispatchEvent(new CustomEvent('fasten-release', { bubbles: true, composed: true }))\n }\n\n render() {\n return html`${this.renderTarget()}${this.renderModes()}${this.renderWhere()}`\n }\n\n /** The target box, its faces pressed; or the plane. */\n private renderTarget() {\n /* The plane is one face, named in the list and on the face drawn below: nothing to pick, so no picture of it. */\n if (!this.target) return nothing\n const has = (f: string) => this.faces.includes(f)\n /* A press is a whole change, as a drag let go is: the form applies a fastening the part already has. */\n const pick = (f: string) => () => {\n if (this.locked || !has(f) || f === this.face) return\n this.change({ targetFace: f })\n this.released()\n }\n const seen = SEEN.map(([f, d]) => {\n const on = this.face === f\n return svg`<path face=${f} d=${d} @click=${pick(f)}\n style=${`cursor:${has(f) ? 'pointer' : 'default'};fill:${on ? 'var(--md-sys-color-primary-container)' : 'var(--md-sys-color-surface-container)'};fill-opacity:${has(f) ? 1 : 0.4};stroke:${on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-outline)'};stroke-width:${on ? 2 : 1}`}>\n <title>${i18next.t('figure.label.face-' + f)}</title></path>`\n })\n const hidden = HIDDEN.map(([f, x, y]) => {\n const on = this.face === f\n return svg`<g face=${f} @click=${pick(f)} style=${`cursor:${has(f) ? 'pointer' : 'default'};opacity:${has(f) ? 1 : 0.35}`}>\n <rect x=${x - 26} y=${y - 10} width=\"52\" height=\"20\" rx=\"10\"\n style=${`fill:${on ? 'var(--md-sys-color-primary-container)' : 'transparent'};stroke:${on ? 'var(--md-sys-color-primary)' : 'var(--md-sys-color-outline)'};stroke-dasharray:${on ? '' : '3 2'}`} />\n <text x=${x} y=${y + 4} text-anchor=\"middle\" font-size=\"11\" style=${`fill:${on ? 'var(--md-sys-color-on-primary-container)' : 'var(--md-sys-color-on-surface-variant)'}`}>${i18next.t('figure.label.face-' + f)}</text>\n </g>`\n })\n /* A shape's faces beyond its six outer ones -- a door frame's opening -- are tags of their own under the box. */\n const others = this.faces.filter(f => !SEEN.some(([s]) => s === f) && !HIDDEN.some(([h]) => h === f))\n return html`${svg`<svg viewBox=\"-20 0 ${PANEL_W} 126\" role=\"img\" aria-label=${this.target}>\n ${seen}\n <text x=\"110\" y=\"70\" text-anchor=\"middle\" font-size=\"12\" pointer-events=\"none\" style=\"fill:var(--md-sys-color-on-surface)\">${this.target}</text>\n ${hidden}\n </svg>`}\n ${others.length\n ? html`<div modes>\n ${others.map(f => html`<button ?on=${f === this.face} ?disabled=${this.locked} @click=${pick(f)}>${i18next.t('figure.label.face-' + f, { defaultValue: f })}</button>`)}\n </div>`\n : nothing}`\n }\n\n /** How: three side views; the chosen one's gap is dragged. */\n private renderModes() {\n /* One way only (the plane is set on): the sentence says it; a single choice is not offered as a button. */\n if (this.modes.length < 2) return nothing\n const icon = (m: FastenMode, on: boolean) => {\n const g = on && m !== 'centre' ? Math.min(this.gap / 4, 10) : 0\n const base = svg`<rect x=\"6\" y=\"30\" width=\"52\" height=\"14\" style=\"fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary)\" />`\n const gapDrag = on && !this.locked ? 'ns-resize' : 'pointer'\n if (m === 'meet')\n return svg`<svg viewBox=\"0 0 64 48\">${base}<rect gap x=\"22\" y=${18 - g} width=\"20\" height=\"12\" style=${`fill:var(--md-sys-color-surface);stroke:currentColor;cursor:${gapDrag}`} />\n ${g ? svg`<text x=\"46\" y=${26 - g / 2} font-size=\"10\" style=\"fill:currentColor\">${this.gap}</text>` : nothing}</svg>`\n if (m === 'flush')\n return svg`<svg viewBox=\"0 0 64 48\">${base}<rect gap x=\"22\" y=${30 - g} width=\"20\" height=\"10\" style=${`fill:var(--md-sys-color-surface);stroke:currentColor;cursor:${gapDrag}`} />\n <line x1=\"4\" y1=\"30\" x2=\"60\" y2=\"30\" style=\"stroke:currentColor;stroke-dasharray:2 2\" /></svg>`\n return svg`<svg viewBox=\"0 0 64 48\">${base}<circle cx=\"32\" cy=\"30\" r=\"11\" style=\"fill:var(--md-sys-color-surface);fill-opacity:.85;stroke:currentColor\" /><circle cx=\"32\" cy=\"30\" r=\"2\" style=\"fill:currentColor\" /></svg>`\n }\n return html`<div modes>\n ${this.modes.map(m => {\n const on = m === this.mode\n return html`<button mode=${m} ?on=${on} ?disabled=${this.locked}\n @click=${() => {\n if (on) return\n this.change({ mode: m })\n this.released()\n }}\n @pointerdown=${(ev: PointerEvent) => {\n if (!on || this.locked || !(ev.target as Element).hasAttribute?.('gap')) return\n ev.preventDefault()\n ;(ev.currentTarget as Element).setPointerCapture(ev.pointerId)\n this.gapFrom = { y: ev.clientY, gap: this.gap }\n }}\n @pointermove=${(ev: PointerEvent) => {\n if (!this.gapFrom) return\n this.change({ gap: Math.max(0, Math.round(this.gapFrom.gap + (this.gapFrom.y - ev.clientY) * 2)) })\n }}\n @pointerup=${() => {\n if (!this.gapFrom) return\n this.gapFrom = undefined\n this.released()\n }}>\n ${icon(m, on)}<span>${i18next.t('figure.label.fasten-mode-' + m)}</span>\n </button>`\n })}\n </div>`\n }\n\n /** Where the part's centre is on each axis now: the drag's, or the form's. */\n private centreOf(view: FaceView): Record<Axis, number> {\n if (this.dragged) return this.dragged.at\n const at = { x: 0, y: 0, z: 0 }\n for (const a of view.axes) at[a] = offsetOf(this.align[a], this.alignMm[a], view.face[a], view.part[a])\n return at\n }\n\n /** What each axis is caught by now: at the centre, level with an edge, touching one from outside, or nothing. */\n private caughtOf(view: FaceView, at: Record<Axis, number>): Partial<Record<Axis, string>> {\n if (this.dragged) return this.dragged.caught\n const out: Partial<Record<Axis, string>> = {}\n for (const a of view.axes) {\n const how = this.align[a] ?? 'centre'\n if (how === 'centre') out[a] = 'centre'\n else if (how === 'min' || how === 'max') out[a] = 'inside'\n else if (view.face[a] !== undefined && Math.abs(Math.abs(at[a]) - (view.face[a]! + view.part[a]) / 2) < 0.5) out[a] = 'outside'\n }\n return out\n }\n\n private renderWhere() {\n const view = this.view\n if (!view) return nothing\n const { h, v, sign } = screenOf(view.axes)\n const W = PANEL_W,\n H = 180\n /* Room around the face for the part to go past its edges by about half itself; a plane with no size, three parts wide. */\n const span = (a: Axis) => (view.face[a] !== undefined ? view.face[a]! + view.part[a] : view.part[a] * 3)\n const k = Math.min((W - 40) / span(h), (H - 40) / span(v))\n this.scale = k\n const cx = W / 2,\n cy = H / 2\n const at = this.centreOf(view)\n const caught = this.caughtOf(view, at)\n const fw = (view.face[h] ?? 0) * k,\n fh = (view.face[v] ?? 0) * k\n const pw = view.part[h] * k,\n ph = view.part[v] * k\n const px = cx + sign[h] * at[h] * k - pw / 2,\n py = cy + sign[v] * at[v] * k - ph / 2\n const faceSized = view.face[h] !== undefined && view.face[v] !== undefined\n const fx = cx - fw / 2,\n fy = cy - fh / 2\n const ix = Math.max(fx, px),\n iy = Math.max(fy, py)\n const iw = Math.min(fx + fw, px + pw) - ix,\n ih = Math.min(fy + fh, py + ph) - iy\n const { touching, sides } = faceSized ? overhangOf(view, at) : { touching: true, sides: [] as ReturnType<typeof overhangOf>['sides'] }\n const round = this.mode === 'centre'\n const guide = (a: Axis) => {\n const c = caught[a]\n if (!c) return nothing\n const along = a === h\n const edge = c === 'centre' ? 0 : Math.sign(at[a]) * (view.face[a] ?? 0) / 2\n const pos = (along ? cx : cy) + sign[a] * edge * k\n const style = `stroke:var(--md-sys-color-primary);stroke-width:${c === 'centre' ? 1 : 2.5};stroke-dasharray:${c === 'centre' ? '4 3' : ''}`\n return along ? svg`<line x1=${pos} y1=\"4\" x2=${pos} y2=${H - 4} style=${style} />` : svg`<line x1=\"4\" y1=${pos} x2=${W - 4} y2=${pos} style=${style} />`\n }\n const dim = (a: Axis) => {\n /* Caught by the centre or an edge, the guide says where it is; a number only where nothing caught it. */\n if (caught[a]) return nothing\n const along = a === h\n const mm = Math.round(at[a])\n const label = `${mm > 0 ? '+' : ''}${mm} mm`\n const to = sign[a] * at[a] * k\n const tx = along ? cx + to / 2 : 8,\n ty = along ? H - 6 : cy + to / 2 + 4\n return svg`${along\n ? svg`<line x1=${cx} y1=${H - 16} x2=${cx + to} y2=${H - 16} style=\"stroke:var(--md-sys-color-on-surface)\" />`\n : svg`<line x1=\"20\" y1=${cy} x2=\"20\" y2=${cy + to} style=\"stroke:var(--md-sys-color-on-surface)\" />`}\n <text dim=${a} x=${tx} y=${ty} font-size=\"11\" text-anchor=${along ? 'middle' : 'start'}\n style=\"fill:var(--md-sys-color-primary);cursor:text;text-decoration:underline dotted\" @click=${() => !this.locked && (this.typing = a)}>${label}</text>`\n }\n const faceName = this.target ? `${this.target} ${i18next.t('figure.label.face-' + this.face)}` : this.planeWord\n const sizeWords = faceSized ? ` ${Math.round(view.face[h]!)} × ${Math.round(view.face[v]!)}` : ''\n return html`<div where tabindex=\"0\" @keydown=${(ev: KeyboardEvent) => this.keys(ev, view)}>\n ${svg`<svg viewBox=\"0 0 ${W} ${H}\" role=\"img\" aria-label=${faceName}\n @pointermove=${(ev: PointerEvent) => this.drag(ev, view, cx, cy)}\n @pointerup=${() => this.drop()} @pointercancel=${() => this.drop()}>\n ${faceSized\n ? svg`<rect x=${fx} y=${fy} width=${fw} height=${fh} rx=\"4\" style=\"fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary);stroke-width:2\" />`\n : svg`<rect x=\"1\" y=\"1\" width=${W - 2} height=${H - 2} rx=\"8\" style=\"fill:var(--md-sys-color-primary-container);stroke:var(--md-sys-color-primary);stroke-width:2\" />`}\n <text x=${faceSized ? fx + 4 : 10} y=${faceSized ? fy + fh - 6 : 18} font-size=\"11\" pointer-events=\"none\" style=\"fill:var(--md-sys-color-primary)\">${faceName}${sizeWords}</text>\n ${guide(h)}${guide(v)}\n <g footprint style=${`cursor:${this.locked ? 'default' : 'grab'}`} @pointerdown=${(ev: PointerEvent) => this.grab(ev, at, caught)}>\n <rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2} style=\"fill:var(--md-sys-color-tertiary-container)\" />\n ${faceSized && iw > 0 && ih > 0\n ? svg`<rect x=${ix} y=${iy} width=${iw} height=${ih} rx=${round ? Math.min(iw, ih) / 2 : 2} style=\"fill:var(--md-sys-color-surface)\" />`\n : !faceSized\n ? svg`<rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2} style=\"fill:var(--md-sys-color-surface)\" />`\n : nothing}\n <rect x=${px} y=${py} width=${pw} height=${ph} rx=${round ? pw / 2 : 2}\n style=${`fill:none;stroke:var(--md-sys-color-on-surface);stroke-width:1.5;stroke-dasharray:${touching ? '' : '4 3'}`} />\n <text x=${px + pw / 2} y=${py + ph / 2 + 4} text-anchor=\"middle\" font-size=\"12\" pointer-events=\"none\" style=\"fill:var(--md-sys-color-on-surface)\">${this.partName}</text>\n </g>\n ${dim(h)}${dim(v)}\n </svg>`}\n ${this.typing ? this.renderTyping(view, this.typing, at) : nothing}\n </div>\n ${this.said && !this.dragged\n ? nothing\n : !touching\n ? html`<small off role=\"status\">${i18next.t('figure.text.fasten-off-face', { face: faceName })}</small>`\n : sides.length\n ? html`<small warn role=\"status\">${i18next.t('figure.text.fasten-past-edges', {\n sides: sides.map(s => i18next.t(`figure.text.overhang-side-${s.side}`, { axis: s.axis.toUpperCase(), mm: String(s.mm) })).join(' · ')\n })}</small>`\n : nothing}`\n }\n\n private renderTyping(view: FaceView, a: Axis, at: Record<Axis, number>) {\n const along = a === screenOf(view.axes).h\n return html`<input type=\"number\" step=\"1\" aria-label=${`${a.toUpperCase()} mm`} .value=${String(Math.round(at[a]))}\n style=${along ? 'left: calc(50% - 36px); bottom: 0' : 'left: 4px; top: calc(50% - 12px)'}\n @keydown=${(ev: KeyboardEvent) => {\n ev.stopPropagation()\n if (ev.key === 'Escape') this.typing = undefined\n if (ev.key !== 'Enter') return\n const value = Number((ev.target as HTMLInputElement).value)\n this.typing = undefined\n if (!Number.isFinite(value)) return\n this.change({ axis: a, how: 'mm', mm: Math.round(value) })\n this.released()\n }}\n @blur=${() => (this.typing = undefined)} />`\n }\n\n private grab(ev: PointerEvent, at: Record<Axis, number>, caught: Partial<Record<Axis, string>>) {\n if (this.locked) return\n ;(ev.currentTarget as Element).closest('svg')!.setPointerCapture(ev.pointerId)\n this.dragged = { at: { ...at }, caught: { ...caught } }\n }\n\n /** The footprint follows the pointer, caught at the centre and edges within a few pixels. */\n private drag(ev: PointerEvent, view: FaceView, cx: number, cy: number) {\n if (!this.dragged) return\n const svgEl = ev.currentTarget as SVGSVGElement\n const pt = svgEl.createSVGPoint()\n pt.x = ev.clientX\n pt.y = ev.clientY\n const p = pt.matrixTransform(svgEl.getScreenCTM()!.inverse())\n const { h, v, sign } = screenOf(view.axes)\n const at = { ...this.dragged.at },\n caught: Partial<Record<Axis, string>> = {}\n for (const [a, d] of [\n [h, (sign[h] * (p.x - cx)) / this.scale],\n [v, (sign[v] * (p.y - cy)) / this.scale]\n ] as const) {\n const got = alignmentAt(d, view.face[a], view.part[a], view.edges[a], 8 / this.scale)\n at[a] = offsetOf(got.how, got.mm, view.face[a], view.part[a])\n if (got.caught) caught[a] = got.caught\n }\n this.dragged = { at, caught }\n }\n\n private drop() {\n const d = this.dragged\n if (!d || !this.view) return\n this.dragged = undefined\n for (const a of this.view.axes) {\n const got = alignmentAt(d.at[a], this.view.face[a], this.view.part[a], this.view.edges[a], 0.5)\n this.change({ axis: a, how: got.how, ...(got.how === 'mm' ? { mm: got.mm } : {}) })\n }\n this.released()\n }\n\n /** Arrows move the part a millimetre, ten with Shift; the centre and edges still catch it. */\n private keys(ev: KeyboardEvent, view: FaceView) {\n const step = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[ev.key]\n if (!step || this.locked || this.typing) return\n ev.preventDefault()\n ev.stopPropagation()\n const by = ev.shiftKey ? 10 : 1\n const at = this.centreOf(view)\n const { h, v, sign } = screenOf(view.axes)\n ;[h, v].forEach((a, i) => {\n if (!step[i]) return\n /* Up the screen is up the face: a Y that rises goes up with the arrow. */\n const got = alignmentAt(at[a] + sign[a] * step[i]! * by, view.face[a], view.part[a], view.edges[a], by / 2)\n this.change({ axis: a, how: got.how, ...(got.how === 'mm' ? { mm: got.mm } : {}) })\n })\n this.released()\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js';
|
|
2
2
|
import { LitElement, nothing } from 'lit';
|
|
3
3
|
import type { FigureAsset } from '@hatiolab/figure-model';
|
|
4
|
+
import './figure-fasten-drawing.js';
|
|
4
5
|
declare const FigureLinks_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
5
6
|
/**
|
|
6
7
|
* What a part is tied to — its size response, what it is fastened to, how it moves.
|
|
@@ -97,6 +98,12 @@ export declare class FigureLinks extends FigureLinks_base {
|
|
|
97
98
|
*/
|
|
98
99
|
private aimAt;
|
|
99
100
|
private renderFastening;
|
|
101
|
+
/** 「lid 의 아랫면을 bin 의 윗면에 맞닿게」: what the fastening is, in one line, the part's own face said as a result. */
|
|
102
|
+
private sentenceOf;
|
|
103
|
+
/** A change the drawing asks: to the form only; the preview behind follows the form. */
|
|
104
|
+
private onFastenChange;
|
|
105
|
+
/** Let go: a fastening the part already has is applied as it now is (one step); a new one waits for 붙이기. */
|
|
106
|
+
private onFastenRelease;
|
|
100
107
|
private renderDetachWords;
|
|
101
108
|
/**
|
|
102
109
|
* Where on the target face the part sits, on the two axes across it: centred, level with the target's edge on
|