@floless/app 0.155.1 → 0.155.2

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.
@@ -99,6 +99,8 @@ export function modelSelectionHitsInMarquee(hits, rect) {
99
99
  function prevent(event) { event?.preventDefault?.(); }
100
100
  function pointer(event) { return { x: Number(event?.clientX), y: Number(event?.clientY) }; }
101
101
  function toggles(event) { return event?.ctrlKey === true || event?.metaKey === true || event?.shiftKey === true; }
102
+ function selectionOperation(event) { return event?.ctrlKey === true || event?.metaKey === true ? 'toggle' : event?.shiftKey === true ? 'add' : 'replace'; }
103
+ function conflictingModifiers(event) { return (event?.ctrlKey === true || event?.metaKey === true) && event?.shiftKey === true; }
102
104
 
103
105
  /**
104
106
  * @param {{
@@ -113,6 +115,9 @@ function toggles(event) { return event?.ctrlKey === true || event?.metaKey === t
113
115
  * filterHit?: (hit: any, filters: any) => boolean,
114
116
  * generationToken?: () => any,
115
117
  * hierarchy?: null|((direction: string, entries: any[]) => any[]),
118
+ * resolveSelection?: null|((hits:any[], context:{event:any,origin:string,operation:string,eligibleHits:(hits:any[])=>any[]})=>boolean),
119
+ * onHierarchyDoubleClick?: null|((hit:any, context:{event:any,origin:string})=>boolean),
120
+ * clearSelection?: null|((origin:string)=>any),
116
121
  * initialFilters?: Record<string, any>,
117
122
  * dragThreshold?: number,
118
123
  * cycleRadius?: number,
@@ -130,17 +135,23 @@ export function createModelSelectionTools({
130
135
  filterHit = () => true,
131
136
  generationToken = () => null,
132
137
  hierarchy = null,
138
+ resolveSelection = null,
139
+ onHierarchyDoubleClick = null,
140
+ clearSelection = null,
133
141
  initialFilters = {},
134
142
  dragThreshold = 5,
135
143
  cycleRadius = 3,
136
144
  } = {}) {
137
- if (!coordinator || !['replaceAll', 'toggle', 'clear', 'entries'].every((name) => typeof coordinator[name] === 'function')) {
145
+ if (!coordinator || !['replaceAll', 'add', 'toggle', 'clear', 'entries'].every((name) => typeof coordinator[name] === 'function')) {
138
146
  throw new Error('Model selection tools need a model-selection-coordinator.');
139
147
  }
140
148
  for (const [name, value] of Object.entries({ hitsAt, allHits, onHover, onMarquee, fitSelection, cancelActiveTool, filterHit, generationToken })) {
141
149
  if (typeof value !== 'function') throw new TypeError(`Model selection tools: ${name} must be a function.`);
142
150
  }
143
151
  if (marqueeHits !== null && typeof marqueeHits !== 'function') throw new TypeError('Model selection tools: marqueeHits must be a function or null.');
152
+ if (resolveSelection !== null && typeof resolveSelection !== 'function') throw new TypeError('Model selection tools: resolveSelection must be a function or null.');
153
+ if (onHierarchyDoubleClick !== null && typeof onHierarchyDoubleClick !== 'function') throw new TypeError('Model selection tools: onHierarchyDoubleClick must be a function or null.');
154
+ if (clearSelection !== null && typeof clearSelection !== 'function') throw new TypeError('Model selection tools: clearSelection must be a function or null.');
144
155
  if (!finite(dragThreshold) || dragThreshold < 0 || !finite(cycleRadius) || cycleRadius < 0) throw new TypeError('Model selection thresholds must be non-negative.');
145
156
 
146
157
  let filters = normalizeFacetFilters(initialFilters);
@@ -148,12 +159,22 @@ export function createModelSelectionTools({
148
159
  const filterListeners = new Set();
149
160
  const notifyFilters = () => { const state = filters; for (const listener of filterListeners) listener(state); };
150
161
  const candidates = (hits) => selectableHits(hits, filters, generationToken, filterHit);
162
+ const semanticCandidates = (hits) => resolveSelection
163
+ ? selectableHits(hits, {}, generationToken, () => true)
164
+ : candidates(hits);
151
165
  const at = (event) => visibleHits(hitsAt(pointer(event), event));
152
166
  const sameEntity = (a, b) => a?.kind === b?.kind && a?.sourceId === b?.sourceId;
153
167
  const isSelected = (entity) => coordinator.entries().some((entry) => sameEntity(entry, entity));
154
- const commit = (entities, event, origin) => {
155
- if (toggles(event)) return coordinator.toggle(entities, origin);
156
- return coordinator.replaceAll(entities, origin);
168
+ const clear = clearSelection ?? ((origin) => coordinator.clear(origin));
169
+ const commitHits = (hits, event, origin, operation = selectionOperation(event)) => {
170
+ if (resolveSelection?.(hits, { event, origin, operation, eligibleHits: candidates }) === true) return true;
171
+ const eligible = candidates(hits);
172
+ if (!eligible.length) return false;
173
+ const entities = eligible.map(entityOf);
174
+ if (operation === 'toggle') coordinator.toggle(entities, origin);
175
+ else if (operation === 'add') coordinator.add(entities, origin);
176
+ else coordinator.replaceAll(entities, origin);
177
+ return true;
157
178
  };
158
179
  const setHover = (next) => {
159
180
  if (hover === next) return;
@@ -163,22 +184,25 @@ export function createModelSelectionTools({
163
184
  const resetCycle = () => { cycle = null; };
164
185
 
165
186
  const chooseAt = (event) => {
166
- const raw = at(event); const eligible = candidates(raw);
187
+ const raw = at(event); const eligible = semanticCandidates(raw);
167
188
  if (!eligible.length) {
168
189
  resetCycle();
169
- if (!raw.length && !toggles(event)) coordinator.clear('mesh');
190
+ if (!raw.length && !toggles(event)) clear('mesh');
170
191
  return frozen({ handled: true, rawVisible: raw.length, selected: null });
171
192
  }
172
193
  const p = pointer(event); const fingerprint = eligible.map(entityToken).join('|');
173
194
  const continuing = cycle && cycle.fingerprint === fingerprint && Math.hypot(p.x - cycle.x, p.y - cycle.y) <= cycleRadius;
174
195
  const index = continuing ? (cycle.index + 1) % eligible.length : 0;
175
196
  const hit = eligible[index]; cycle = { fingerprint, x: p.x, y: p.y, index };
176
- commit([entityOf(hit)], event, 'mesh');
197
+ commitHits([hit], event, 'mesh');
177
198
  return frozen({ handled: true, rawVisible: raw.length, selected: hit, overlapIndex: index, overlapCount: eligible.length });
178
199
  };
179
200
 
180
201
  const finishMarquee = (event) => {
181
202
  if (!gesture?.active) return false;
203
+ if (event?.altKey === true || conflictingModifiers(event)) {
204
+ gesture = null; suppressClick = true; onMarquee(null); resetCycle(); prevent(event); return true;
205
+ }
182
206
  const rect = marqueeRect(gesture.start, pointer(event));
183
207
  // Providers may pre-query candidates, but the common layer remains the authority for LTR/RTL
184
208
  // geometry whenever projected bounds are present. A returned record without bounds is already
@@ -187,15 +211,16 @@ export function createModelSelectionTools({
187
211
  const raw = reported
188
212
  ? reported.filter((hit) => !screenBounds(hit) || modelSelectionHitsInMarquee([hit], rect).length === 1)
189
213
  : modelSelectionHitsInMarquee(allHits(), rect);
190
- const eligible = candidates(raw);
191
- if (eligible.length) commit(eligible.map(entityOf), event, 'mesh');
192
- else if (!raw.length && !toggles(event)) coordinator.clear('mesh');
214
+ const eligible = semanticCandidates(raw);
215
+ if (eligible.length) commitHits(eligible, event, 'mesh');
216
+ else if (!raw.length && !toggles(event)) clear('mesh');
193
217
  gesture = null; suppressClick = true; onMarquee(null); resetCycle(); prevent(event); return true;
194
218
  };
195
219
 
196
220
  const interceptor = frozen({
197
221
  pointerDown(event) {
198
222
  if (destroyed || event.defaultPrevented || event.button !== 0) return false;
223
+ if (event.altKey === true) return false;
199
224
  const p = pointer(event); if (!finite(p.x) || !finite(p.y)) return false;
200
225
  // If the preceding drag released outside the surface, the browser emitted no click to consume
201
226
  // suppression. A genuinely new pointer sequence must never lose its eventual click.
@@ -211,7 +236,7 @@ export function createModelSelectionTools({
211
236
  if (!gesture.active && Math.hypot(p.x - gesture.start.x, p.y - gesture.start.y) > dragThreshold) gesture.active = true;
212
237
  if (gesture.active) { onMarquee(marqueeRect(gesture.start, p)); prevent(event); return true; }
213
238
  }
214
- setHover(candidates(at(event))[0] ?? null); return false;
239
+ setHover(semanticCandidates(at(event))[0] ?? null); return false;
215
240
  },
216
241
  pointerLeave() { if (!gesture?.active) setHover(null); return false; },
217
242
  pointerCancel(event) {
@@ -229,27 +254,37 @@ export function createModelSelectionTools({
229
254
  if (suppressClick) { suppressClick = false; prevent(event); return true; }
230
255
  gesture = null;
231
256
  if (Number(event.detail) > 1) { prevent(event); return true; }
257
+ if (conflictingModifiers(event)) { prevent(event); resetCycle(); return true; }
258
+ if (event.altKey === true && (event.ctrlKey === true || event.metaKey === true || event.shiftKey === true)) return false;
232
259
  const result = chooseAt(event); prevent(event); return result;
233
260
  },
234
261
  doubleClick(event) {
235
262
  if (destroyed) return false;
236
- const raw = at(event); const hit = candidates(raw)[0];
263
+ if (event.altKey === true) return false;
264
+ if (conflictingModifiers(event)) { prevent(event); resetCycle(); return true; }
265
+ const raw = at(event); const hit = semanticCandidates(raw)[0];
237
266
  if (!hit) { if (raw.length) prevent(event); return false; }
238
- const entity = entityOf(hit); if (!isSelected(entity)) coordinator.replaceAll([entity], 'mesh');
239
- fitSelection(); prevent(event); return true;
267
+ if (event.ctrlKey === true || event.metaKey === true || event.shiftKey === true) {
268
+ commitHits([hit], event, 'mesh'); prevent(event); return true;
269
+ }
270
+ if (onHierarchyDoubleClick?.(hit, { event, origin: 'mesh' }) === true) { prevent(event); return true; }
271
+ const entity = entityOf(hit); const committed = isSelected(entity) || commitHits([hit], event, 'mesh', 'replace');
272
+ if (committed) fitSelection(); prevent(event); return true;
240
273
  },
241
274
  keyDown(event) {
242
275
  if (destroyed || event.defaultPrevented || editable(event.target)) return false;
276
+ if (conflictingModifiers(event) && String(event.key).toLowerCase() === 'a') { prevent(event); resetCycle(); return true; }
243
277
  if ((event.ctrlKey || event.metaKey) && !event.altKey && String(event.key).toLowerCase() === 'a') {
244
- const raw = visibleHits(allHits()); const eligible = candidates(raw);
245
- if (eligible.length || !raw.length) coordinator.replaceAll(eligible.map(entityOf), 'mesh');
278
+ const raw = visibleHits(allHits()); const eligible = semanticCandidates(raw);
279
+ if (eligible.length) commitHits(eligible, event, 'mesh', 'replace');
280
+ else if (!raw.length) clear('mesh');
246
281
  prevent(event); resetCycle(); return true;
247
282
  }
248
283
  if (event.key !== 'Escape') return false;
249
284
  if (cancelActiveTool()) { prevent(event); return true; }
250
285
  if (gesture?.active) { gesture = null; suppressClick = true; onMarquee(null); prevent(event); return true; }
251
286
  if (hover) { setHover(null); prevent(event); return true; }
252
- if (coordinator.entries().length) { coordinator.clear('mesh'); prevent(event); return true; }
287
+ if (coordinator.entries().length) { clear('mesh'); prevent(event); return true; }
253
288
  return false;
254
289
  },
255
290
  windowBlur() {
@@ -275,6 +310,7 @@ export function createModelSelectionTools({
275
310
  capabilities: () => capabilities,
276
311
  commandInventory: () => commands,
277
312
  filters: () => filters,
313
+ eligibleHits: (hits) => candidates(hits),
278
314
  setFilters(next) { filters = normalizeFacetFilters(next); resetCycle(); setHover(null); notifyFilters(); return filters; },
279
315
  setFacet(name, values) { filters = normalizeFacetFilters({ ...filters, [name]: values }); resetCycle(); setHover(null); notifyFilters(); return filters; },
280
316
  subscribeFilters(listener) {
@@ -1,4 +1,33 @@
1
1
  export const TEKLA_GEOMETRY_SELECTION_CAP = 5000;
2
+ export const TEKLA_SELECTION_SCOPE_KEY = 'floless:tekla-parser:selection-scopes:v1';
3
+ export const TEKLA_DEFAULT_SELECTION_SCOPES = Object.freeze({ connection: 'group', assembly: 'group' });
4
+
5
+ export function readTeklaSelectionScopes(storage) {
6
+ try {
7
+ const value = JSON.parse(storage?.getItem?.(TEKLA_SELECTION_SCOPE_KEY) || 'null');
8
+ if (value && ['group', 'objects'].includes(value.connection) && ['group', 'objects'].includes(value.assembly)) return Object.freeze({ connection: value.connection, assembly: value.assembly });
9
+ } catch {}
10
+ return TEKLA_DEFAULT_SELECTION_SCOPES;
11
+ }
12
+
13
+ export function writeTeklaSelectionScopes(storage, value) {
14
+ if (!value || !['group', 'objects'].includes(value.connection) || !['group', 'objects'].includes(value.assembly)) throw new TypeError('Tekla selection scopes must be group or objects.');
15
+ storage?.setItem?.(TEKLA_SELECTION_SCOPE_KEY, JSON.stringify(value)); return Object.freeze({ connection: value.connection, assembly: value.assembly });
16
+ }
17
+
18
+ export function changeTeklaSelectionScope({ storage, navigator, current, axis, value }) {
19
+ if (!['connection', 'assembly'].includes(axis) || !['group', 'objects'].includes(value)) return Object.freeze({ changed: false, scopes: current });
20
+ const before = navigator?.state?.();
21
+ if (current?.[axis] === value && !before?.drillStack?.length) return Object.freeze({ changed: false, scopes: current });
22
+ let exitedDrill = false;
23
+ while (navigator?.state?.().drillStack?.length) { navigator.ascend(); exitedDrill = true; }
24
+ const scopes = writeTeklaSelectionScopes(storage, { ...current, [axis]: value });
25
+ const after = navigator?.state?.();
26
+ if (before && after && (JSON.stringify(before.selectedItems) !== JSON.stringify(after.selectedItems) || JSON.stringify(before.geometryIds) !== JSON.stringify(after.geometryIds))) {
27
+ throw new Error('Changing selection scope must not reinterpret the current selection.');
28
+ }
29
+ return Object.freeze({ changed: true, scopes, exitedDrill });
30
+ }
2
31
 
3
32
  /**
4
33
  * Resolve only supplied geometry and authenticated membership; labels never imply membership.
@@ -20,13 +49,57 @@ export function teklaGeometrySelection(ids, entityById, membersByAssembly = new
20
49
  return [...selected];
21
50
  }
22
51
 
23
- /** The verifier admits `contains` only for a native assembly → native part membership. */
52
+ /** The verifier exposes legacy `contains` and native-v2 assembly membership explicitly. */
24
53
  export function teklaAssemblyMembership(relationships) {
25
54
  const members = new Map();
26
55
  for (const relationship of relationships || []) {
27
- if (relationship.kind !== 'contains') continue;
56
+ if (relationship.kind !== 'contains'
57
+ && !(relationship.kind === 'provider-explicit' && relationship.providerRelationKind === 'tekla-assembly-member')) continue;
28
58
  const ids = members.get(relationship.from) || [];
29
59
  ids.push(relationship.to); members.set(relationship.from, ids);
30
60
  }
31
61
  return members;
32
62
  }
63
+
64
+ /** Build only verifier-authenticated native-v2 hierarchy edges; labels never create ancestry. */
65
+ export function teklaHierarchyIndexes(entities, relationships) {
66
+ const byId = new Map((entities || []).map((entity) => [String(entity.id), entity]));
67
+ const children = new Map(); const parents = { connection: new Map(), assembly: new Map() };
68
+ const append = (map, key, value) => { const values = map.get(key) || []; if (!values.includes(value)) values.push(value); map.set(key, values); };
69
+ for (const relationship of relationships || []) {
70
+ if (relationship.kind !== 'provider-explicit') continue;
71
+ const axis = relationship.providerRelationKind === 'tekla-component-child' ? 'connection'
72
+ : relationship.providerRelationKind === 'tekla-assembly-member' ? 'assembly' : null;
73
+ if (!axis) continue;
74
+ const from = String(relationship.from); const to = String(relationship.to);
75
+ if (byId.get(from)?.hierarchyContract !== 'tekla-hierarchy/v1' || byId.get(to)?.hierarchyContract !== 'tekla-hierarchy/v1') continue;
76
+ append(children, from, to); append(parents[axis], to, from);
77
+ }
78
+ // The verifier-derived main part is presentation order, never inferred hierarchy authority.
79
+ for (const [groupId, memberIds] of children) {
80
+ const entity = byId.get(groupId); const main = Number.isInteger(entity?.assemblyMainPartId) ? `element:${entity.assemblyMainPartId}` : entity?.assemblyMainPartId;
81
+ if (!main) continue;
82
+ const index = memberIds.indexOf(String(main));
83
+ if (index > 0) memberIds.unshift(...memberIds.splice(index, 1));
84
+ }
85
+ const ancestors = (id, axis) => {
86
+ const out = []; const seen = new Set();
87
+ let frontier = [...(parents.connection.get(String(id)) || []), ...(parents.assembly.get(String(id)) || [])];
88
+ while (frontier.length) {
89
+ const parent = frontier.shift(); if (seen.has(parent)) continue;
90
+ seen.add(parent);
91
+ const kind = byId.get(parent)?.nativeKind;
92
+ if ((axis === 'assembly' && kind === 'Assembly') || (axis === 'connection' && (kind === 'Component' || kind === 'Connection'))) out.push(parent);
93
+ frontier = [...(parents.connection.get(parent) || []), ...(parents.assembly.get(parent) || []), ...frontier];
94
+ }
95
+ return out.reverse(); // highest authenticated ancestor first
96
+ };
97
+ return Object.freeze({
98
+ children,
99
+ groupKind(id) {
100
+ const kind = byId.get(String(id))?.nativeKind;
101
+ return kind === 'Assembly' ? 'assembly' : (kind === 'Component' || kind === 'Connection') ? 'connection' : null;
102
+ },
103
+ candidates(id) { return Object.freeze({ connection: Object.freeze(ancestors(id, 'connection')), assembly: Object.freeze(ancestors(id, 'assembly')) }); },
104
+ });
105
+ }
@@ -504,7 +504,8 @@ export function applyRevitDisplayMode(meshes, next, presentation = {}) {
504
504
  const selectedIds = new Set(presentation.selectedIds ?? []);
505
505
  const ghostActive = presentation.ghostUnselected === true && selectedIds.size > 0;
506
506
  const wire = next === 'wire';
507
- const hoveredId = typeof presentation.hoveredId === 'string' ? presentation.hoveredId : null;
507
+ const hoveredIds = new Set(Array.isArray(presentation.hoveredIds) ? presentation.hoveredIds
508
+ : typeof presentation.hoveredId === 'string' ? [presentation.hoveredId] : []);
508
509
  const materials = presentation.edgeMaterials ?? null;
509
510
  for (const mesh of meshes) {
510
511
  const material = mesh.material;
@@ -539,7 +540,7 @@ export function applyRevitDisplayMode(meshes, next, presentation = {}) {
539
540
  outline.visible = wire;
540
541
  if (wire && materials) {
541
542
  const chosen = selectedIds.has(mesh.userData.entityId);
542
- const hovered = hoveredId === mesh.userData.entityId;
543
+ const hovered = hoveredIds.has(mesh.userData.entityId);
543
544
  // Selected outranks hovered, and this ternary is the ONLY place that says so — guarding
544
545
  // `hovered` with `!chosen` as well would state the precedence twice, which leaves each copy
545
546
  // free to rot without a test noticing.
@@ -638,7 +639,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
638
639
  perspective.up.set(0, 0, 1); orthographic.up.set(0, 0, 1);
639
640
  perspective.position.set(1, -1, 1); orthographic.position.copy(perspective.position);
640
641
  perspective.lookAt(0, 0, 0); orthographic.lookAt(0, 0, 0);
641
- let camera = perspective; let model = null; let modelDisposer = null; let meshes = []; let ownedMeshes = []; let mode = 'solid'; let selected = []; let hoveredId = null; let ghostUnselected = false; let disposed = false; let mounted = false; let shown = false; let paintAllowed = false; let orthoSpan = 10; let geometryFrame = revitGeometryFrame();
642
+ let camera = perspective; let model = null; let modelDisposer = null; let meshes = []; let ownedMeshes = []; let mode = 'solid'; let selected = []; let hoveredIds = []; let ghostUnselected = false; let disposed = false; let mounted = false; let shown = false; let paintAllowed = false; let orthoSpan = 10; let geometryFrame = revitGeometryFrame();
642
643
  let mountContext = null; let inputArbiter = null; let releaseClipInput = null; let releaseClipOverlayInput = null; let pendingLoad = null; let loadSequence = 0; let controller = null;
643
644
  let spatialTools = null; let releaseSpatial = null; let spatialState = null; let workPlaneHelper = null;
644
645
  let structuralGrid = null; let structuralGridReceipt = null; let structuralGridOwnerId = null;
@@ -986,15 +987,19 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
986
987
  function paintSelection(items, ids) {
987
988
  const eligible = ids.filter((id) => items.some((mesh) => mesh.userData.entityId === id && hasVisibleFragment(mesh)));
988
989
  const set = new Set(eligible);
989
- applyRevitDisplayMode(items, mode, { selectedIds: eligible, ghostUnselected, hoveredId, edgeMaterials });
990
+ const hoverSet = new Set(hoveredIds);
991
+ applyRevitDisplayMode(items, mode, { selectedIds: eligible, ghostUnselected, hoveredIds, edgeMaterials });
990
992
  items.forEach((mesh) => {
991
- const chosen = set.has(mesh.userData.entityId); const hovered = !chosen && hoveredId === mesh.userData.entityId;
993
+ const chosen = set.has(mesh.userData.entityId); const hovered = !chosen && hoverSet.has(mesh.userData.entityId);
992
994
  mesh.material.emissive?.set(chosen ? 0x2563eb : hovered ? 0x0ea5e9 : 0x000000);
993
995
  mesh.material.emissiveIntensity = chosen ? .65 : hovered ? .34 : 0;
994
996
  });
995
997
  }
996
998
  function reflectSelection(ids) { selected = [...ids]; paintSelection(ownedMeshes, ids); }
997
- function reflectHover(id) { hoveredId = typeof id === 'string' ? id : null; paintSelection(ownedMeshes, selected); }
999
+ function reflectHover(value) {
1000
+ hoveredIds = [...new Set((Array.isArray(value) ? value : typeof value === 'string' ? [value] : []).filter((id) => typeof id === 'string'))];
1001
+ paintSelection(ownedMeshes, selected);
1002
+ }
998
1003
  function display(next) {
999
1004
  mode = next;
1000
1005
  if (mode === 'wire') ensureOutlines(); else outlineJob?.stop();
@@ -1089,13 +1094,13 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1089
1094
  canonicalToRenderPoint: (point) => geometryFrame.canonicalToRenderPoint(point) });
1090
1095
  baseVisibility = new Map(ownedMeshes.map((mesh) => [mesh, true])); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null;
1091
1096
  modelDisposer = next.dispose;
1092
- snapIndex = nextSnapIndex; selected = []; hoveredId = null; applyRealistic(); if (spatialState) paintSpatialState(spatialState); clipOverlay.render();
1097
+ snapIndex = nextSnapIndex; selected = []; hoveredIds = []; applyRealistic(); if (spatialState) paintSpatialState(spatialState); clipOverlay.render();
1093
1098
  // The staged generation is only live from here, so the outline build starts now —
1094
1099
  // not at the applyRevitDisplayMode above, which still ran against a staged scene.
1095
1100
  cancelOutlineJob(); sceneGeneration += 1; ensureOutlines();
1096
1101
  },
1097
1102
  onRelease() {
1098
- if (model === next.root) { cancelOutlineJob(); model = null; modelDisposer = null; meshes = []; ownedMeshes = []; hoveredId = null; baseVisibility.clear(); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null; snapIndex = buildModelSnapIndex([]); structuralGridView.clear(); structuralGrid = null; structuralGridReceipt = null; structuralGridOwnerId = null; }
1103
+ if (model === next.root) { cancelOutlineJob(); model = null; modelDisposer = null; meshes = []; ownedMeshes = []; hoveredIds = []; baseVisibility.clear(); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null; snapIndex = buildModelSnapIndex([]); structuralGridView.clear(); structuralGrid = null; structuralGridReceipt = null; structuralGridOwnerId = null; }
1099
1104
  },
1100
1105
  });
1101
1106
  // A structural grid is drawn from its own record, so a Tekla read with no drawn object but a grid
@@ -1134,7 +1139,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1134
1139
  spatialTools.replaceSections({ clips: value?.clipping ?? value?.clips ?? [], workArea: value?.workArea ?? null });
1135
1140
  },
1136
1141
  applyPresentation({ selectedKeys = [], hoverKey = null, ghostUnselected: ghost = false }) {
1137
- ghostUnselected = ghost === true; hoveredId = idsForKeys(hoverKey ? [hoverKey] : [])[0] ?? null;
1142
+ ghostUnselected = ghost === true; hoveredIds = idsForKeys(hoverKey ? [hoverKey] : []);
1138
1143
  reflectSelection(idsForKeys(selectedKeys));
1139
1144
  structuralGridView.applyPaint({ selectedIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [],
1140
1145
  ghost: { active: ghostUnselected && selected.length > 0, focusIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [], opacity: .18 } });