@floless/app 0.144.0 → 0.145.0
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/dist/floless-server.cjs +1336 -1258
- package/dist/web/chat.css +17 -2
- package/dist/web/chat.js +2 -1
- package/dist/web/index.html +3 -3
- package/dist/web/model-measure.js +75 -18
- package/dist/web/model-pointer-dock.js +7 -2
- package/dist/web/model-snap-contract.js +14 -0
- package/dist/web/model-snapping.js +564 -139
- package/dist/web/model-viewport-revit-adapter.js +60 -0
- package/package.json +1 -1
package/dist/web/chat.css
CHANGED
|
@@ -1105,14 +1105,29 @@
|
|
|
1105
1105
|
.ai-chat-compose-hint.working { display: inline-flex; align-items: center; min-height: 16px; padding-left: 4px; }
|
|
1106
1106
|
.ai-chat-compose-context { min-height: 12px; padding: 5px 0 0 30px; color: var(--text-dim); font: 8px/1.3 var(--mono); overflow-wrap: anywhere; }
|
|
1107
1107
|
.ai-chat-compose-context strong { color: var(--text-muted); font-weight: 600; }
|
|
1108
|
-
|
|
1108
|
+
/* Send and Stop are icon-only circles: the composer's primary actions, set apart from the square
|
|
1109
|
+
utility buttons. Stop is deliberately neutral, not red: it sits beside Send whenever a follow-up can
|
|
1110
|
+
be queued mid-response, and the filled-square glyph already says "stop" without shouting. */
|
|
1111
|
+
.ai-chat-compose-actions svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
1112
|
+
.ai-chat-send, .ai-chat-stop { flex: none; width: 28px; height: 28px; min-width: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; }
|
|
1113
|
+
.ai-chat-send:not(:disabled):active, .ai-chat-stop:not(:disabled):active { transform: scale(.94); }
|
|
1114
|
+
/* The paper plane's point sits top-right of its box; nudge it so it reads centred in the circle. */
|
|
1115
|
+
.ai-chat-send svg { width: 14px; height: 14px; stroke-width: 2.25; transform: translate(-1px, 1px); }
|
|
1116
|
+
.ai-chat-stop svg { fill: currentColor; stroke: none; }
|
|
1109
1117
|
.ai-chat-compose-actions .ai-chat-stop { margin-left: auto; }
|
|
1110
1118
|
.ai-chat-compose-actions .ai-chat-stop[hidden] + .ai-chat-send { margin-left: auto; }
|
|
1111
1119
|
.ai-chat-send { border-color: var(--accent); background: var(--accent); color: #fff; }
|
|
1112
1120
|
.ai-chat-send:hover { filter: brightness(1.08); }
|
|
1113
1121
|
.ai-chat-send:disabled, .ai-chat-stop:disabled, .ai-chat-icon:disabled, .ai-chat-start-provider:disabled { cursor: default; opacity: .45; filter: none; }
|
|
1114
|
-
.ai-chat-stop { border-color:
|
|
1122
|
+
.ai-chat-stop { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
|
|
1123
|
+
.ai-chat-stop:not(:disabled):hover { background: color-mix(in srgb, var(--surface-3) 88%, var(--text)); }
|
|
1115
1124
|
.ai-chat-stop[hidden] { display: none; }
|
|
1125
|
+
/* Attach is a quiet ghost so the blue Send stays the row's one strong accent. */
|
|
1126
|
+
#chat-attach { border-color: transparent; background: transparent; color: var(--text-muted); }
|
|
1127
|
+
#chat-attach:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
|
|
1128
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1129
|
+
.ai-chat-send:not(:disabled):active, .ai-chat-stop:not(:disabled):active { transform: none; }
|
|
1130
|
+
}
|
|
1116
1131
|
|
|
1117
1132
|
@media (max-width: 900px) {
|
|
1118
1133
|
.ai-chat-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
package/dist/web/chat.js
CHANGED
|
@@ -586,7 +586,8 @@
|
|
|
586
586
|
prefix.textContent = 'Sharing with AI: ';
|
|
587
587
|
ui.contextNote.replaceChildren(prefix, document.createTextNode(shared));
|
|
588
588
|
}
|
|
589
|
-
|
|
589
|
+
// Send is icon-only, so its tooltip names the action before saying what goes with the message.
|
|
590
|
+
ui.send.dataset.tip = `Send message · ${ui.contextNote.textContent}`;
|
|
590
591
|
// Leaving or returning to the Drawing Filter changes whether a suggestion can be applied.
|
|
591
592
|
refreshFilterCards();
|
|
592
593
|
}
|
package/dist/web/index.html
CHANGED
|
@@ -217,10 +217,10 @@
|
|
|
217
217
|
<p class="ai-chat-composer-disclosure" id="chat-composer-disclosure" hidden>Messages and attachments are sent to Claude or Codex through your account.</p>
|
|
218
218
|
<div class="ai-chat-compose-actions">
|
|
219
219
|
<input data-command-id="shell.chat-attach-input" id="chat-file" type="file" accept="image/png,image/jpeg,image/webp,application/pdf" multiple hidden>
|
|
220
|
-
<button data-command-id="shell.chat-attach" type="button" class="ai-chat-icon" id="chat-attach" data-tip="Attach image or PDF" aria-label="Attach image or PDF"
|
|
220
|
+
<button data-command-id="shell.chat-attach" type="button" class="ai-chat-icon" id="chat-attach" data-tip="Attach image or PDF" aria-label="Attach image or PDF"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"/></svg></button>
|
|
221
221
|
<span class="ai-chat-compose-hint" id="chat-compose-hint">Enter to send · Shift+Enter for a new line</span>
|
|
222
|
-
<button data-command-id="shell.chat-stop" type="button" class="ai-chat-stop" id="chat-stop" hidden
|
|
223
|
-
<button data-command-id="shell.chat-send" type="button" class="ai-chat-send" id="chat-send"
|
|
222
|
+
<button data-command-id="shell.chat-stop" type="button" class="ai-chat-stop" id="chat-stop" aria-label="Stop response" data-tip="Stop response" hidden><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="5" y="5" width="14" height="14" rx="2.5"/></svg></button>
|
|
223
|
+
<button data-command-id="shell.chat-send" type="button" class="ai-chat-send" id="chat-send" aria-label="Send message"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/></svg></button>
|
|
224
224
|
</div>
|
|
225
225
|
<!-- What goes with each message is the Send tooltip, and is read to screen readers, rather than a
|
|
226
226
|
line of text under the composer. -->
|
|
@@ -10,6 +10,17 @@ const SNAP_GLYPH = Object.freeze({
|
|
|
10
10
|
});
|
|
11
11
|
const SNAP_LABEL = Object.freeze({ 'mesh-vertex': 'Mesh vertex', 'mesh-edge-midpoint': 'Mesh edge midpoint',
|
|
12
12
|
'mesh-edge-nearest': 'Nearest on mesh edge', surface: 'Mesh surface' });
|
|
13
|
+
/**
|
|
14
|
+
* What the Dimension tool says when the snap index could not check the region under the pointer
|
|
15
|
+
* (#1747). `status` is appended to the step prompt in the dock and `readout` replaces the frame label
|
|
16
|
+
* next to the reticle; the dock's longer explanation is the refusal's own message, so the words live in
|
|
17
|
+
* one place (web/model-snapping.js). Only `crowded` is cured by zooming in; `pending` by waiting.
|
|
18
|
+
*/
|
|
19
|
+
const SNAP_LIMIT_COPY = Object.freeze({
|
|
20
|
+
crowded: Object.freeze({ status: 'zoom in to snap', readout: 'zoom in to snap' }),
|
|
21
|
+
pending: Object.freeze({ status: 'checking snaps…', readout: 'checking snaps…' }),
|
|
22
|
+
element: Object.freeze({ status: 'no snap on this element', readout: 'no snap on this element' }),
|
|
23
|
+
});
|
|
13
24
|
|
|
14
25
|
const point3 = (value) => Array.isArray(value) && value.length === 3 && value.every(Number.isFinite);
|
|
15
26
|
const unit = (value) => { const length = Math.hypot(...value); return length > 1e-9 ? value.map((item) => item / length) : null; };
|
|
@@ -166,7 +177,10 @@ export function mountModelMeasureTool({
|
|
|
166
177
|
const svg = document.createElementNS(SVG_NS, 'svg'); svg.classList.add('model-dim-overlay'); svg.setAttribute('aria-hidden', 'true'); host.append(svg);
|
|
167
178
|
const session = createModelMeasureSession({ initialDimensions, initialPresentation, onChange });
|
|
168
179
|
let armed, first, second, placementOffset, selectedIndex, onePickKind, visible, presentation, dimensions, lockSet;
|
|
169
|
-
let hover = null, onePickMenu = null;
|
|
180
|
+
let hover = null, onePickMenu = null, snapLimit = null, snapLimitTip = null;
|
|
181
|
+
// The pointer the tool last acquired at, so a zoom (which moves no pointer) re-checks the same spot.
|
|
182
|
+
let lastPointer = null, retryTimer = null, lastIndex = null;
|
|
183
|
+
const clearHover = () => { hover = null; snapLimit = null; snapLimitTip = null; };
|
|
170
184
|
const syncSession = () => {
|
|
171
185
|
const value = session.state(); ({ armed, first, second, placementOffset, selectedIndex, onePickKind, visible, presentation } = value);
|
|
172
186
|
dimensions = session.dimensions(); lockSet = new Set(value.locks); return value;
|
|
@@ -227,7 +241,8 @@ export function mountModelMeasureTool({
|
|
|
227
241
|
svgNode('line', { x1: x, y1: y - 13, x2: x, y2: y + 13 }));
|
|
228
242
|
const glyph = svgNode('text', { x, y: y + 4 }); glyph.textContent = SNAP_GLYPH[acquisition.kind] ?? '•'; group.append(glyph);
|
|
229
243
|
const readout = svgNode('text', { x: x + 15, y: y - 12, class: 'model-snap-readout' });
|
|
230
|
-
|
|
244
|
+
const limit = acquisition.kind === 'surface' ? SNAP_LIMIT_COPY[acquisition.snapLimit] : null;
|
|
245
|
+
readout.textContent = `${acquisition.kind} · ${limit ? limit.readout : resolveFrame(viewport).label}`; group.append(readout); svg.append(group);
|
|
231
246
|
};
|
|
232
247
|
const render = () => {
|
|
233
248
|
svg.replaceChildren();
|
|
@@ -237,17 +252,53 @@ export function mountModelMeasureTool({
|
|
|
237
252
|
if (first && second) drawDimension({ a: first.point, b: second.point, offsetPx: placementOffset }, true);
|
|
238
253
|
if (armed && hover) drawReticle(hover);
|
|
239
254
|
};
|
|
240
|
-
const surfaceAcquisition = (event, point) => point && snapModes.surface !== false ? Object.freeze({
|
|
255
|
+
const surfaceAcquisition = (event, point, limit = null) => point && snapModes.surface !== false ? Object.freeze({
|
|
241
256
|
id: 'surface-under-pointer', kind: 'surface', point: Object.freeze([...point]),
|
|
242
|
-
screen: viewport.projectPoint(point), distance: 0, entityId: null,
|
|
257
|
+
screen: viewport.projectPoint(point), distance: 0, entityId: null, snapLimit: limit,
|
|
243
258
|
}) : null;
|
|
244
259
|
const acquire = (event) => {
|
|
245
|
-
|
|
260
|
+
// Over empty space there is nothing to snap and nothing new to report, so the last notice stays:
|
|
261
|
+
// that is also the path the pointer takes to the dock, where the notice's explanation is hovered.
|
|
262
|
+
// Only "still reading" goes: the spot it was about has been left.
|
|
263
|
+
const surfacePoint = viewport.pickSurface(event.clientX, event.clientY);
|
|
264
|
+
if (!surfacePoint) {
|
|
265
|
+
// The spot a "still reading" retry would finish has been left: cancel it and forget the spot.
|
|
266
|
+
if (retryTimer !== null) { clearTimeout(retryTimer); retryTimer = null; }
|
|
267
|
+
lastPointer = null;
|
|
268
|
+
if (snapLimit === 'pending') { snapLimit = null; snapLimitTip = null; }
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
// Remember the last spot over the model: a zoom re-checks it, and a "still reading" retry finishes it.
|
|
272
|
+
lastPointer = { clientX: event.clientX, clientY: event.clientY, altKey: event.altKey === true };
|
|
273
|
+
snapLimit = null; snapLimitTip = null;
|
|
246
274
|
if (event.altKey) return surfaceAcquisition(event, surfacePoint);
|
|
247
275
|
const enabled = onePickKind ? Object.fromEntries(Object.keys(snapModes).map((kind) => [kind, kind === onePickKind])) : snapModes;
|
|
248
|
-
|
|
249
|
-
|
|
276
|
+
const index = snapIndex();
|
|
277
|
+
const snapped = closestModelSnap(index, { x: event.clientX, y: event.clientY }, viewport.projectPoint, enabled, 12, surfacePoint,
|
|
278
|
+
undefined, viewport.pointerRayOrigin?.(event.clientX, event.clientY) ?? null, viewport.snapVisibility?.() ?? null);
|
|
279
|
+
// A refused region is not "nothing nearby": the dock and the reticle say which, and why.
|
|
280
|
+
const looked = ['mesh-vertex', 'mesh-edge-midpoint', 'mesh-edge-nearest'].some((kind) => enabled[kind] !== false);
|
|
281
|
+
const refusal = snapped || !looked ? null : index?.pointerRefusal?.() ?? null;
|
|
282
|
+
if (refusal && SNAP_LIMIT_COPY[refusal.reason]) {
|
|
283
|
+
snapLimit = refusal.reason;
|
|
284
|
+
// The click outcome depends on this tool's own surface setting, so it is said here, not by the index.
|
|
285
|
+
const clickNow = refusal.reason === 'element' ? 'Here, a click places the point on the surface under the pointer.'
|
|
286
|
+
: 'Until then, a click places the point on the surface under the pointer.';
|
|
287
|
+
snapLimitTip = [refusal.message, enabled.surface !== false ? clickNow : null]
|
|
288
|
+
.filter(Boolean).join(' ') || null;
|
|
289
|
+
}
|
|
290
|
+
// Still being indexed: finish it without waiting for the pointer to move again.
|
|
291
|
+
if (snapLimit === 'pending') scheduleRetry();
|
|
292
|
+
return snapped ?? (enabled.surface !== false ? surfaceAcquisition(event, surfacePoint, snapLimit) : null);
|
|
293
|
+
};
|
|
294
|
+
// Re-acquire at the last pointer when the view changed or the region was still being indexed.
|
|
295
|
+
const reacquire = () => {
|
|
296
|
+
retryTimer = null; if (destroyed) return;
|
|
297
|
+
if (!armed || second || !lastPointer) { render(); return; }
|
|
298
|
+
hover = adjusted(acquire(lastPointer), lastPointer); render(); notify();
|
|
250
299
|
};
|
|
300
|
+
let destroyed = false;
|
|
301
|
+
const scheduleRetry = () => { if (retryTimer === null && !destroyed) retryTimer = setTimeout(reacquire, 0); };
|
|
251
302
|
const adjusted = (acquisition, event) => {
|
|
252
303
|
if (!first || !acquisition) return acquisition;
|
|
253
304
|
const frame = resolveFrame(viewport); const point = constrainedPoint(first.point, acquisition.point, lockSet, frame, event.altKey);
|
|
@@ -255,12 +306,15 @@ export function mountModelMeasureTool({
|
|
|
255
306
|
};
|
|
256
307
|
const notify = () => {
|
|
257
308
|
const index = snapIndex(); const step = !armed ? 0 : first === null ? 1 : second === null ? 2 : 3;
|
|
258
|
-
|
|
309
|
+
if (index !== lastIndex) { lastIndex = index; snapLimit = null; snapLimitTip = null; } // a new model generation
|
|
310
|
+
const limit = step === 1 || step === 2 ? SNAP_LIMIT_COPY[snapLimit] ?? null : null;
|
|
311
|
+
const prompt = step === 1 ? 'Pick point 1' : step === 2 ? 'Pick point 2' : step === 3 ? 'Place dimension'
|
|
312
|
+
: selectedIndex !== null ? 'Dimension selected · Enter to edit · Delete to remove' : (dimensions.length ? `${dimensions.length} placed` : 'Ready');
|
|
313
|
+
// A snap refusal is about picking points, so it is shown only while the tool is armed. Disarmed, the
|
|
259
314
|
// status returns to the session (Ready / N placed / selected) — a sentence-long refusal left behind there
|
|
260
315
|
// kept the dock's actions bar wide enough to strand it on its own upper row (#1738).
|
|
261
|
-
const status = armed && index?.available === false ? index.refusal?.message :
|
|
262
|
-
|
|
263
|
-
onState({ armed, hasDraft: !!first, step, count: dimensions.length, selectedIndex, status, visible,
|
|
316
|
+
const status = armed && index?.available === false ? index.refusal?.message : limit ? `${prompt} · ${limit.status}` : prompt;
|
|
317
|
+
onState({ armed, hasDraft: !!first, step, count: dimensions.length, selectedIndex, status, statusTip: limit ? snapLimitTip : null, visible,
|
|
264
318
|
presentation: { ...presentation }, snapModes: { ...snapModes }, locks: [...lockSet],
|
|
265
319
|
activeFrame: resolveFrame(viewport).label, acquired: hover?.kind ?? null, onePickKind });
|
|
266
320
|
};
|
|
@@ -291,7 +345,7 @@ export function mountModelMeasureTool({
|
|
|
291
345
|
}
|
|
292
346
|
event.preventDefault(); event.stopImmediatePropagation();
|
|
293
347
|
if (second) {
|
|
294
|
-
session.commitPlacement({ frameId: resolveFrame(viewport).id }); syncSession();
|
|
348
|
+
session.commitPlacement({ frameId: resolveFrame(viewport).id }); syncSession(); clearHover();
|
|
295
349
|
} else {
|
|
296
350
|
const acquisition = adjusted(acquire(event), event); if (!acquisition) { notify(); return; }
|
|
297
351
|
session.pickPoint(acquisition); syncSession(); if (second) hover = acquisition;
|
|
@@ -336,7 +390,7 @@ export function mountModelMeasureTool({
|
|
|
336
390
|
if (enabled === false) continue;
|
|
337
391
|
const button = document.createElement('button'); button.type = 'button'; button.setAttribute('role', 'menuitem');
|
|
338
392
|
button.dataset.snapOnePick = kind; button.textContent = `${SNAP_GLYPH[kind] ?? '•'} ${SNAP_LABEL[kind] ?? kind}`;
|
|
339
|
-
button.addEventListener('click', () => { session.restrictNextPick(kind); syncSession(); closeOnePickMenu(); notify(); }); menu.append(button);
|
|
393
|
+
button.addEventListener('click', () => { session.restrictNextPick(kind); syncSession(); snapLimit = null; snapLimitTip = null; closeOnePickMenu(); notify(); }); menu.append(button);
|
|
340
394
|
}
|
|
341
395
|
document.body.append(menu); onePickMenu = menu; menu.querySelector('button')?.focus();
|
|
342
396
|
};
|
|
@@ -361,20 +415,23 @@ export function mountModelMeasureTool({
|
|
|
361
415
|
if (onePickMenu) closeOnePickMenu();
|
|
362
416
|
// The rung that disarms the tool takes the button's way out: the cursor and the canvas input go with it.
|
|
363
417
|
else if (session.cancelStep() === 'tool') { api.setArmed(false); return; }
|
|
364
|
-
else { syncSession();
|
|
418
|
+
else { syncSession(); clearHover(); }
|
|
365
419
|
render(); notify();
|
|
366
420
|
};
|
|
367
421
|
let api;
|
|
368
422
|
const releaseInput = viewport.registerInputTool?.({ pointerMove: onMove, click: onClick, contextMenu: onContextMenu, keyDown: onKey,
|
|
369
423
|
cancel() { if (armed) api?.setArmed(false); } }, { id: 'model-measure', priority: 50, exclusiveGroup: 'model-command' });
|
|
370
424
|
if (typeof releaseInput !== 'function') throw new Error('Model measurement requires the shared CAD input arbiter.');
|
|
371
|
-
|
|
425
|
+
// A zoom or orbit moves the view under a still pointer: re-check that spot, so a notice such as "zoom
|
|
426
|
+
// in to snap" does not outlive the zoom that answered it.
|
|
427
|
+
// Coalesced: an orbit notifies many times per frame; the spot is re-checked once after them.
|
|
428
|
+
const unsubscribe = viewport.onCameraChange?.(() => { if (armed && !second && lastPointer) scheduleRetry(); render(); }) ?? (() => {});
|
|
372
429
|
api = {
|
|
373
|
-
setArmed(value) { if (value) releaseInput.activate?.(); else releaseInput.deactivate?.(); session.setArmed(value); syncSession(); surface.classList.toggle('measure-armed', armed); if (!armed) {
|
|
430
|
+
setArmed(value) { if (value) releaseInput.activate?.(); else releaseInput.deactivate?.(); session.setArmed(value); syncSession(); surface.classList.toggle('measure-armed', armed); if (!armed) { clearHover(); lastPointer = null; closeOnePickMenu(); } render(); notify(); },
|
|
374
431
|
toggle() { api.setArmed(!armed); },
|
|
375
432
|
setSnapMode(kind, value) { if (kind in snapModes) { snapModes = { ...snapModes, [kind]: value === true }; render(); notify(); } },
|
|
376
433
|
setAxisLock(kind) { if (['f', 'x', 'y', 'z'].includes(kind)) setLock(kind); },
|
|
377
|
-
clear() { session.clear(); syncSession();
|
|
434
|
+
clear() { session.clear(); syncSession(); clearHover(); render(); notify(); },
|
|
378
435
|
setVisible(value) { const result = session.setVisible(value); syncSession(); render(); notify(); return result; },
|
|
379
436
|
setPresentation(value) { const result = session.setPresentation(value); syncSession(); render(); notify(); return result; },
|
|
380
437
|
update(index, patch) {
|
|
@@ -388,7 +445,7 @@ export function mountModelMeasureTool({
|
|
|
388
445
|
dimensions() { return session.dimensions(); },
|
|
389
446
|
serialize() { return session.serialize(); },
|
|
390
447
|
refresh() { render(); },
|
|
391
|
-
destroy() { closeOnePickMenu(); closeEditor(); unsubscribe(); releaseInput(); session.dispose(); svg.remove(); },
|
|
448
|
+
destroy() { destroyed = true; if (retryTimer !== null) clearTimeout(retryTimer); retryTimer = null; closeOnePickMenu(); closeEditor(); unsubscribe(); releaseInput(); session.dispose(); svg.remove(); },
|
|
392
449
|
};
|
|
393
450
|
notify(); return api;
|
|
394
451
|
}
|
|
@@ -145,9 +145,14 @@ export function mountModelPointerDock({ selectionHost = null, snapHost = null, a
|
|
|
145
145
|
if (button) { button.classList.toggle('on', state.armed === true); button.setAttribute('aria-pressed', String(state.armed === true)); }
|
|
146
146
|
const status = actionsHost?.querySelector('[data-model-action-status]');
|
|
147
147
|
if (status) {
|
|
148
|
+
// This runs on every pointer move while measuring. Touch the live region only when the words
|
|
149
|
+
// change, so assistive technology is not re-told the same status on each move. The pill is
|
|
150
|
+
// width-capped with an ellipsis (model-editor.css), so it always carries a themed tooltip: the
|
|
151
|
+
// provider's longer explanation when it has one (a snap notice), else the same full sentence.
|
|
148
152
|
const text = state.status ?? (state.armed ? (state.hasDraft ? 'Pick point 2' : 'Pick point 1') : (state.count ? `${state.count} placed` : 'Ready'));
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
if (status.textContent !== text) status.textContent = text;
|
|
154
|
+
const tip = typeof state.statusTip === 'string' && state.statusTip ? state.statusTip : text;
|
|
155
|
+
if (status.getAttribute('data-tip') !== tip) status.setAttribute('data-tip', tip);
|
|
151
156
|
}
|
|
152
157
|
const locks = new Set(state.locks ?? []);
|
|
153
158
|
actionsHost?.querySelectorAll('[data-model-axis]').forEach((axisButton) => {
|
|
@@ -19,6 +19,20 @@ export const MODEL_SNAP_LIMITS_V1 = Object.freeze({
|
|
|
19
19
|
directionMinLength: 1e-9, nearParallelCrossLength: 1e-8,
|
|
20
20
|
extensionSourceLengths: 10, extensionMaximumMm: 100000,
|
|
21
21
|
});
|
|
22
|
+
/**
|
|
23
|
+
* How mesh snap acquisition decides what it has checked (#1747). Topology is indexed per element, on
|
|
24
|
+
* demand, for the pointer's sightline region only: a capsule along the pick ray, from its origin to
|
|
25
|
+
* `behindHitReach` radii past the surface under the pointer, whose radius is `neighbourhoodMargin`
|
|
26
|
+
* times the world length of the acquisition radius at that surface. Every visible element whose
|
|
27
|
+
* envelope meets that region is indexed COMPLETELY or the query is refused with `over-budget` — a
|
|
28
|
+
* partial set is never returned. `over-budget` therefore means "this pointer position's region could
|
|
29
|
+
* not be checked completely within the fixed budget" (or not yet, within one move's share of it),
|
|
30
|
+
* never "snapping is off for the model". `queryEvaluationCap` bounds the candidates one pointer event
|
|
31
|
+
* may evaluate; more than that inside the region is refused the same way, not truncated.
|
|
32
|
+
*/
|
|
33
|
+
export const MODEL_SNAP_INDEX_POLICY_V1 = Object.freeze({
|
|
34
|
+
coverage: 'pointer-sightline', neighbourhoodMargin: 2, behindHitReach: 8, queryEvaluationCap: 4096,
|
|
35
|
+
});
|
|
22
36
|
|
|
23
37
|
const MAX_COORD = 1e12, MAX_CSS = 1e7, MAX_GENERATION = 0xffffffff;
|
|
24
38
|
const own = (v, k) => Object.prototype.hasOwnProperty.call(v, k);
|