@asyra/preset 0.5.8 → 0.6.1
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/CHANGELOG.md +28 -0
- package/README.md +2 -2
- package/dist/agent-activity.d.ts +61 -0
- package/dist/agent-activity.d.ts.map +1 -0
- package/dist/agent-activity.js +224 -0
- package/dist/agent-activity.js.map +1 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +2 -2
- package/dist/catalog.js.map +1 -1
- package/dist/cleanup-reporter.d.ts.map +1 -1
- package/dist/cleanup-reporter.js.map +1 -1
- package/dist/components/fills.d.ts +3 -1
- package/dist/components/fills.d.ts.map +1 -1
- package/dist/components/fills.js +74 -0
- package/dist/components/fills.js.map +1 -1
- package/dist/components/frame.d.ts +2 -2
- package/dist/components/frame.d.ts.map +1 -1
- package/dist/components/frame.js +1 -0
- package/dist/components/frame.js.map +1 -1
- package/dist/components/group.d.ts +9 -21
- package/dist/components/group.d.ts.map +1 -1
- package/dist/components/group.js +193 -86
- package/dist/components/group.js.map +1 -1
- package/dist/components/oval.d.ts +2 -2
- package/dist/components/oval.d.ts.map +1 -1
- package/dist/components/oval.js +3 -1
- package/dist/components/oval.js.map +1 -1
- package/dist/components/rectangle.d.ts +2 -2
- package/dist/components/rectangle.d.ts.map +1 -1
- package/dist/components/rectangle.js +3 -1
- package/dist/components/rectangle.js.map +1 -1
- package/dist/components/shape-hit-area.d.ts.map +1 -1
- package/dist/components/shape-hit-area.js.map +1 -1
- package/dist/components/text.d.ts +9 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +61 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/vector-compound-fill.d.ts +8 -0
- package/dist/components/vector-compound-fill.d.ts.map +1 -0
- package/dist/components/vector-compound-fill.js +149 -0
- package/dist/components/vector-compound-fill.js.map +1 -0
- package/dist/components/vector.d.ts.map +1 -1
- package/dist/components/vector.js +85 -565
- package/dist/components/vector.js.map +1 -1
- package/dist/composition/error.d.ts.map +1 -1
- package/dist/composition/error.js.map +1 -1
- package/dist/composition/profile-provider.d.ts +2 -1
- package/dist/composition/profile-provider.d.ts.map +1 -1
- package/dist/composition/profile-provider.js +8 -2
- package/dist/composition/profile-provider.js.map +1 -1
- package/dist/composition/resolve.d.ts +2 -0
- package/dist/composition/resolve.d.ts.map +1 -1
- package/dist/composition/resolve.js +30 -6
- package/dist/composition/resolve.js.map +1 -1
- package/dist/defaults/install.d.ts.map +1 -1
- package/dist/defaults/install.js +2 -1
- package/dist/defaults/install.js.map +1 -1
- package/dist/defaults/installation.d.ts.map +1 -1
- package/dist/defaults/installation.js +2 -0
- package/dist/defaults/installation.js.map +1 -1
- package/dist/defaults/modules/selection.d.ts.map +1 -1
- package/dist/defaults/modules/selection.js +1 -0
- package/dist/defaults/modules/selection.js.map +1 -1
- package/dist/defaults/modules/vector-editing.d.ts.map +1 -1
- package/dist/defaults/modules/vector-editing.js.map +1 -1
- package/dist/defaults/owned-state.d.ts.map +1 -1
- package/dist/defaults/owned-state.js.map +1 -1
- package/dist/defaults/private-manager.d.ts.map +1 -1
- package/dist/defaults/private-manager.js +2 -1
- package/dist/defaults/private-manager.js.map +1 -1
- package/dist/events/preset-event-names.d.ts +2 -0
- package/dist/events/preset-event-names.d.ts.map +1 -1
- package/dist/events/register-events.d.ts.map +1 -1
- package/dist/events/register-events.js +4 -2
- package/dist/events/register-events.js.map +1 -1
- package/dist/group-bounds.d.ts +36 -0
- package/dist/group-bounds.d.ts.map +1 -0
- package/dist/group-bounds.js +141 -0
- package/dist/group-bounds.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/preset.d.ts.map +1 -1
- package/dist/preset.js +5 -3
- package/dist/preset.js.map +1 -1
- package/dist/props/components/anchor-points-component.d.ts.map +1 -1
- package/dist/props/components/anchor-points-component.js.map +1 -1
- package/dist/props/components/children-map-property-component.d.ts.map +1 -1
- package/dist/props/components/children-map-property-component.js.map +1 -1
- package/dist/props/components/fills-component.d.ts.map +1 -1
- package/dist/props/components/fills-component.js +3 -2
- package/dist/props/components/fills-component.js.map +1 -1
- package/dist/props/components/position-component.js +1 -1
- package/dist/props/components/position-component.js.map +1 -1
- package/dist/props/components/strokes-component.d.ts.map +1 -1
- package/dist/props/components/strokes-component.js +4 -3
- package/dist/props/components/strokes-component.js.map +1 -1
- package/dist/props/components/text-component.d.ts +67 -0
- package/dist/props/components/text-component.d.ts.map +1 -0
- package/dist/props/components/text-component.js +128 -0
- package/dist/props/components/text-component.js.map +1 -0
- package/dist/props/components/vector-networks-component.d.ts.map +1 -1
- package/dist/props/components/vector-networks-component.js.map +1 -1
- package/dist/props/components/vector-points-component.d.ts.map +1 -1
- package/dist/props/components/vector-points-component.js.map +1 -1
- package/dist/props/components/vector-segments-component.d.ts.map +1 -1
- package/dist/props/components/vector-segments-component.js.map +1 -1
- package/dist/props/register-property-schemas.d.ts.map +1 -1
- package/dist/props/register-property-schemas.js +6 -0
- package/dist/props/register-property-schemas.js.map +1 -1
- package/dist/render-layers/selection-overlay-render-layer.d.ts +1 -0
- package/dist/render-layers/selection-overlay-render-layer.d.ts.map +1 -1
- package/dist/render-layers/selection-overlay-render-layer.js +9 -4
- package/dist/render-layers/selection-overlay-render-layer.js.map +1 -1
- package/dist/render-layers/vector-path-editing-render-layer.d.ts.map +1 -1
- package/dist/render-layers/vector-path-editing-render-layer.js.map +1 -1
- package/dist/selection/ids.d.ts.map +1 -1
- package/dist/selection/ids.js.map +1 -1
- package/dist/selection/register-default-selections.d.ts.map +1 -1
- package/dist/selection/register-default-selections.js +4 -2
- package/dist/selection/register-default-selections.js.map +1 -1
- package/dist/spatial/assets/binary.d.ts +22 -0
- package/dist/spatial/assets/binary.d.ts.map +1 -0
- package/dist/spatial/assets/binary.js +132 -0
- package/dist/spatial/assets/binary.js.map +1 -0
- package/dist/spatial/assets/decode.d.ts +23 -0
- package/dist/spatial/assets/decode.d.ts.map +1 -0
- package/dist/spatial/assets/decode.js +102 -0
- package/dist/spatial/assets/decode.js.map +1 -0
- package/dist/spatial/assets/preview-worker.d.ts +13 -0
- package/dist/spatial/assets/preview-worker.d.ts.map +1 -0
- package/dist/spatial/assets/preview-worker.js +188 -0
- package/dist/spatial/assets/preview-worker.js.map +1 -0
- package/dist/spatial/assets/scene.d.ts +13 -0
- package/dist/spatial/assets/scene.d.ts.map +1 -0
- package/dist/spatial/assets/scene.js +99 -0
- package/dist/spatial/assets/scene.js.map +1 -0
- package/dist/spatial/assets/schema.d.ts +22 -0
- package/dist/spatial/assets/schema.d.ts.map +1 -0
- package/dist/spatial/assets/schema.js +93 -0
- package/dist/spatial/assets/schema.js.map +1 -0
- package/dist/spatial/bounds.d.ts +15 -0
- package/dist/spatial/bounds.d.ts.map +1 -0
- package/dist/spatial/bounds.js +94 -0
- package/dist/spatial/bounds.js.map +1 -0
- package/dist/spatial/camera-controls.d.ts +53 -0
- package/dist/spatial/camera-controls.d.ts.map +1 -0
- package/dist/spatial/camera-controls.js +208 -0
- package/dist/spatial/camera-controls.js.map +1 -0
- package/dist/spatial/components.d.ts +20 -0
- package/dist/spatial/components.d.ts.map +1 -0
- package/dist/spatial/components.js +83 -0
- package/dist/spatial/components.js.map +1 -0
- package/dist/spatial/editing.d.ts +51 -0
- package/dist/spatial/editing.d.ts.map +1 -0
- package/dist/spatial/editing.js +152 -0
- package/dist/spatial/editing.js.map +1 -0
- package/dist/spatial/emissive-bloom.d.ts +22 -0
- package/dist/spatial/emissive-bloom.d.ts.map +1 -0
- package/dist/spatial/emissive-bloom.js +197 -0
- package/dist/spatial/emissive-bloom.js.map +1 -0
- package/dist/spatial/graphics.d.ts +9 -0
- package/dist/spatial/graphics.d.ts.map +1 -0
- package/dist/spatial/graphics.js +119 -0
- package/dist/spatial/graphics.js.map +1 -0
- package/dist/spatial/lazy-engine.d.ts +6 -0
- package/dist/spatial/lazy-engine.d.ts.map +1 -0
- package/dist/spatial/lazy-engine.js +92 -0
- package/dist/spatial/lazy-engine.js.map +1 -0
- package/dist/spatial/lighting.d.ts +28 -0
- package/dist/spatial/lighting.d.ts.map +1 -0
- package/dist/spatial/lighting.js +103 -0
- package/dist/spatial/lighting.js.map +1 -0
- package/dist/spatial/opaque-frame.d.ts +11 -0
- package/dist/spatial/opaque-frame.d.ts.map +1 -0
- package/dist/spatial/opaque-frame.js +131 -0
- package/dist/spatial/opaque-frame.js.map +1 -0
- package/dist/spatial/pose.d.ts +22 -0
- package/dist/spatial/pose.d.ts.map +1 -0
- package/dist/spatial/pose.js +83 -0
- package/dist/spatial/pose.js.map +1 -0
- package/dist/spatial/presentation.d.ts +16 -0
- package/dist/spatial/presentation.d.ts.map +1 -0
- package/dist/spatial/presentation.js +66 -0
- package/dist/spatial/presentation.js.map +1 -0
- package/dist/spatial/reflection-environment.d.ts +13 -0
- package/dist/spatial/reflection-environment.d.ts.map +1 -0
- package/dist/spatial/reflection-environment.js +63 -0
- package/dist/spatial/reflection-environment.js.map +1 -0
- package/dist/spatial/registration.d.ts +6 -0
- package/dist/spatial/registration.d.ts.map +1 -0
- package/dist/spatial/registration.js +82 -0
- package/dist/spatial/registration.js.map +1 -0
- package/dist/spatial/shadow-frame.d.ts +13 -0
- package/dist/spatial/shadow-frame.d.ts.map +1 -0
- package/dist/spatial/shadow-frame.js +60 -0
- package/dist/spatial/shadow-frame.js.map +1 -0
- package/dist/spatial/spatial-contract.d.ts +10 -0
- package/dist/spatial/spatial-contract.d.ts.map +1 -0
- package/dist/spatial/spatial-contract.js +414 -0
- package/dist/spatial/spatial-contract.js.map +1 -0
- package/dist/spatial/spatial-layer.d.ts +47 -0
- package/dist/spatial/spatial-layer.d.ts.map +1 -0
- package/dist/spatial/spatial-layer.js +224 -0
- package/dist/spatial/spatial-layer.js.map +1 -0
- package/dist/spatial/surface-contract.d.ts +4 -0
- package/dist/spatial/surface-contract.d.ts.map +1 -0
- package/dist/spatial/surface-contract.js +40 -0
- package/dist/spatial/surface-contract.js.map +1 -0
- package/dist/spatial/surface-textures.d.ts +8 -0
- package/dist/spatial/surface-textures.d.ts.map +1 -0
- package/dist/spatial/surface-textures.js +46 -0
- package/dist/spatial/surface-textures.js.map +1 -0
- package/dist/spatial/three-engine.d.ts +91 -0
- package/dist/spatial/three-engine.d.ts.map +1 -0
- package/dist/spatial/three-engine.js +1127 -0
- package/dist/spatial/three-engine.js.map +1 -0
- package/dist/spatial/transmission-capture.d.ts +13 -0
- package/dist/spatial/transmission-capture.d.ts.map +1 -0
- package/dist/spatial/transmission-capture.js +215 -0
- package/dist/spatial/transmission-capture.js.map +1 -0
- package/dist/spatial-assets.d.ts +4 -0
- package/dist/spatial-assets.d.ts.map +1 -0
- package/dist/spatial-assets.js +4 -0
- package/dist/spatial-assets.js.map +1 -0
- package/dist/spatial-contract.d.ts +3 -0
- package/dist/spatial-contract.d.ts.map +1 -0
- package/dist/spatial-contract.js +3 -0
- package/dist/spatial-contract.js.map +1 -0
- package/dist/spatial-engine.d.ts +5 -0
- package/dist/spatial-engine.d.ts.map +1 -0
- package/dist/spatial-engine.js +5 -0
- package/dist/spatial-engine.js.map +1 -0
- package/dist/spatial.d.ts +9 -0
- package/dist/spatial.d.ts.map +1 -0
- package/dist/spatial.js +9 -0
- package/dist/spatial.js.map +1 -0
- package/dist/subscriptions/data-channel.d.ts.map +1 -1
- package/dist/subscriptions/data-channel.js +421 -166
- package/dist/subscriptions/data-channel.js.map +1 -1
- package/dist/subscriptions/render-system.d.ts.map +1 -1
- package/dist/subscriptions/render-system.js +4 -2
- package/dist/subscriptions/render-system.js.map +1 -1
- package/dist/subscriptions/shared-channels.d.ts.map +1 -1
- package/dist/subscriptions/shared-channels.js +4 -2
- package/dist/subscriptions/shared-channels.js.map +1 -1
- package/dist/subscriptions/vector-selection.d.ts +4 -0
- package/dist/subscriptions/vector-selection.d.ts.map +1 -0
- package/dist/subscriptions/vector-selection.js +180 -0
- package/dist/subscriptions/vector-selection.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/register-properties.d.ts.map +1 -1
- package/dist/ui/register-properties.js +3 -2
- package/dist/ui/register-properties.js.map +1 -1
- package/dist/vector/synthetic-handle.d.ts.map +1 -1
- package/dist/vector/synthetic-handle.js.map +1 -1
- package/package.json +49 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineDataChannelObserver, EventTypes,
|
|
1
|
+
import { defineDataChannelObserver, EventTypes, renderSceneTreeStore as defaultRenderSceneTree, subscribeToSynchronousEvent, subscribeToFileLoadComplete } from '@asyra/core';
|
|
2
2
|
import { EntityTypes, SCENE_TREE_ACTIONS, SharedDataChannelNames, emitDiagnosticCounter, measureBrowserDragPhase } from '@asyra/utils';
|
|
3
|
-
import { subscribeToEventBatches } from '@asyra/reactive-events';
|
|
3
|
+
import { subscribeToEventBatches, subscribeToAppliedEventBatches } from '@asyra/reactive-events';
|
|
4
4
|
import { createCleanupReporter } from '../cleanup-reporter.js';
|
|
5
5
|
import { deriveGroupBounds } from '../components/group.js';
|
|
6
6
|
import { SelectionActions, SelectionChannels, SelectionEventNames } from '../selection/channels.js';
|
|
@@ -29,7 +29,7 @@ const recordRenderProjectionOutcome = (outcome) => {
|
|
|
29
29
|
}
|
|
30
30
|
return outcome;
|
|
31
31
|
};
|
|
32
|
-
const getMatchingPropertiesForSceneTreeChange = (change) => {
|
|
32
|
+
const getMatchingPropertiesForSceneTreeChange = (change, propertyRegistry) => {
|
|
33
33
|
if (change.action === SCENE_TREE_ACTIONS.UPDATE_ELEMENT_DATA) {
|
|
34
34
|
const rawChange = change;
|
|
35
35
|
return Array.from(new Set(rawChange.changes.flatMap(({ key, before, after }) => propertyRegistry.getMatchingProperties({
|
|
@@ -76,7 +76,7 @@ const getMatchingPropertiesForSceneTreeChange = (change) => {
|
|
|
76
76
|
}))));
|
|
77
77
|
};
|
|
78
78
|
// Render observers keep render-internal stores in sync with shared channel changes.
|
|
79
|
-
const updateRenderSceneTree = (change) => {
|
|
79
|
+
const updateRenderSceneTree = (change, renderSceneTreeStore) => {
|
|
80
80
|
switch (change.action) {
|
|
81
81
|
case SCENE_TREE_ACTIONS.ADD_ELEMENT: {
|
|
82
82
|
const { data, parentId, index } = change;
|
|
@@ -119,6 +119,10 @@ const updateRenderSceneTree = (change) => {
|
|
|
119
119
|
case SCENE_TREE_ACTIONS.REMOVE_SUBTREE:
|
|
120
120
|
case SCENE_TREE_ACTIONS.RESTORE_SUBTREE:
|
|
121
121
|
return recordRenderProjectionOutcome(renderSceneTreeStore.applySubtreeChange(change));
|
|
122
|
+
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_PROPERTY_BINDINGS: {
|
|
123
|
+
const { id, changes } = change;
|
|
124
|
+
return recordRenderProjectionOutcome(renderSceneTreeStore.updateElementPropertyBindings(id, changes));
|
|
125
|
+
}
|
|
122
126
|
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_DATA: {
|
|
123
127
|
const { id, changes, options } = change;
|
|
124
128
|
return recordRenderProjectionOutcome(renderSceneTreeStore.updateElementBatch(id, changes.map(({ key, before, after }) => ({
|
|
@@ -198,7 +202,7 @@ const toLocalComputedSceneTreeChange = (event) => {
|
|
|
198
202
|
export const projectLocalComputedEventToRender = (event) => {
|
|
199
203
|
const change = toLocalComputedSceneTreeChange(event);
|
|
200
204
|
if (change) {
|
|
201
|
-
return updateRenderSceneTree(change);
|
|
205
|
+
return updateRenderSceneTree(change, defaultRenderSceneTree);
|
|
202
206
|
}
|
|
203
207
|
};
|
|
204
208
|
const isLocalComputedSceneTreeChange = (change) => change.action === SCENE_TREE_ACTIONS.UPDATE_ELEMENT_COMPUTED_DATA ||
|
|
@@ -211,13 +215,13 @@ const toLocalComputedProjectionEvent = (event) => {
|
|
|
211
215
|
}
|
|
212
216
|
return event;
|
|
213
217
|
};
|
|
214
|
-
const updateRenderSceneTreeBatch = (changes) => {
|
|
218
|
+
const updateRenderSceneTreeBatch = (changes, renderSceneTreeStore) => {
|
|
215
219
|
let changeIndex = 0;
|
|
216
220
|
while (changeIndex < changes.length) {
|
|
217
221
|
const change = changes[changeIndex];
|
|
218
222
|
const firstAddition = toRenderElementAddition(change);
|
|
219
223
|
if (!firstAddition) {
|
|
220
|
-
updateRenderSceneTree(change);
|
|
224
|
+
updateRenderSceneTree(change, renderSceneTreeStore);
|
|
221
225
|
changeIndex += 1;
|
|
222
226
|
continue;
|
|
223
227
|
}
|
|
@@ -238,7 +242,7 @@ const updateRenderSceneTreeBatch = (changes) => {
|
|
|
238
242
|
}
|
|
239
243
|
};
|
|
240
244
|
// Render selection mirror used by overlay/render behavior.
|
|
241
|
-
const updateRenderSelection = (change) => {
|
|
245
|
+
const updateRenderSelection = (change, renderSelectionStore) => {
|
|
242
246
|
switch (change.action) {
|
|
243
247
|
case SelectionActions.SELECT_ELEMENTS:
|
|
244
248
|
case SelectionActions.DESELECT_ELEMENTS:
|
|
@@ -254,12 +258,6 @@ const updateRenderSelection = (change) => {
|
|
|
254
258
|
break;
|
|
255
259
|
}
|
|
256
260
|
};
|
|
257
|
-
// Data-channel observer definitions for render defaults.
|
|
258
|
-
const renderSelectionDataChannelObserver = defineDataChannelObserver({
|
|
259
|
-
name: 'preset.render.selection',
|
|
260
|
-
channel: SharedDataChannelNames.SELECTION,
|
|
261
|
-
onChange: updateRenderSelection
|
|
262
|
-
});
|
|
263
261
|
// Read current selected IDs from selection runtime (single source of truth).
|
|
264
262
|
const getSelectedIds = (core, type) => {
|
|
265
263
|
const selection = core.getSelection(type);
|
|
@@ -349,10 +347,10 @@ const buildSelectionContext = (deps, selectedIds) => {
|
|
|
349
347
|
// Sync selection-related ui-context properties and run aggregate recompute (x/y/width/...).
|
|
350
348
|
const syncElementSelectionAndDerived = (core, deps) => {
|
|
351
349
|
const selectedIds = getSelectedIds(core, SelectionChannels.ELEMENT);
|
|
352
|
-
uiContext.set('elementSelection', selectedIds);
|
|
353
|
-
uiContext.recomputeSelectionProperties(buildSelectionContext(deps, selectedIds));
|
|
350
|
+
deps.uiContext.set('elementSelection', selectedIds);
|
|
351
|
+
deps.uiContext.recomputeSelectionProperties(buildSelectionContext(deps, selectedIds));
|
|
354
352
|
};
|
|
355
|
-
const syncSelectionOnElementRemovals = (core, removedIds) => {
|
|
353
|
+
const syncSelectionOnElementRemovals = (core, removedIds, deps) => {
|
|
356
354
|
const selection = core.getSelection(SelectionChannels.ELEMENT);
|
|
357
355
|
if (!selection) {
|
|
358
356
|
return false;
|
|
@@ -368,45 +366,13 @@ const syncSelectionOnElementRemovals = (core, removedIds) => {
|
|
|
368
366
|
}
|
|
369
367
|
selection.select(next);
|
|
370
368
|
selection.cleanChanges();
|
|
371
|
-
renderSelectionStore.updateSelection(SelectionChannels.ELEMENT);
|
|
369
|
+
deps.renderSelectionStore.updateSelection(SelectionChannels.ELEMENT);
|
|
372
370
|
return true;
|
|
373
371
|
};
|
|
374
372
|
// Sync vector point/segment selection mirrors for UI consumers.
|
|
375
|
-
const syncVectorSelections = (core) => {
|
|
376
|
-
uiContext.set('vectorPointSelection', getSelectedIds(core, SelectionChannels.VECTOR_POINT));
|
|
377
|
-
uiContext.set('vectorSegmentSelection', getSelectedIds(core, SelectionChannels.VECTOR_SEGMENT));
|
|
378
|
-
};
|
|
379
|
-
// Build a depth-first flattened element id index from the scene-tree.
|
|
380
|
-
const collectChildrenIds = (deps, elementId, ids) => {
|
|
381
|
-
const element = deps.sceneTree.getElementById(elementId);
|
|
382
|
-
if (!element) {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
ids.push(elementId);
|
|
386
|
-
const elementData = element.save();
|
|
387
|
-
if (elementData.type === EntityTypes.GROUP) {
|
|
388
|
-
const children = elementData.children ?? [];
|
|
389
|
-
children.forEach((childId) => {
|
|
390
|
-
collectChildrenIds(deps, childId, ids);
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
const getFlattenedElementIds = (deps) => {
|
|
395
|
-
const ids = [];
|
|
396
|
-
const workspace = deps.sceneTree.currentWorkspace;
|
|
397
|
-
if (!workspace) {
|
|
398
|
-
return ids;
|
|
399
|
-
}
|
|
400
|
-
const workspaceData = workspace.save();
|
|
401
|
-
const workspaceChildren = workspaceData.children ?? [];
|
|
402
|
-
workspaceChildren.forEach((childId) => {
|
|
403
|
-
collectChildrenIds(deps, childId, ids);
|
|
404
|
-
});
|
|
405
|
-
return ids;
|
|
406
|
-
};
|
|
407
|
-
// Publish flattened ids so UI can do fast filtering/lookup without tree traversal.
|
|
408
|
-
const syncFlattenedElementIds = (deps) => {
|
|
409
|
-
uiContext.set('flattenedElementIds', getFlattenedElementIds(deps));
|
|
373
|
+
const syncVectorSelections = (core, deps) => {
|
|
374
|
+
deps.uiContext.set('vectorPointSelection', getSelectedIds(core, SelectionChannels.VECTOR_POINT));
|
|
375
|
+
deps.uiContext.set('vectorSegmentSelection', getSelectedIds(core, SelectionChannels.VECTOR_SEGMENT));
|
|
410
376
|
};
|
|
411
377
|
// Published UI lookup map keyed by element id (used by element row rendering).
|
|
412
378
|
const getElementDataMap = (deps) => {
|
|
@@ -419,8 +385,43 @@ const getElementDataMap = (deps) => {
|
|
|
419
385
|
});
|
|
420
386
|
return dataMap;
|
|
421
387
|
};
|
|
422
|
-
const
|
|
423
|
-
|
|
388
|
+
const syncHierarchyUIContext = (deps, lifetime) => {
|
|
389
|
+
const map = getElementDataMap(deps);
|
|
390
|
+
const flattenedIds = [];
|
|
391
|
+
const parents = new Map();
|
|
392
|
+
const children = new Map();
|
|
393
|
+
const subtreeSizes = new Map();
|
|
394
|
+
const workspace = deps.sceneTree.currentWorkspace?.save();
|
|
395
|
+
const visit = (elementId, parentId) => {
|
|
396
|
+
const row = map[elementId];
|
|
397
|
+
if (!row || parents.has(elementId)) {
|
|
398
|
+
throw new Error('Invalid loaded UI hierarchy');
|
|
399
|
+
}
|
|
400
|
+
const start = flattenedIds.length;
|
|
401
|
+
const childIds = Array.isArray(row.children)
|
|
402
|
+
? [...row.children]
|
|
403
|
+
: [];
|
|
404
|
+
flattenedIds.push(elementId);
|
|
405
|
+
parents.set(elementId, parentId);
|
|
406
|
+
if (childIds.length) {
|
|
407
|
+
children.set(elementId, childIds);
|
|
408
|
+
}
|
|
409
|
+
childIds.forEach((childId) => visit(childId, elementId));
|
|
410
|
+
subtreeSizes.set(elementId, flattenedIds.length - start);
|
|
411
|
+
};
|
|
412
|
+
if (workspace) {
|
|
413
|
+
children.set(workspace.id, [...workspace.children]);
|
|
414
|
+
workspace.children.forEach((id) => visit(id, workspace.id));
|
|
415
|
+
}
|
|
416
|
+
deps.uiContext.set('flattenedElementIds', flattenedIds);
|
|
417
|
+
deps.uiContext.set('elementDataMap', map);
|
|
418
|
+
lifetime.hierarchy = {
|
|
419
|
+
map: deps.uiContext.get('elementDataMap') ?? map,
|
|
420
|
+
flattenedIds: deps.uiContext.get('flattenedElementIds') ?? flattenedIds,
|
|
421
|
+
parents,
|
|
422
|
+
children,
|
|
423
|
+
subtreeSizes
|
|
424
|
+
};
|
|
424
425
|
};
|
|
425
426
|
const PROJECTED_ELEMENT_MAP_BUCKET_COUNT = 256;
|
|
426
427
|
const PROJECTED_ELEMENT_DELETED = Symbol('projected-element-deleted');
|
|
@@ -615,6 +616,7 @@ const sceneTreeChangeUpdatesProjectedHierarchy = (change) => {
|
|
|
615
616
|
return true;
|
|
616
617
|
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_COMPUTED_DATA:
|
|
617
618
|
return isProjectedHierarchyKey(change.key);
|
|
619
|
+
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_DATA:
|
|
618
620
|
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_COMPUTED_DATA_BATCH:
|
|
619
621
|
return change.changes.some(({ key }) => isProjectedHierarchyKey(key));
|
|
620
622
|
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_COMPUTED_DATA_PATCH:
|
|
@@ -623,40 +625,135 @@ const sceneTreeChangeUpdatesProjectedHierarchy = (change) => {
|
|
|
623
625
|
return false;
|
|
624
626
|
}
|
|
625
627
|
};
|
|
626
|
-
|
|
628
|
+
// A terminal ancestry proof is local to this publication, never a second tree.
|
|
629
|
+
const planProjectedTailAdditions = (changes, prepared) => {
|
|
630
|
+
if (!prepared ||
|
|
631
|
+
prepared.flattenedIds.length === 0 ||
|
|
632
|
+
changes.some((change) => change.action !== SCENE_TREE_ACTIONS.ADD_ELEMENT &&
|
|
633
|
+
change.action !== SCENE_TREE_ACTIONS.ADD_ELEMENTS)) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const tail = [];
|
|
637
|
+
const terminalIds = new Set();
|
|
638
|
+
let current = prepared.flattenedIds[prepared.flattenedIds.length - 1];
|
|
639
|
+
while (current) {
|
|
640
|
+
if (terminalIds.has(current)) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
emitDiagnosticCounter('ui-context-hierarchy-tail-visit');
|
|
644
|
+
terminalIds.add(current);
|
|
645
|
+
tail.push(current);
|
|
646
|
+
current = prepared.parents.get(current);
|
|
647
|
+
}
|
|
648
|
+
tail.reverse();
|
|
649
|
+
const appended = [];
|
|
650
|
+
const addedIds = new Set();
|
|
651
|
+
const childCounts = new Map();
|
|
652
|
+
for (const change of changes) {
|
|
653
|
+
let entries;
|
|
654
|
+
if (change.action === SCENE_TREE_ACTIONS.ADD_ELEMENTS) {
|
|
655
|
+
entries = change.entries;
|
|
656
|
+
}
|
|
657
|
+
else if (change.action === SCENE_TREE_ACTIONS.ADD_ELEMENT) {
|
|
658
|
+
entries = [change];
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
for (const { data, parentId, index } of entries) {
|
|
664
|
+
const id = data.id;
|
|
665
|
+
const parent = typeof parentId === 'string' ? parentId : data.parentId;
|
|
666
|
+
if (!id ||
|
|
667
|
+
!parent ||
|
|
668
|
+
prepared.parents.has(id) ||
|
|
669
|
+
prepared.children.has(id) ||
|
|
670
|
+
addedIds.has(id) ||
|
|
671
|
+
!terminalIds.has(parent) ||
|
|
672
|
+
(data.children !== undefined &&
|
|
673
|
+
(!Array.isArray(data.children) || data.children.length !== 0))) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const childCount = childCounts.get(parent) ?? prepared.children.get(parent)?.length ?? 0;
|
|
677
|
+
if (index !== undefined && index !== childCount) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (change.action === SCENE_TREE_ACTIONS.ADD_ELEMENTS &&
|
|
681
|
+
index === undefined) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
while (tail[tail.length - 1] !== parent) {
|
|
685
|
+
const previous = tail.pop();
|
|
686
|
+
if (previous === undefined) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
terminalIds.delete(previous);
|
|
690
|
+
}
|
|
691
|
+
tail.push(id);
|
|
692
|
+
terminalIds.add(id);
|
|
693
|
+
addedIds.add(id);
|
|
694
|
+
appended.push(id);
|
|
695
|
+
childCounts.set(parent, childCount + 1);
|
|
696
|
+
emitDiagnosticCounter('ui-context-hierarchy-append-entry');
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return appended.length ? appended : undefined;
|
|
700
|
+
};
|
|
701
|
+
const projectUIContextSceneTreeBatch = (changes, deps, lifetime) => {
|
|
627
702
|
if (changes.length === 0) {
|
|
628
703
|
return;
|
|
629
704
|
}
|
|
630
705
|
measureBrowserDragPhase('ui-context:project-scene-tree-batch', () => {
|
|
631
706
|
const updatesHierarchy = changes.some(sceneTreeChangeUpdatesProjectedHierarchy);
|
|
632
|
-
const current = uiContext.get('elementDataMap') ?? {};
|
|
633
|
-
const currentFlattenedIds = uiContext.get('flattenedElementIds') ?? [];
|
|
707
|
+
const current = deps.uiContext.get('elementDataMap') ?? {};
|
|
708
|
+
const currentFlattenedIds = deps.uiContext.get('flattenedElementIds') ?? [];
|
|
709
|
+
const retained = lifetime.hierarchy;
|
|
710
|
+
const reusable = retained?.map === current && retained.flattenedIds === currentFlattenedIds
|
|
711
|
+
? retained
|
|
712
|
+
: undefined;
|
|
713
|
+
// Re-entrant publication or failure must never consume an in-progress index.
|
|
714
|
+
lifetime.hierarchy = undefined;
|
|
715
|
+
const tailAdditions = planProjectedTailAdditions(changes, reusable);
|
|
716
|
+
const subtreeSizes = reusable?.subtreeSizes ?? new Map();
|
|
634
717
|
const mutation = createProjectedElementDataMapMutation(current, currentFlattenedIds);
|
|
635
718
|
const next = mutation.value;
|
|
636
719
|
let mapChanged = false;
|
|
637
|
-
const childrenByParent = new Map();
|
|
720
|
+
const childrenByParent = reusable?.children ?? new Map();
|
|
721
|
+
const parentIds = reusable?.parents ?? new Map();
|
|
722
|
+
const missingIds = new Set();
|
|
723
|
+
let membershipRowReads = 0;
|
|
638
724
|
const dirtyParentIds = new Set();
|
|
639
725
|
const changedElementIds = new Set();
|
|
640
726
|
const ensureMutableMap = () => {
|
|
641
727
|
mapChanged = true;
|
|
642
728
|
return next;
|
|
643
729
|
};
|
|
644
|
-
if (updatesHierarchy) {
|
|
730
|
+
if (updatesHierarchy && !reusable) {
|
|
731
|
+
emitDiagnosticCounter('ui-context-membership-prepare');
|
|
645
732
|
currentFlattenedIds.forEach((elementId) => {
|
|
646
|
-
|
|
647
|
-
|
|
733
|
+
membershipRowReads++;
|
|
734
|
+
const row = current[elementId];
|
|
735
|
+
if (!row) {
|
|
736
|
+
missingIds.add(elementId);
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const parentId = getProjectedParentId(row);
|
|
740
|
+
parentIds.set(elementId, parentId);
|
|
741
|
+
if (!parentId) {
|
|
648
742
|
return;
|
|
743
|
+
}
|
|
649
744
|
const children = childrenByParent.get(parentId) ?? [];
|
|
650
745
|
children.push(elementId);
|
|
651
746
|
childrenByParent.set(parentId, children);
|
|
652
747
|
});
|
|
653
748
|
}
|
|
654
749
|
const removeMembership = (parentId, elementId) => {
|
|
655
|
-
if (!parentId)
|
|
750
|
+
if (!parentId) {
|
|
656
751
|
return;
|
|
752
|
+
}
|
|
657
753
|
const children = childrenByParent.get(parentId);
|
|
658
|
-
if (!children)
|
|
754
|
+
if (!children) {
|
|
659
755
|
return;
|
|
756
|
+
}
|
|
660
757
|
const index = children.indexOf(elementId);
|
|
661
758
|
if (index >= 0) {
|
|
662
759
|
children.splice(index, 1);
|
|
@@ -664,10 +761,17 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
664
761
|
}
|
|
665
762
|
};
|
|
666
763
|
const insertMembership = (parentId, elementId, requestedIndex) => {
|
|
667
|
-
if (!parentId)
|
|
764
|
+
if (!parentId) {
|
|
668
765
|
return;
|
|
766
|
+
}
|
|
669
767
|
emitDiagnosticCounter('ui-context-membership-add-scalar');
|
|
670
768
|
const children = childrenByParent.get(parentId) ?? [];
|
|
769
|
+
if (tailAdditions) {
|
|
770
|
+
children.push(elementId);
|
|
771
|
+
childrenByParent.set(parentId, children);
|
|
772
|
+
dirtyParentIds.add(parentId);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
671
775
|
const existingIndex = children.indexOf(elementId);
|
|
672
776
|
if (existingIndex >= 0) {
|
|
673
777
|
children.splice(existingIndex, 1);
|
|
@@ -692,6 +796,13 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
692
796
|
entriesByParent.set(parentId, parentEntries);
|
|
693
797
|
});
|
|
694
798
|
entriesByParent.forEach((parentEntries, parentId) => {
|
|
799
|
+
if (tailAdditions) {
|
|
800
|
+
const children = childrenByParent.get(parentId) ?? [];
|
|
801
|
+
parentEntries.forEach(({ elementId }) => children.push(elementId));
|
|
802
|
+
childrenByParent.set(parentId, children);
|
|
803
|
+
dirtyParentIds.add(parentId);
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
695
806
|
const insertedIds = new Set(parentEntries.map(({ elementId }) => elementId));
|
|
696
807
|
const retainedChildren = (childrenByParent.get(parentId) ?? []).filter((childId) => !insertedIds.has(childId));
|
|
697
808
|
const insertionByIndex = new Map(parentEntries.map(({ elementId, index }) => [index, elementId]));
|
|
@@ -724,8 +835,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
724
835
|
});
|
|
725
836
|
removedIdsByParent.forEach((removedIds, parentId) => {
|
|
726
837
|
const children = childrenByParent.get(parentId);
|
|
727
|
-
if (!children)
|
|
838
|
+
if (!children) {
|
|
728
839
|
return;
|
|
840
|
+
}
|
|
729
841
|
const retainedChildren = children.filter((childId) => !removedIds.has(childId));
|
|
730
842
|
if (retainedChildren.length !== children.length) {
|
|
731
843
|
childrenByParent.set(parentId, retainedChildren);
|
|
@@ -735,8 +847,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
735
847
|
};
|
|
736
848
|
const setProjectedValue = (elementId, key, value) => {
|
|
737
849
|
const currentData = next[elementId];
|
|
738
|
-
if (!currentData)
|
|
850
|
+
if (!currentData) {
|
|
739
851
|
return;
|
|
852
|
+
}
|
|
740
853
|
if (!isProjectedHierarchyKey(key) &&
|
|
741
854
|
!shouldUpdateElementDataMapForComputedKey(key)) {
|
|
742
855
|
return;
|
|
@@ -774,8 +887,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
774
887
|
const { data, parentId, index } = change;
|
|
775
888
|
const elementData = cloneProjectedElementData(data);
|
|
776
889
|
const elementId = typeof elementData?.id === 'string' ? elementData.id : undefined;
|
|
777
|
-
if (!elementData || !elementId)
|
|
890
|
+
if (!elementData || !elementId) {
|
|
778
891
|
return;
|
|
892
|
+
}
|
|
779
893
|
const projectedParentId = typeof parentId === 'string'
|
|
780
894
|
? parentId
|
|
781
895
|
: getProjectedParentId(elementData);
|
|
@@ -798,6 +912,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
798
912
|
});
|
|
799
913
|
}
|
|
800
914
|
else {
|
|
915
|
+
if (tailAdditions) {
|
|
916
|
+
flushScalarAdditionMemberships();
|
|
917
|
+
}
|
|
801
918
|
insertMembership(projectedParentId, elementId, index);
|
|
802
919
|
}
|
|
803
920
|
break;
|
|
@@ -808,8 +925,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
808
925
|
entries.forEach(({ data, parentId, index }) => {
|
|
809
926
|
const elementData = cloneProjectedElementData(data);
|
|
810
927
|
const elementId = typeof elementData?.id === 'string' ? elementData.id : undefined;
|
|
811
|
-
if (!elementData || !elementId)
|
|
928
|
+
if (!elementData || !elementId) {
|
|
812
929
|
return;
|
|
930
|
+
}
|
|
813
931
|
elementData.parentId = parentId;
|
|
814
932
|
ensureMutableMap()[elementId] = elementData;
|
|
815
933
|
changedElementIds.add(elementId);
|
|
@@ -856,8 +974,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
856
974
|
});
|
|
857
975
|
affectedParentIds.forEach((parentId) => {
|
|
858
976
|
const children = childrenByParent.get(parentId);
|
|
859
|
-
if (!children)
|
|
977
|
+
if (!children) {
|
|
860
978
|
return;
|
|
979
|
+
}
|
|
861
980
|
const retainedChildren = children.filter((childId) => !movedIds.has(childId));
|
|
862
981
|
if (retainedChildren.length !== children.length) {
|
|
863
982
|
childrenByParent.set(parentId, retainedChildren);
|
|
@@ -904,8 +1023,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
904
1023
|
}
|
|
905
1024
|
subtree.removed.forEach(({ data, elementId }) => {
|
|
906
1025
|
const elementData = cloneProjectedElementData(data);
|
|
907
|
-
if (!elementData)
|
|
1026
|
+
if (!elementData) {
|
|
908
1027
|
return;
|
|
1028
|
+
}
|
|
909
1029
|
ensureMutableMap()[elementId] = elementData;
|
|
910
1030
|
changedElementIds.add(elementId);
|
|
911
1031
|
if (Array.isArray(elementData.children)) {
|
|
@@ -926,6 +1046,20 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
926
1046
|
});
|
|
927
1047
|
break;
|
|
928
1048
|
}
|
|
1049
|
+
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_PROPERTY_BINDINGS: {
|
|
1050
|
+
const { id, changes: bindings } = change;
|
|
1051
|
+
const current = next[id];
|
|
1052
|
+
if (!current) {
|
|
1053
|
+
break;
|
|
1054
|
+
}
|
|
1055
|
+
const props = { ...(current.props ?? {}) };
|
|
1056
|
+
bindings.forEach(({ key, after }) => {
|
|
1057
|
+
props[key] = after;
|
|
1058
|
+
});
|
|
1059
|
+
ensureMutableMap()[id] = { ...current, props };
|
|
1060
|
+
changedElementIds.add(id);
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
929
1063
|
case SCENE_TREE_ACTIONS.UPDATE_ELEMENT_DATA: {
|
|
930
1064
|
const { id, changes: updates } = change;
|
|
931
1065
|
updates.forEach(({ key, after }) => {
|
|
@@ -957,8 +1091,9 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
957
1091
|
flushScalarAdditionMemberships();
|
|
958
1092
|
dirtyParentIds.forEach((parentId) => {
|
|
959
1093
|
const parent = next[parentId];
|
|
960
|
-
if (!parent)
|
|
1094
|
+
if (!parent) {
|
|
961
1095
|
return;
|
|
1096
|
+
}
|
|
962
1097
|
ensureMutableMap()[parentId] = {
|
|
963
1098
|
...parent,
|
|
964
1099
|
children: [...(childrenByParent.get(parentId) ?? [])]
|
|
@@ -966,50 +1101,169 @@ const projectUIContextSceneTreeBatch = (changes) => {
|
|
|
966
1101
|
changedElementIds.add(parentId);
|
|
967
1102
|
});
|
|
968
1103
|
let nextFlattenedIds = currentFlattenedIds;
|
|
1104
|
+
let completeHierarchy = Boolean(reusable);
|
|
969
1105
|
if (updatesHierarchy) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
rootParentIds.push(parentId);
|
|
1106
|
+
completeHierarchy = true;
|
|
1107
|
+
changedElementIds.forEach((elementId) => {
|
|
1108
|
+
membershipRowReads++;
|
|
1109
|
+
const row = next[elementId];
|
|
1110
|
+
if (row) {
|
|
1111
|
+
parentIds.set(elementId, getProjectedParentId(row));
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
parentIds.delete(elementId);
|
|
1115
|
+
subtreeSizes.delete(elementId);
|
|
1116
|
+
missingIds.add(elementId);
|
|
982
1117
|
}
|
|
983
1118
|
});
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1119
|
+
const hasProjectedRow = (elementId) => {
|
|
1120
|
+
if (parentIds.has(elementId)) {
|
|
1121
|
+
return true;
|
|
1122
|
+
}
|
|
1123
|
+
if (missingIds.has(elementId)) {
|
|
1124
|
+
return false;
|
|
1125
|
+
}
|
|
1126
|
+
membershipRowReads++;
|
|
1127
|
+
const row = next[elementId];
|
|
1128
|
+
if (!row) {
|
|
1129
|
+
missingIds.add(elementId);
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
1132
|
+
parentIds.set(elementId, getProjectedParentId(row));
|
|
1133
|
+
return true;
|
|
992
1134
|
};
|
|
993
|
-
|
|
994
|
-
;
|
|
995
|
-
|
|
996
|
-
|
|
1135
|
+
if (tailAdditions) {
|
|
1136
|
+
emitDiagnosticCounter('ui-context-flattened-identity-copy', currentFlattenedIds.length);
|
|
1137
|
+
nextFlattenedIds = currentFlattenedIds.concat(tailAdditions);
|
|
1138
|
+
for (const id of tailAdditions) {
|
|
1139
|
+
subtreeSizes.set(id, 1);
|
|
1140
|
+
let parent = parentIds.get(id);
|
|
1141
|
+
while (parent && parentIds.has(parent)) {
|
|
1142
|
+
subtreeSizes.set(parent, (subtreeSizes.get(parent) ?? 1) + 1);
|
|
1143
|
+
parent = parentIds.get(parent);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
const rootParentIds = [];
|
|
1149
|
+
const rootParentIdSet = new Set();
|
|
1150
|
+
const changedSubtrees = new Set();
|
|
1151
|
+
for (const id of dirtyParentIds) {
|
|
1152
|
+
let currentId = id;
|
|
1153
|
+
while (currentId && !changedSubtrees.has(currentId)) {
|
|
1154
|
+
changedSubtrees.add(currentId);
|
|
1155
|
+
currentId = parentIds.get(currentId);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
if (reusable) {
|
|
1159
|
+
for (const parent of childrenByParent.keys()) {
|
|
1160
|
+
if (!parentIds.has(parent)) {
|
|
1161
|
+
rootParentIds.push(parent);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
const currentFlattenedIdSet = new Set(currentFlattenedIds);
|
|
1167
|
+
const orderedCandidates = [
|
|
1168
|
+
...currentFlattenedIds,
|
|
1169
|
+
...[...changedElementIds].filter((id) => !currentFlattenedIdSet.has(id))
|
|
1170
|
+
];
|
|
1171
|
+
orderedCandidates.forEach((elementId) => {
|
|
1172
|
+
emitDiagnosticCounter('ui-context-hierarchy-root-candidate');
|
|
1173
|
+
if (!hasProjectedRow(elementId)) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
const parentId = parentIds.get(elementId);
|
|
1177
|
+
if (parentId &&
|
|
1178
|
+
!rootParentIdSet.has(parentId) &&
|
|
1179
|
+
!hasProjectedRow(parentId)) {
|
|
1180
|
+
rootParentIdSet.add(parentId);
|
|
1181
|
+
rootParentIds.push(parentId);
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
let oldPositions;
|
|
1186
|
+
const flattenedElementIds = [];
|
|
1187
|
+
const visited = new Set();
|
|
1188
|
+
let collectedCount = 0;
|
|
1189
|
+
const collectProjectedChildren = (elementId, parentId) => {
|
|
1190
|
+
if (!visited.has(elementId) &&
|
|
1191
|
+
reusable &&
|
|
1192
|
+
!changedSubtrees.has(elementId) &&
|
|
1193
|
+
subtreeSizes.has(elementId) &&
|
|
1194
|
+
parentIds.get(elementId) === parentId) {
|
|
1195
|
+
oldPositions ?? (oldPositions = new Map(currentFlattenedIds.map((id, index) => [id, index])));
|
|
1196
|
+
const start = oldPositions.get(elementId);
|
|
1197
|
+
const size = subtreeSizes.get(elementId) ?? 0;
|
|
1198
|
+
if (start !== undefined &&
|
|
1199
|
+
size > 0 &&
|
|
1200
|
+
start + size <= currentFlattenedIds.length) {
|
|
1201
|
+
visited.add(elementId);
|
|
1202
|
+
for (let index = start; index < start + size; index++) {
|
|
1203
|
+
flattenedElementIds.push(currentFlattenedIds[index]);
|
|
1204
|
+
}
|
|
1205
|
+
collectedCount += size;
|
|
1206
|
+
emitDiagnosticCounter('ui-context-flattened-subtree-copy', size);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
emitDiagnosticCounter('ui-context-hierarchy-node-visit');
|
|
1211
|
+
if (visited.has(elementId) || !hasProjectedRow(elementId)) {
|
|
1212
|
+
completeHierarchy = false;
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (parentIds.get(elementId) !== parentId) {
|
|
1216
|
+
completeHierarchy = false;
|
|
1217
|
+
}
|
|
1218
|
+
visited.add(elementId);
|
|
1219
|
+
collectedCount++;
|
|
1220
|
+
const start = flattenedElementIds.length;
|
|
1221
|
+
flattenedElementIds.push(elementId);
|
|
1222
|
+
(childrenByParent.get(elementId) ?? []).forEach((childId) => collectProjectedChildren(childId, elementId));
|
|
1223
|
+
subtreeSizes.set(elementId, flattenedElementIds.length - start);
|
|
1224
|
+
};
|
|
1225
|
+
rootParentIds.forEach((parentId) => {
|
|
1226
|
+
;
|
|
1227
|
+
(childrenByParent.get(parentId) ?? []).forEach((childId) => collectProjectedChildren(childId, parentId));
|
|
1228
|
+
});
|
|
1229
|
+
if (collectedCount !== parentIds.size) {
|
|
1230
|
+
completeHierarchy = false;
|
|
1231
|
+
}
|
|
1232
|
+
nextFlattenedIds = flattenedElementIds;
|
|
1233
|
+
}
|
|
997
1234
|
emitDiagnosticCounter('ui-context-sync-flattened-ids');
|
|
998
|
-
nextFlattenedIds
|
|
1235
|
+
emitDiagnosticCounter('ui-context-flattened-identity-output', nextFlattenedIds.length);
|
|
999
1236
|
}
|
|
1237
|
+
emitDiagnosticCounter('ui-context-membership-row-read', membershipRowReads);
|
|
1238
|
+
let projected = current;
|
|
1000
1239
|
if (mapChanged) {
|
|
1001
1240
|
emitDiagnosticCounter('ui-context-sync-element-data-map-entry', changedElementIds.size);
|
|
1002
|
-
const subject = uiContext.getSubject('elementDataMap');
|
|
1003
|
-
|
|
1241
|
+
const subject = deps.uiContext.getSubject('elementDataMap');
|
|
1242
|
+
projected = mutation.commit(nextFlattenedIds);
|
|
1004
1243
|
if (subject) {
|
|
1005
1244
|
subject.next(projected);
|
|
1006
1245
|
}
|
|
1007
1246
|
else {
|
|
1008
|
-
uiContext.set('elementDataMap', projected);
|
|
1247
|
+
deps.uiContext.set('elementDataMap', projected);
|
|
1009
1248
|
}
|
|
1010
1249
|
}
|
|
1011
1250
|
if (updatesHierarchy) {
|
|
1012
|
-
uiContext.set('flattenedElementIds', nextFlattenedIds);
|
|
1251
|
+
deps.uiContext.set('flattenedElementIds', nextFlattenedIds);
|
|
1252
|
+
}
|
|
1253
|
+
const publishedFlattenedIds = deps.uiContext.get('flattenedElementIds');
|
|
1254
|
+
if (completeHierarchy &&
|
|
1255
|
+
!lifetime.disposed &&
|
|
1256
|
+
deps.uiContext.get('elementDataMap') === projected &&
|
|
1257
|
+
// The registry preserves the old array when the new order is value-equal.
|
|
1258
|
+
(publishedFlattenedIds === nextFlattenedIds ||
|
|
1259
|
+
publishedFlattenedIds === currentFlattenedIds)) {
|
|
1260
|
+
lifetime.hierarchy = {
|
|
1261
|
+
map: projected,
|
|
1262
|
+
flattenedIds: publishedFlattenedIds,
|
|
1263
|
+
parents: parentIds,
|
|
1264
|
+
children: childrenByParent,
|
|
1265
|
+
subtreeSizes
|
|
1266
|
+
};
|
|
1013
1267
|
}
|
|
1014
1268
|
});
|
|
1015
1269
|
};
|
|
@@ -1039,9 +1293,9 @@ const flushPendingUIContextSync = (lifetime, core, deps) => {
|
|
|
1039
1293
|
resetPendingUIContextSync(lifetime);
|
|
1040
1294
|
measureBrowserDragPhase('ui-context:flush', () => {
|
|
1041
1295
|
emitDiagnosticCounter('ui-context-transaction-flush');
|
|
1042
|
-
projectUIContextSceneTreeBatch(pending.sceneTreeChanges);
|
|
1296
|
+
projectUIContextSceneTreeBatch(pending.sceneTreeChanges, deps, lifetime);
|
|
1043
1297
|
if (pending.removedElementIds.size > 0 &&
|
|
1044
|
-
syncSelectionOnElementRemovals(core, [...pending.removedElementIds])) {
|
|
1298
|
+
syncSelectionOnElementRemovals(core, [...pending.removedElementIds], deps)) {
|
|
1045
1299
|
pending.elementSelectionAndDerived = true;
|
|
1046
1300
|
}
|
|
1047
1301
|
if (pending.elementSelectionAndDerived) {
|
|
@@ -1051,7 +1305,7 @@ const flushPendingUIContextSync = (lifetime, core, deps) => {
|
|
|
1051
1305
|
if (pending.dirtyPropertyKeys.size > 0) {
|
|
1052
1306
|
emitDiagnosticCounter('ui-context-recompute-property-key-count', pending.dirtyPropertyKeys.size);
|
|
1053
1307
|
const selectedIds = getSelectedIds(core, SelectionChannels.ELEMENT);
|
|
1054
|
-
uiContext.recomputeProperties([...pending.dirtyPropertyKeys], buildSelectionContext(deps, selectedIds));
|
|
1308
|
+
deps.uiContext.recomputeProperties([...pending.dirtyPropertyKeys], buildSelectionContext(deps, selectedIds));
|
|
1055
1309
|
}
|
|
1056
1310
|
});
|
|
1057
1311
|
};
|
|
@@ -1064,22 +1318,22 @@ const updateUIContextElementSelection = (change, core, deps) => {
|
|
|
1064
1318
|
break;
|
|
1065
1319
|
}
|
|
1066
1320
|
};
|
|
1067
|
-
const updateVectorEditingSelection = (change, core) => {
|
|
1321
|
+
const updateVectorEditingSelection = (change, core, deps) => {
|
|
1068
1322
|
switch (change.action) {
|
|
1069
1323
|
case SelectionActions.SELECT_VECTOR_POINTS:
|
|
1070
1324
|
case SelectionActions.DESELECT_VECTOR_POINTS:
|
|
1071
|
-
uiContext.set('vectorPointSelection', getSelectedIds(core, SelectionChannels.VECTOR_POINT));
|
|
1325
|
+
deps.uiContext.set('vectorPointSelection', getSelectedIds(core, SelectionChannels.VECTOR_POINT));
|
|
1072
1326
|
break;
|
|
1073
1327
|
case SelectionActions.SELECT_VECTOR_SEGMENTS:
|
|
1074
1328
|
case SelectionActions.DESELECT_VECTOR_SEGMENTS:
|
|
1075
|
-
uiContext.set('vectorSegmentSelection', getSelectedIds(core, SelectionChannels.VECTOR_SEGMENT));
|
|
1329
|
+
deps.uiContext.set('vectorSegmentSelection', getSelectedIds(core, SelectionChannels.VECTOR_SEGMENT));
|
|
1076
1330
|
break;
|
|
1077
1331
|
}
|
|
1078
1332
|
};
|
|
1079
1333
|
// Scene-tree channel updates affect list/map mirrors, and may trigger aggregate recompute.
|
|
1080
|
-
const handleUIContextSceneTreeChange = (change, core,
|
|
1334
|
+
const handleUIContextSceneTreeChange = (change, core, deps, lifetime) => {
|
|
1081
1335
|
lifetime.pending.sceneTreeChanges.push(change);
|
|
1082
|
-
const updatedPropertyKeys = getMatchingPropertiesForSceneTreeChange(change);
|
|
1336
|
+
const updatedPropertyKeys = getMatchingPropertiesForSceneTreeChange(change, deps.uiContext.registry);
|
|
1083
1337
|
updatedPropertyKeys.forEach((key) => {
|
|
1084
1338
|
lifetime.pending.dirtyPropertyKeys.add(key);
|
|
1085
1339
|
});
|
|
@@ -1131,6 +1385,7 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1131
1385
|
vectorEditing: true,
|
|
1132
1386
|
uiContext: true
|
|
1133
1387
|
}) => {
|
|
1388
|
+
const { renderSceneTreeStore } = deps;
|
|
1134
1389
|
const propertyProjectionEnabled = options.propertyProjection === true;
|
|
1135
1390
|
const renderSceneEnabled = options.renderScene === true;
|
|
1136
1391
|
const selectionEnabled = options.selection === true;
|
|
@@ -1141,8 +1396,9 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1141
1396
|
const uiContextSyncLifetime = createUIContextSyncLifetime();
|
|
1142
1397
|
let disposed = false;
|
|
1143
1398
|
const dispose = () => {
|
|
1144
|
-
if (disposed)
|
|
1399
|
+
if (disposed) {
|
|
1145
1400
|
return;
|
|
1401
|
+
}
|
|
1146
1402
|
disposed = true;
|
|
1147
1403
|
const failures = [];
|
|
1148
1404
|
for (let index = registeredObserverNames.length - 1; index >= 0; index--) {
|
|
@@ -1173,6 +1429,7 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1173
1429
|
}
|
|
1174
1430
|
}
|
|
1175
1431
|
uiContextSyncLifetime.disposed = true;
|
|
1432
|
+
uiContextSyncLifetime.hierarchy = undefined;
|
|
1176
1433
|
resetPendingUIContextSync(uiContextSyncLifetime);
|
|
1177
1434
|
if (failures.length > 0) {
|
|
1178
1435
|
throw failures[0];
|
|
@@ -1212,30 +1469,6 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1212
1469
|
}
|
|
1213
1470
|
}
|
|
1214
1471
|
});
|
|
1215
|
-
const uiContextSceneTreeDataChannelObserver = defineDataChannelObserver({
|
|
1216
|
-
name: 'preset.uiContext.sceneTree',
|
|
1217
|
-
channel: SharedDataChannelNames.SCENE_TREE,
|
|
1218
|
-
onBatch: (changes) => {
|
|
1219
|
-
if (uiContextSyncLifetime.disposed) {
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
changes
|
|
1223
|
-
.filter((change) => !isLocalComputedSceneTreeChange(change))
|
|
1224
|
-
.forEach((change) => {
|
|
1225
|
-
handleUIContextSceneTreeChange(change, core, deps, uiContextSyncLifetime);
|
|
1226
|
-
});
|
|
1227
|
-
flushPendingUIContextSync(uiContextSyncLifetime, core, deps);
|
|
1228
|
-
}
|
|
1229
|
-
});
|
|
1230
|
-
const renderSceneTreeDataChannelObserver = defineDataChannelObserver({
|
|
1231
|
-
name: 'preset.render.sceneTree',
|
|
1232
|
-
channel: SharedDataChannelNames.SCENE_TREE,
|
|
1233
|
-
onBatch: (changes) => {
|
|
1234
|
-
if (!disposed) {
|
|
1235
|
-
updateRenderSceneTreeBatch(changes.filter((change) => !isLocalComputedSceneTreeChange(change)));
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
1472
|
const uiContextSelectionDataChannelObserver = defineDataChannelObserver({
|
|
1240
1473
|
name: 'preset.uiContext.selection',
|
|
1241
1474
|
channel: SharedDataChannelNames.SELECTION,
|
|
@@ -1244,7 +1477,7 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1244
1477
|
const vectorEditingSelectionDataChannelObserver = defineDataChannelObserver({
|
|
1245
1478
|
name: 'preset.vectorEditing.selection',
|
|
1246
1479
|
channel: SharedDataChannelNames.SELECTION,
|
|
1247
|
-
onChange: (change) => updateVectorEditingSelection(change, core)
|
|
1480
|
+
onChange: (change) => updateVectorEditingSelection(change, core, deps)
|
|
1248
1481
|
});
|
|
1249
1482
|
const selectionRuntimeDataChannelObserver = defineDataChannelObserver({
|
|
1250
1483
|
name: 'preset.selection.runtime',
|
|
@@ -1255,47 +1488,66 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1255
1488
|
if (propertyProjectionEnabled) {
|
|
1256
1489
|
registerObserver(canonicalPropertyDataChannelObserver);
|
|
1257
1490
|
}
|
|
1258
|
-
|
|
1491
|
+
const localSceneChangesFromEvents = (events) => events.flatMap((event) => {
|
|
1492
|
+
if (event.type === EventTypes.SCENE_TREE_CHANGED) {
|
|
1493
|
+
const { projectionOwner, changes } = event
|
|
1494
|
+
.payload;
|
|
1495
|
+
return projectionOwner === deps.sceneTree.projectionOwner
|
|
1496
|
+
? changes.filter((change) => !isLocalComputedSceneTreeChange(change))
|
|
1497
|
+
: [];
|
|
1498
|
+
}
|
|
1499
|
+
const computedEvent = toLocalComputedProjectionEvent(event);
|
|
1500
|
+
if (!computedEvent) {
|
|
1501
|
+
return [];
|
|
1502
|
+
}
|
|
1503
|
+
const change = toLocalComputedSceneTreeChange(computedEvent);
|
|
1504
|
+
return change ? [change] : [];
|
|
1505
|
+
});
|
|
1506
|
+
if (renderSceneEnabled) {
|
|
1507
|
+
eventSubscriptions.push(subscribeToAppliedEventBatches((events) => {
|
|
1508
|
+
if (!disposed) {
|
|
1509
|
+
updateRenderSceneTreeBatch(localSceneChangesFromEvents(events), renderSceneTreeStore);
|
|
1510
|
+
}
|
|
1511
|
+
}));
|
|
1512
|
+
cleanupReporter.report();
|
|
1513
|
+
}
|
|
1514
|
+
if (uiContextEnabled) {
|
|
1259
1515
|
eventSubscriptions.push(subscribeToEventBatches((events) => {
|
|
1260
1516
|
if (disposed) {
|
|
1261
1517
|
return;
|
|
1262
1518
|
}
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
return [];
|
|
1267
|
-
}
|
|
1268
|
-
const change = toLocalComputedSceneTreeChange(computedEvent);
|
|
1269
|
-
return change ? [change] : [];
|
|
1270
|
-
});
|
|
1271
|
-
if (renderSceneEnabled) {
|
|
1272
|
-
updateRenderSceneTreeBatch(localComputedChanges);
|
|
1273
|
-
}
|
|
1274
|
-
if (uiContextEnabled && localComputedChanges.length > 0) {
|
|
1275
|
-
localComputedChanges.forEach((change) => {
|
|
1276
|
-
handleUIContextSceneTreeChange(change, core, deps, uiContextSyncLifetime);
|
|
1277
|
-
});
|
|
1278
|
-
flushPendingUIContextSync(uiContextSyncLifetime, core, deps);
|
|
1519
|
+
const changes = localSceneChangesFromEvents(events);
|
|
1520
|
+
if (changes.length === 0) {
|
|
1521
|
+
return;
|
|
1279
1522
|
}
|
|
1523
|
+
changes.forEach((change) => handleUIContextSceneTreeChange(change, core, deps, uiContextSyncLifetime));
|
|
1524
|
+
flushPendingUIContextSync(uiContextSyncLifetime, core, deps);
|
|
1280
1525
|
}));
|
|
1281
1526
|
cleanupReporter.report();
|
|
1282
1527
|
}
|
|
1283
1528
|
if (renderSceneEnabled) {
|
|
1284
|
-
eventSubscriptions.push(subscribeToSynchronousEvent(EventTypes.FILE_LOAD_COMPLETE, () => {
|
|
1529
|
+
eventSubscriptions.push(subscribeToSynchronousEvent(EventTypes.FILE_LOAD_COMPLETE, (event) => {
|
|
1530
|
+
if (event.projectionOwner !== undefined &&
|
|
1531
|
+
event.projectionOwner !== deps.sceneTree.projectionOwner) {
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1285
1534
|
renderSceneTreeStore.reload();
|
|
1286
1535
|
}));
|
|
1287
1536
|
cleanupReporter.report();
|
|
1288
1537
|
}
|
|
1289
1538
|
if (uiContextEnabled || vectorEditingEnabled) {
|
|
1290
|
-
eventSubscriptions.push(subscribeToFileLoadComplete(() => {
|
|
1539
|
+
eventSubscriptions.push(subscribeToFileLoadComplete((event) => {
|
|
1540
|
+
if (event.projectionOwner !== undefined &&
|
|
1541
|
+
event.projectionOwner !== deps.sceneTree.projectionOwner) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1291
1544
|
if (uiContextEnabled) {
|
|
1292
1545
|
resetPendingUIContextSync(uiContextSyncLifetime);
|
|
1293
|
-
|
|
1294
|
-
syncElementDataMap(deps);
|
|
1546
|
+
syncHierarchyUIContext(deps, uiContextSyncLifetime);
|
|
1295
1547
|
syncElementSelectionAndDerived(core, deps);
|
|
1296
1548
|
}
|
|
1297
1549
|
if (vectorEditingEnabled) {
|
|
1298
|
-
syncVectorSelections(core);
|
|
1550
|
+
syncVectorSelections(core, deps);
|
|
1299
1551
|
}
|
|
1300
1552
|
}));
|
|
1301
1553
|
cleanupReporter.report();
|
|
@@ -1308,7 +1560,7 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1308
1560
|
if (selectionEnabled) {
|
|
1309
1561
|
applySelectionIdsToRuntime(core, SelectionChannels.ELEMENT, change.after, change.options);
|
|
1310
1562
|
// Replay events bypass shared channel observers. Mirror them to render.
|
|
1311
|
-
updateRenderSelection(change);
|
|
1563
|
+
updateRenderSelection(change, deps.renderSelectionStore);
|
|
1312
1564
|
}
|
|
1313
1565
|
if (uiContextEnabled) {
|
|
1314
1566
|
updateUIContextElementSelection(change, core, deps);
|
|
@@ -1321,10 +1573,10 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1321
1573
|
const change = createSelectionChangeFromDirectEvent(SelectionChannels.VECTOR_POINT, SelectionActions.SELECT_VECTOR_POINTS, SelectionEventNames.SELECT_VECTOR_POINTS, event.payload, event.options);
|
|
1322
1574
|
if (selectionEnabled) {
|
|
1323
1575
|
applySelectionIdsToRuntime(core, SelectionChannels.VECTOR_POINT, change.after, change.options);
|
|
1324
|
-
updateRenderSelection(change);
|
|
1576
|
+
updateRenderSelection(change, deps.renderSelectionStore);
|
|
1325
1577
|
}
|
|
1326
1578
|
if (vectorEditingEnabled) {
|
|
1327
|
-
updateVectorEditingSelection(change, core);
|
|
1579
|
+
updateVectorEditingSelection(change, core, deps);
|
|
1328
1580
|
}
|
|
1329
1581
|
}));
|
|
1330
1582
|
cleanupReporter.report();
|
|
@@ -1332,24 +1584,26 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1332
1584
|
const change = createSelectionChangeFromDirectEvent(SelectionChannels.VECTOR_SEGMENT, SelectionActions.SELECT_VECTOR_SEGMENTS, SelectionEventNames.SELECT_VECTOR_SEGMENTS, event.payload, event.options);
|
|
1333
1585
|
if (selectionEnabled) {
|
|
1334
1586
|
applySelectionIdsToRuntime(core, SelectionChannels.VECTOR_SEGMENT, change.after, change.options);
|
|
1335
|
-
updateRenderSelection(change);
|
|
1587
|
+
updateRenderSelection(change, deps.renderSelectionStore);
|
|
1336
1588
|
}
|
|
1337
1589
|
if (vectorEditingEnabled) {
|
|
1338
|
-
updateVectorEditingSelection(change, core);
|
|
1590
|
+
updateVectorEditingSelection(change, core, deps);
|
|
1339
1591
|
}
|
|
1340
1592
|
}));
|
|
1341
1593
|
cleanupReporter.report();
|
|
1342
1594
|
}
|
|
1343
1595
|
if (renderSceneEnabled) {
|
|
1344
|
-
registerObserver(renderSceneTreeDataChannelObserver);
|
|
1345
1596
|
renderSceneTreeStore.reload();
|
|
1346
1597
|
}
|
|
1347
1598
|
if (selectionEnabled) {
|
|
1348
1599
|
registerObserver(selectionRuntimeDataChannelObserver);
|
|
1349
|
-
registerObserver(
|
|
1600
|
+
registerObserver(defineDataChannelObserver({
|
|
1601
|
+
name: 'preset.render.selection',
|
|
1602
|
+
channel: SharedDataChannelNames.SELECTION,
|
|
1603
|
+
onChange: (change) => updateRenderSelection(change, deps.renderSelectionStore)
|
|
1604
|
+
}));
|
|
1350
1605
|
}
|
|
1351
1606
|
if (uiContextEnabled) {
|
|
1352
|
-
registerObserver(uiContextSceneTreeDataChannelObserver);
|
|
1353
1607
|
registerObserver(uiContextSelectionDataChannelObserver);
|
|
1354
1608
|
}
|
|
1355
1609
|
if (vectorEditingEnabled) {
|
|
@@ -1357,8 +1611,9 @@ export const registerDefaultDataChannelObservers = (core, deps, onCleanupReady,
|
|
|
1357
1611
|
}
|
|
1358
1612
|
}
|
|
1359
1613
|
catch (error) {
|
|
1360
|
-
if (!cleanupReporter.hasReported())
|
|
1614
|
+
if (!cleanupReporter.hasReported()) {
|
|
1361
1615
|
dispose();
|
|
1616
|
+
}
|
|
1362
1617
|
throw error;
|
|
1363
1618
|
}
|
|
1364
1619
|
return dispose;
|