@floless/app 0.141.1 → 0.142.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 +2478 -1798
- package/dist/web/app.css +1 -0
- package/dist/web/aware.js +10 -5
- package/dist/web/chat.css +21 -0
- package/dist/web/chat.js +512 -38
- package/dist/web/commands-revit.js +1 -1
- package/dist/web/commands-shell.js +22 -4
- package/dist/web/commands-steel.js +4 -0
- package/dist/web/left-pane.js +43 -0
- package/dist/web/model-clip-session.js +2 -3
- package/dist/web/model-navigation-controls.js +17 -3
- package/dist/web/model-orientation-overlay.js +2 -3
- package/dist/web/model-panel-bridge.js +15 -3
- package/dist/web/model-viewport-revit-adapter.js +1 -0
- package/dist/web/model-viewport-toolbar.js +0 -2
- package/dist/web/revit-editor.js +4 -6
- package/dist/web/steel-3d-view.js +79 -45
- package/dist/web/steel-editor.html +167 -15
- package/dist/web/steel-filter.html +13 -4
- package/dist/web/steel-model-commands.js +0 -1
- package/dist/web/workspaces.js +28 -8
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
var def = window.Commands.define;
|
|
6
6
|
def('revit.projection', { label: 'Camera projection', actsOn: 'Opens perspective and orthographic camera choices', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
7
7
|
def('revit.projection-mode', { label: 'Set camera projection', actsOn: 'Draws the Revit model in {instance}', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
8
|
-
def('revit.fit', { label: 'Fit all to view', actsOn: 'Frames the whole Revit model', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
8
|
+
def('revit.fit', { label: 'Fit all to view', key: 'Also: Home', actsOn: 'Frames the whole Revit model', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
9
9
|
def('revit.fit-selection', { label: 'Zoom to selected', actsOn: 'Frames the selected Revit object', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
10
10
|
def('revit.display-mode', { label: 'Display mode', actsOn: 'Opens solid, wireframe, X-ray and realistic choices', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
11
11
|
def('revit.display-mode-set', { label: 'Set display mode', actsOn: 'Draws the Revit model as {instance}', group: 'In the Revit model toolbar', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
@@ -1479,13 +1479,22 @@
|
|
|
1479
1479
|
group: 'In AI Chat', key: 'Enter sends · Shift + Enter starts a new line', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
1480
1480
|
});
|
|
1481
1481
|
def('shell.chat-attach', {
|
|
1482
|
-
label: 'Attach file', actsOn: 'Adds images (up to five per message) or PDFs from this computer to the next message or follow-up',
|
|
1482
|
+
label: 'Attach file', actsOn: 'Adds images (up to five per message) or PDFs from this computer to the next message or follow-up; on the Drawing Filter only pictures can be sent and a PDF is turned away as soon as it is chosen, because the AI answering there cannot open one',
|
|
1483
1483
|
group: 'In AI Chat', persistence: 'working', interaction: 'dialog', risk: [], guidance: 'on-demand',
|
|
1484
1484
|
});
|
|
1485
1485
|
def('shell.chat-attach-input', {
|
|
1486
|
-
label: 'Choose attachments', actsOn: 'Selects images (up to five per message) or PDFs to add to the next message or follow-up',
|
|
1486
|
+
label: 'Choose attachments', actsOn: 'Selects images (up to five per message) or PDFs to add to the next message or follow-up; on the Drawing Filter a PDF is turned away as soon as it is chosen, because the AI answering there cannot open one',
|
|
1487
1487
|
group: 'In AI Chat', persistence: 'working', interaction: 'dialog', risk: [], guidance: 'on-demand',
|
|
1488
1488
|
});
|
|
1489
|
+
def('shell.chat-subjects', {
|
|
1490
|
+
label: 'Selected objects for the next question', actsOn: 'Says which selected Steel Model objects will be attached to your next question',
|
|
1491
|
+
group: 'In AI Chat', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
1492
|
+
why: 'A question sent with objects selected is linked to them, so selecting one later shows the question and opens it in chat.',
|
|
1493
|
+
});
|
|
1494
|
+
def('shell.chat-subjects-remove', {
|
|
1495
|
+
label: 'Leave selected objects out', actsOn: 'Sends your next question without the selected Steel Model objects, until the selection changes',
|
|
1496
|
+
group: 'In AI Chat', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
1497
|
+
});
|
|
1489
1498
|
def('shell.chat-attachment-remove', {
|
|
1490
1499
|
label: 'Remove pending attachment', actsOn: 'Leaves {instance} out of the next message',
|
|
1491
1500
|
group: 'In AI Chat', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
@@ -1542,9 +1551,18 @@
|
|
|
1542
1551
|
group: 'In AI Chat', persistence: 'external', interaction: 'instant', risk: ['destructive'], guidance: 'on-demand',
|
|
1543
1552
|
});
|
|
1544
1553
|
def('shell.chat-approval-request', {
|
|
1545
|
-
label: 'Approve for this request', actsOn: 'Allows this access action and future access actions until the current response finishes; keeps your permission setting and review checkpoints unchanged
|
|
1554
|
+
label: 'Approve for this request', actsOn: 'Allows this access action and future access actions until the current response finishes; keeps your permission setting and review checkpoints unchanged; Tekla reads ask unless you allow them for this chat',
|
|
1546
1555
|
group: 'In AI Chat', persistence: 'external', interaction: 'instant', risk: ['destructive'], guidance: 'on-demand',
|
|
1547
|
-
why: 'Saves approving each access action one by one during this response. A Tekla
|
|
1556
|
+
why: 'Saves approving each access action one by one during this response. A Tekla read is not covered: it has its own Allow for this chat.',
|
|
1557
|
+
});
|
|
1558
|
+
def('shell.chat-tekla-allow-chat', {
|
|
1559
|
+
label: 'Allow Tekla reads for this chat', actsOn: 'Allows this Tekla read and every later read this chat may ask for, of the open model name or the parts you have selected, without asking again in this conversation until you revoke it',
|
|
1560
|
+
group: 'In AI Chat', persistence: 'external', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
1561
|
+
why: 'Saves approving each Tekla read one by one. FloLess still checks Tekla live before every read and shows every result; nothing in the model changes.',
|
|
1562
|
+
});
|
|
1563
|
+
def('shell.chat-tekla-allowance-revoke', {
|
|
1564
|
+
label: 'Revoke Tekla reads for this chat', actsOn: 'Makes Chat ask you again before each Tekla read in this conversation; a read already running may finish',
|
|
1565
|
+
group: 'In AI Chat', persistence: 'external', interaction: 'instant', risk: [], guidance: 'on-demand',
|
|
1548
1566
|
});
|
|
1549
1567
|
def('shell.chat-approval-revoke', {
|
|
1550
1568
|
label: 'Revoke request auto-approval', actsOn: 'Asks before future access actions in this request; actions already approved may finish',
|
|
@@ -2228,6 +2228,10 @@
|
|
|
2228
2228
|
def('steel.registration-detail', { label: 'Registration details', actsOn: 'Shows the exact reason this sheet’s registration was refused, naming the contract fields to change', group: 'On the steel canvas', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The plain-English warning is for you; this is the sentence your terminal AI needs.' });
|
|
2229
2229
|
def('steel.registration-copy', { label: 'Copy reason', actsOn: 'Copies the exact registration refusal to the clipboard', group: 'On the steel canvas', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This sheet cannot be corrected in the editor — paste the reason to your terminal AI and ask it to fix the registration.' });
|
|
2230
2230
|
def('steel.review-select', { label: 'Select this connection', actsOn: 'Selects {instance} from the review list', group: 'In the review list', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A watched connection selects the members it watches; an unwatched one opens the 3D view and selects the connection itself.' });
|
|
2231
|
+
def('steel.chat-question-show', { label: 'Show in chat', actsOn: 'Opens AI Chat at the question “{instance}”', anyInstance: 'a question asked about this object', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Questions asked in AI Chat with objects selected stay linked to those objects.' });
|
|
2232
|
+
def('steel.chat-questions-more', { label: 'Show more questions', actsOn: 'Shows the older questions asked in AI Chat about the selection', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
2233
|
+
def('steel.chat-questions-orphans', { label: 'Questions about objects no longer in the model', actsOn: 'Shows AI Chat questions about objects this model no longer has, with the name each had when asked', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A question is never moved to another object, even one with the same name.' });
|
|
2234
|
+
def('steel.chat-questions-retry', { label: 'Retry loading questions', actsOn: 'Reads the questions asked in AI Chat about this project again', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
2231
2235
|
def('steel.connection-part-back', { label: 'Back to connection', actsOn: 'Selects the whole connection that owns this part', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
2232
2236
|
def('steel.connection-part-edit', { label: 'Edit on parent member', actsOn: 'Selects the member that owns this connection part', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
|
|
2233
2237
|
def('steel.quick-dimension-place', { label: 'Place spacing dimensions', actsOn: 'Arms a running dimension row for the current selection', group: 'In the Properties panel', persistence: 'working', interaction: 'mode', risk: [], guidance: 'active-command', steps: ['Click where the spacing dimension row should sit'], why: 'The dimensions stay attached to the selected members or grid lines.' });
|
package/dist/web/left-pane.js
CHANGED
|
@@ -215,7 +215,31 @@
|
|
|
215
215
|
stack.append(sections[first], split, sections[second], empty);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// The model objects selected in the live editor, as AI Chat may attach them to a question (#1653): a frozen copy,
|
|
219
|
+
// or null whenever no editor is live here or nothing it can name is selected. The editor's own shape is checked,
|
|
220
|
+
// not trusted: the server validates again, but a pill must never count what it cannot send.
|
|
221
|
+
function readSelection() {
|
|
222
|
+
const subjects = state.modelAvailable && modelVisible() ? state.snapshot?.subjects : null;
|
|
223
|
+
if (!subjects || typeof subjects !== 'object' || typeof subjects.source !== 'string') return null;
|
|
224
|
+
const items = Array.isArray(subjects.items) ? subjects.items.filter((item) => item && typeof item.kind === 'string'
|
|
225
|
+
&& typeof item.id === 'string' && item.id).map((item) => Object.freeze({ kind: item.kind, id: item.id,
|
|
226
|
+
label: typeof item.label === 'string' ? item.label : item.id })) : [];
|
|
227
|
+
const total = Number.isSafeInteger(subjects.total) && subjects.total >= items.length ? subjects.total : items.length;
|
|
228
|
+
if (!total || !items.length) return null;
|
|
229
|
+
return Object.freeze({ source: subjects.source, revision: Number.isSafeInteger(subjects.revision) ? subjects.revision : null,
|
|
230
|
+
total, key: typeof subjects.key === 'string' && subjects.key.length <= 64 ? subjects.key : null, items: Object.freeze(items) });
|
|
231
|
+
}
|
|
232
|
+
let selectionKey = 'null';
|
|
233
|
+
// Chat repaints its pill when this changes. Called from reflect(), which every path that forgets a model reaches.
|
|
234
|
+
function announceSelection() {
|
|
235
|
+
const next = readSelection();
|
|
236
|
+
const key = JSON.stringify(next);
|
|
237
|
+
if (key === selectionKey) return;
|
|
238
|
+
selectionKey = key;
|
|
239
|
+
window.dispatchEvent(new window.CustomEvent('floless:model-selection'));
|
|
240
|
+
}
|
|
218
241
|
function reflect() {
|
|
242
|
+
announceSelection();
|
|
219
243
|
const both = presented('narrative') && presented('model');
|
|
220
244
|
const first = state.order[0];
|
|
221
245
|
const splitLocked = approvalSplitLocked(first);
|
|
@@ -691,7 +715,9 @@
|
|
|
691
715
|
state.snapshot.selectedId = typeof data.selectedId === 'string' ? data.selectedId : null;
|
|
692
716
|
state.snapshot.selectedIds = Array.isArray(data.selectedIds) ? data.selectedIds.filter((id) => typeof id === 'string') : (state.snapshot.selectedId ? [state.snapshot.selectedId] : []);
|
|
693
717
|
state.snapshot.selectionOrigin = data.selectionOrigin || 'tree';
|
|
718
|
+
state.snapshot.subjects = data.subjects && typeof data.subjects === 'object' ? data.subjects : null;
|
|
694
719
|
}
|
|
720
|
+
announceSelection();
|
|
695
721
|
pendingSelectIds = null;
|
|
696
722
|
const picked = selectedIdsOf(data);
|
|
697
723
|
modelContent.querySelectorAll('[data-entity-id]').forEach((row) => {
|
|
@@ -701,6 +727,20 @@
|
|
|
701
727
|
if (state.followSelection && state.snapshot?.selectedIds?.length === 1) { renderModel(); revealSelectedEntity(); }
|
|
702
728
|
return;
|
|
703
729
|
}
|
|
730
|
+
// An object card's Show in chat: the editor names a conversation and one message in it (#1653).
|
|
731
|
+
if (data.type === 'open-chat') {
|
|
732
|
+
state.revision = data.revision;
|
|
733
|
+
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
734
|
+
if (!uuid.test(String(data.chatId)) || !uuid.test(String(data.messageEventId))
|
|
735
|
+
|| typeof data.projectId !== 'string' || !data.projectId || data.projectId.length > 200) return;
|
|
736
|
+
// Said where a sighted person looks, not only to a screen reader: the click happened in the model panel.
|
|
737
|
+
const refuse = (message) => { status.textContent = message; window.showToast?.(message, 'info'); };
|
|
738
|
+
const open = window.flolessChat?.openConversation;
|
|
739
|
+
if (typeof open !== 'function') { refuse('AI Chat is not ready yet. Try Show in chat again in a moment.'); return; }
|
|
740
|
+
Promise.resolve().then(() => open(data.chatId, { messageEventId: data.messageEventId, projectId: data.projectId }))
|
|
741
|
+
.catch((error) => refuse(error?.message || 'That conversation could not be opened. Try Show in chat again.'));
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
704
744
|
if (data.type !== 'snapshot') return;
|
|
705
745
|
state.revision = data.revision; state.snapshot = data.snapshot; state.modelAvailable = true;
|
|
706
746
|
if (state.datasetKey !== data.snapshot.datasetKey) state.datasetKey = data.snapshot.datasetKey || null;
|
|
@@ -725,6 +765,9 @@
|
|
|
725
765
|
frame.addEventListener('load', onModelFrameLoad);
|
|
726
766
|
|
|
727
767
|
window.flolessLeftPane = Object.freeze({
|
|
768
|
+
readSelection,
|
|
769
|
+
// AI Chat stored a question about model objects: the live editor reads its links again.
|
|
770
|
+
chatLinksChanged() { if (state.modelAvailable) send({ type: 'chat-links-changed' }); },
|
|
728
771
|
showSection(key) {
|
|
729
772
|
if (!available(key)) return false;
|
|
730
773
|
const changed = !shown(key); sessionVisible[key] = true; reflect(); return changed;
|
|
@@ -50,7 +50,6 @@ export function createModelClipSession({
|
|
|
50
50
|
let sequence = 0;
|
|
51
51
|
let disposed = false;
|
|
52
52
|
let mutationDepth = 0;
|
|
53
|
-
let pendingReason = null;
|
|
54
53
|
|
|
55
54
|
const clips = () => tools.state().clips ?? [];
|
|
56
55
|
const orderedIds = () => clips().map((clip) => clip.id);
|
|
@@ -76,7 +75,7 @@ export function createModelClipSession({
|
|
|
76
75
|
return value;
|
|
77
76
|
};
|
|
78
77
|
const publish = (reason) => {
|
|
79
|
-
if (mutationDepth)
|
|
78
|
+
if (mutationDepth) return current();
|
|
80
79
|
return emit(reason);
|
|
81
80
|
};
|
|
82
81
|
const beginEdit = (reason) => {
|
|
@@ -87,7 +86,7 @@ export function createModelClipSession({
|
|
|
87
86
|
try { beginEdit(reason); return operation(); }
|
|
88
87
|
finally {
|
|
89
88
|
mutationDepth -= 1;
|
|
90
|
-
if (!mutationDepth)
|
|
89
|
+
if (!mutationDepth) emit(reason);
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
const nextIdentity = (kind) => {
|
|
@@ -12,6 +12,16 @@ Object.freeze(MODEL_NAMED_VIEWS);
|
|
|
12
12
|
|
|
13
13
|
export const MODEL_VIEW_KEYS = Object.freeze({ t: 'top', f: 'front', r: 'right', b: 'back', l: 'left' });
|
|
14
14
|
|
|
15
|
+
/** Keep an entire model sphere inside the camera frustum as navigation changes its distance. */
|
|
16
|
+
export function modelCameraClipRange(distance, radius, orthographic = false) {
|
|
17
|
+
if (!Number.isFinite(distance) || distance < 0 || !Number.isFinite(radius) || radius < 0) throw new RangeError('Camera clipping needs a finite distance and radius.');
|
|
18
|
+
// Orthographic zoom changes magnification without moving the camera. Its near plane must
|
|
19
|
+
// reach behind a camera that sits inside the model after framing a close detail.
|
|
20
|
+
const near = orthographic ? distance - radius * 1.05 : Math.max(0.1, (distance - radius) * 0.5);
|
|
21
|
+
const far = Math.max(near + 1, (distance + radius) * 1.05);
|
|
22
|
+
return { near, far };
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
/** Apply FloLess CAD mouse conventions to an OrbitControls-compatible controller. */
|
|
16
26
|
export function applyCadOrbitPolicy(controls, mouse = THREE.MOUSE) {
|
|
17
27
|
if (!controls) throw new Error('CAD navigation needs OrbitControls.');
|
|
@@ -85,9 +95,12 @@ function cadRepivotAction({ controls, getCamera, pickPoint, cursor }) {
|
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
/** Shared keyboard pan/rotate/named-view behavior. Escape remains owned by the active tool plugin. */
|
|
88
|
-
export function handleCadNavigationKey({ getCamera, getControls, applyView, fitSelection, canFitSelection = () => true, canApplyView = () => true }, event) {
|
|
98
|
+
export function handleCadNavigationKey({ getCamera, getControls, applyView, fitAll, fitSelection, canFitSelection = () => true, canApplyView = () => true }, event) {
|
|
89
99
|
const arrows = Object.freeze({ ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] });
|
|
90
100
|
if (event.defaultPrevented) return false;
|
|
101
|
+
if (event.key === 'Home' && !event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey && fitAll) {
|
|
102
|
+
event.preventDefault(); fitAll(); return true;
|
|
103
|
+
}
|
|
91
104
|
if (((event.key === ' ' && event.shiftKey) || ((event.key === 'z' || event.key === 'Z') && event.altKey)) && canFitSelection(event)) {
|
|
92
105
|
event.preventDefault(); fitSelection?.(); return true;
|
|
93
106
|
}
|
|
@@ -122,7 +135,7 @@ export function handleCadNavigationKey({ getCamera, getControls, applyView, fitS
|
|
|
122
135
|
* parallel listener set or copying camera behavior.
|
|
123
136
|
*/
|
|
124
137
|
export function mountCadInputArbiter({
|
|
125
|
-
surface, controls, mouse = THREE.MOUSE, win = window, getCamera, pickPoint, applyView, fitSelection,
|
|
138
|
+
surface, controls, mouse = THREE.MOUSE, win = window, getCamera, pickPoint, applyView, fitAll, fitSelection,
|
|
126
139
|
isActive = () => true, canFitSelection, canApplyView, orbitInput = null, orbitThreshold = 5, plugin = {},
|
|
127
140
|
}) {
|
|
128
141
|
if (!surface || !controls || !win) throw new Error('CAD input arbiter needs a surface, controls, and window.');
|
|
@@ -212,13 +225,14 @@ export function mountCadInputArbiter({
|
|
|
212
225
|
if (!isActive()) return;
|
|
213
226
|
if (event.defaultPrevented || event.cancelBubble === true) return;
|
|
214
227
|
const active = win.document?.activeElement; if (active && /^(INPUT|SELECT|TEXTAREA)$/.test(active.tagName)) return;
|
|
228
|
+
const menuOwnsHome = event.key === 'Home' && !!active?.closest?.('.m3dmenu,[role="menu"]');
|
|
215
229
|
dispatch('keyDown', event);
|
|
216
230
|
if (event.key === 'Escape' && orbitGesture) {
|
|
217
231
|
if (!orbitGesture.pending) orbitInput?.cancel(orbitGesture.down);
|
|
218
232
|
orbitGesture = null;
|
|
219
233
|
}
|
|
220
234
|
if (orbitInput && !event.defaultPrevented) orbitInput.document(event);
|
|
221
|
-
if (!event.defaultPrevented) handleCadNavigationKey({ getCamera, getControls: () => controls, applyView, fitSelection, canFitSelection, canApplyView }, event);
|
|
235
|
+
if (!event.defaultPrevented && !menuOwnsHome) handleCadNavigationKey({ getCamera, getControls: () => controls, applyView, fitAll, fitSelection, canFitSelection, canApplyView }, event);
|
|
222
236
|
});
|
|
223
237
|
listen(win, 'keyup', (event) => { dispatch('keyUp', event); if (orbitInput && !event.defaultPrevented) orbitInput.document(event); });
|
|
224
238
|
controls.addEventListener('start', repivot); removers.push(() => controls.removeEventListener('start', repivot));
|
|
@@ -61,7 +61,6 @@ export function modelCubeDirection(point) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export function nextModelCubeKeyboardView(current, key) {
|
|
64
|
-
if (key === 'Home') return 'iso';
|
|
65
64
|
return KEY_ADJACENCY[current]?.[key] ?? current;
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -102,7 +101,7 @@ function disposeScene(scene) {
|
|
|
102
101
|
function renderAccessibleName(canvas, status, highlighted) {
|
|
103
102
|
const face = FACE_LABELS[highlighted];
|
|
104
103
|
const label = highlighted === 'iso' ? 'Isometric' : `${face[0]}${face.slice(1).toLowerCase()}`;
|
|
105
|
-
canvas.setAttribute('aria-label', `ViewCube. ${label} view selected. Arrow keys choose a face, Home
|
|
104
|
+
canvas.setAttribute('aria-label', `ViewCube. ${label} view selected. Arrow keys choose a face, Enter applies. Home fits the whole model.`);
|
|
106
105
|
status.textContent = `${label} view selected`;
|
|
107
106
|
}
|
|
108
107
|
|
|
@@ -129,7 +128,7 @@ export function mountModelOrientationOverlay({
|
|
|
129
128
|
cleanup(() => { cubeRenderer.dispose(); cubeRenderer.forceContextLoss?.(); });
|
|
130
129
|
cubeRenderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)); cubeRenderer.setSize(MODEL_VIEW_CUBE_PX, MODEL_VIEW_CUBE_PX);
|
|
131
130
|
const cubeCanvas = cubeRenderer.domElement; cubeCanvas.tabIndex = 0; cubeCanvas.setAttribute('role', 'button');
|
|
132
|
-
cubeCanvas.dataset.tip = 'ViewCube: arrows choose a face, Home
|
|
131
|
+
cubeCanvas.dataset.tip = 'ViewCube: arrows choose a face, Enter applies, Home fits the whole model, Escape returns to the model';
|
|
133
132
|
cubeHost.appendChild(cubeCanvas); cleanup(() => cubeCanvas.remove());
|
|
134
133
|
|
|
135
134
|
const status = document.createElement('span'); status.className = 'model-view-cube-status'; status.setAttribute('aria-live', 'polite'); status.setAttribute('aria-atomic', 'true');
|
|
@@ -151,7 +151,7 @@ export function createPanelHost({ win = window, root, bodies, install = (_doc) =
|
|
|
151
151
|
|
|
152
152
|
export function createModelPanelBridge({ win = window, origin = location.origin, snapshot, selectedId, selectedIds = () => {
|
|
153
153
|
const id = selectedId(); return typeof id === 'string' ? [id] : [];
|
|
154
|
-
}, select, expand, panel = (_tab, _person, _follow) => false }) {
|
|
154
|
+
}, selectedSubjects = () => null, select, expand, panel = (_tab, _person, _follow) => false, chatLinksChanged = null }) {
|
|
155
155
|
let requested = false;
|
|
156
156
|
let generation = null;
|
|
157
157
|
let revision = 0;
|
|
@@ -167,9 +167,12 @@ export function createModelPanelBridge({ win = window, origin = location.origin,
|
|
|
167
167
|
const publishStatus = (message = '') => send({ type: 'status', state: lifecycle, message });
|
|
168
168
|
const publishSnapshot = () => {
|
|
169
169
|
if (lifecycle !== 'ready') return false;
|
|
170
|
-
return send({ type: 'snapshot', snapshot: { ...snapshot(), datasetKey } });
|
|
170
|
+
return send({ type: 'snapshot', snapshot: { ...snapshot(), subjects: selectedSubjects(), datasetKey } });
|
|
171
171
|
};
|
|
172
|
-
|
|
172
|
+
// `subjects` is the selection as model objects a chat message may be about (#1653): {source, revision, total,
|
|
173
|
+
// items: [{kind, id, label}]}, or null. Raw selected ids stay beside it for the tree's own rows.
|
|
174
|
+
const publishSelection = (selectionOrigin = 'tree') => lifecycle === 'ready' && send({ type: 'selection', selectedId: selectedId(), selectedIds: selectedIds(),
|
|
175
|
+
subjects: selectedSubjects(), selectionOrigin });
|
|
173
176
|
const actionResult = (requestId, ok, message = '') => send({ type: 'action-result', requestId, ok, message });
|
|
174
177
|
|
|
175
178
|
const receive = (event) => {
|
|
@@ -184,6 +187,11 @@ export function createModelPanelBridge({ win = window, origin = location.origin,
|
|
|
184
187
|
}
|
|
185
188
|
if (!requested || data.generation !== generation) return;
|
|
186
189
|
if (data.type === 'release') { requested = false; generation = null; return; }
|
|
190
|
+
// AI Chat stored a question about model objects: an editor that shows chat links reads them again.
|
|
191
|
+
if (data.type === 'chat-links-changed') {
|
|
192
|
+
try { chatLinksChanged?.(); } catch (error) { try { win.console?.error?.('[model-panel] chat links refresh failed', error); } catch { /* reporting must not throw */ } }
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
187
195
|
if (data.type !== 'action' || typeof data.requestId !== 'string') return;
|
|
188
196
|
if (data.action === 'select' && typeof data.entityId === 'string') {
|
|
189
197
|
let ok = false;
|
|
@@ -223,6 +231,10 @@ export function createModelPanelBridge({ win = window, origin = location.origin,
|
|
|
223
231
|
publishSelection,
|
|
224
232
|
// Ask the main window to show one of the snapshot's tabs — what a toolbar button that opens a tab does.
|
|
225
233
|
reveal: (tab) => lifecycle === 'ready' && send({ type: 'reveal', tab }),
|
|
234
|
+
// Ask the main window to open one AI Chat conversation at one message — an object card's Show in chat. The
|
|
235
|
+
// project is carried so the main window refuses rather than asking for the conversation in another scope.
|
|
236
|
+
openChat: (chatId, messageEventId, projectId) => typeof chatId === 'string' && typeof messageEventId === 'string'
|
|
237
|
+
&& typeof projectId === 'string' && !!projectId && send({ type: 'open-chat', chatId, messageEventId, projectId }),
|
|
226
238
|
ready(key) { lifecycle = 'ready'; datasetKey = key; publishSnapshot(); },
|
|
227
239
|
failed(message) { lifecycle = 'failed'; datasetKey = null; publishStatus(message); },
|
|
228
240
|
dispose() { if (disposed) return; disposed = true; requested = false; win.removeEventListener('message', receive); },
|
|
@@ -954,6 +954,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
|
|
|
954
954
|
mountContext = context;
|
|
955
955
|
inputArbiter = mountCadInputArbiter({
|
|
956
956
|
surface: canvas, controls, orbitInput, getCamera: () => camera, pickPoint: pickSurface, applyView,
|
|
957
|
+
fitAll: () => controller.fitAll(),
|
|
957
958
|
fitSelection: () => fit(ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId))),
|
|
958
959
|
isActive: () => mounted && shown && paintAllowed && canvas.offsetParent !== null,
|
|
959
960
|
plugin: selectionInputProxy,
|
|
@@ -481,8 +481,6 @@ export function mountToolbarChrome({ toolbar, getItems = defaultItems, port = nu
|
|
|
481
481
|
const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;
|
|
482
482
|
let next = null;
|
|
483
483
|
if (step) next = (at + step + items.length) % items.length;
|
|
484
|
-
else if (e.key === 'Home') next = 0;
|
|
485
|
-
else if (e.key === 'End') next = items.length - 1;
|
|
486
484
|
if (next === null) return;
|
|
487
485
|
e.preventDefault();
|
|
488
486
|
e.stopPropagation(); // a host may bind arrow keys globally too; without this the camera pans as well
|
package/dist/web/revit-editor.js
CHANGED
|
@@ -27,8 +27,6 @@ import { createModelPanelBridge, createModelSelectionOriginGuard, createPanelHos
|
|
|
27
27
|
const $ = (id) => document.getElementById(id);
|
|
28
28
|
const projectId = new URLSearchParams(location.search).get('project') || '';
|
|
29
29
|
let entities = [], properties = [], relationships = [], entityById = new Map(), propertyByEntity = new Map(), selectedId = null, selectedIds = [], selectionOrigin = 'tree', classificationFollowedId = null, facade = null, viewport = null, inspector = null;
|
|
30
|
-
let measureTool = null;
|
|
31
|
-
let cadTools = null;
|
|
32
30
|
let selectionTools = null;
|
|
33
31
|
let selectionFilterChrome = null;
|
|
34
32
|
let spatialTools = null;
|
|
@@ -745,10 +743,10 @@ function mountSharedModelTools() {
|
|
|
745
743
|
},
|
|
746
744
|
});
|
|
747
745
|
own(() => dock.destroy());
|
|
748
|
-
|
|
749
|
-
sharedTools = { destroy() { if (destroyed) return; destroyed = true; rollback();
|
|
746
|
+
selectionTools = nextSelectionTools; selectionFilterChrome = nextSelectionFilterChrome;
|
|
747
|
+
sharedTools = { destroy() { if (destroyed) return; destroyed = true; rollback(); selectionTools = null; selectionFilterChrome = null; } };
|
|
750
748
|
} catch (error) {
|
|
751
|
-
destroyed = true; rollback();
|
|
749
|
+
destroyed = true; rollback(); selectionTools = null; selectionFilterChrome = null; sharedTools = null; throw error;
|
|
752
750
|
}
|
|
753
751
|
}
|
|
754
752
|
|
|
@@ -823,7 +821,7 @@ function disposeEditor() {
|
|
|
823
821
|
const facadeOwnsViewport = !!facade;
|
|
824
822
|
facade?.dispose();
|
|
825
823
|
if (!facadeOwnsViewport) viewport?.dispose();
|
|
826
|
-
facade = null; viewport = null;
|
|
824
|
+
facade = null; viewport = null; selectionTools = null;
|
|
827
825
|
}
|
|
828
826
|
|
|
829
827
|
window.addEventListener('pagehide', (event) => {
|