bruce-cesium 7.6.2 → 7.6.3
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/bruce-cesium.es5.js +508 -46
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +501 -43
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/menu-item-creator.js +44 -23
- package/dist/lib/rendering/menu-item-creator.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +116 -7
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/menu-item-styles.js +151 -0
- package/dist/lib/rendering/menu-item-styles.js.map +1 -0
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js +10 -0
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +10 -0
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +10 -0
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +48 -0
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +10 -0
- package/dist/lib/rendering/render-managers/entities/entity-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +17 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +15 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +15 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
- package/dist/lib/widgets/tabs-left-panel/widget-left-panel-tab-menu-items.js +64 -12
- package/dist/lib/widgets/tabs-left-panel/widget-left-panel-tab-menu-items.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/rendering/menu-item-manager.d.ts +25 -0
- package/dist/types/rendering/menu-item-styles.d.ts +30 -0
- package/dist/types/rendering/render-managers/entities/entities-datalab-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/entities/entities-ids-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +8 -1
- package/dist/types/rendering/render-managers/entities/entity-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/render-manager.d.ts +10 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-arb-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-cad-render-manager.d.ts +5 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-entities-render-manager.d.ts +5 -1
- package/dist/types/widgets/tabs-left-panel/widget-left-panel-tab-menu-items.d.ts +1 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -16387,6 +16387,10 @@
|
|
|
16387
16387
|
this.zoomControl = [];
|
|
16388
16388
|
// Scenario for retrieving Entities.
|
|
16389
16389
|
this.scenario = null;
|
|
16390
|
+
// Hand-off key of the data currently drawn, or null when it is unknown or nothing is drawn.
|
|
16391
|
+
this.drawnKey = null;
|
|
16392
|
+
// How the drawn entities were last told to look, see getDrawnSettingsSignature.
|
|
16393
|
+
this.drawnSettings = null;
|
|
16390
16394
|
// Type IDs that we'll allow to be rendered when receiving Entities.
|
|
16391
16395
|
// This might be exactly the Menu Item Type ID because of local data sources.
|
|
16392
16396
|
this.allowedTypeIDs = [];
|
|
@@ -16445,9 +16449,26 @@
|
|
|
16445
16449
|
if (this.disposed) {
|
|
16446
16450
|
return;
|
|
16447
16451
|
}
|
|
16452
|
+
// Landing on the data already drawn re-applies settings instead of removing and re-fetching it.
|
|
16453
|
+
const nextKey = shouldRender ? Manager.GetHandoffKey(this.item) : null;
|
|
16454
|
+
const keepDrawn = nextKey != null && nextKey === this.drawnKey;
|
|
16455
|
+
const restyle = keepDrawn && this.drawnSettings !== this.getDrawnSettingsSignature();
|
|
16456
|
+
this.drawnKey = nextKey;
|
|
16457
|
+
this.drawnSettings = this.getDrawnSettingsSignature();
|
|
16448
16458
|
this.unsetGetter();
|
|
16449
16459
|
(_a = this.viewMonitorRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
16450
16460
|
this.viewMonitorRemoval = null;
|
|
16461
|
+
if (keepDrawn) {
|
|
16462
|
+
this.setGetter();
|
|
16463
|
+
this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
|
|
16464
|
+
var _a;
|
|
16465
|
+
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Call();
|
|
16466
|
+
});
|
|
16467
|
+
if (restyle) {
|
|
16468
|
+
this.ReRender({ entityIds: Object.keys(this.renderedEntities), force: true });
|
|
16469
|
+
}
|
|
16470
|
+
return;
|
|
16471
|
+
}
|
|
16451
16472
|
clearInterval(this.renderQueueInterval);
|
|
16452
16473
|
this.renderQueueInterval = null;
|
|
16453
16474
|
this.renderQueue = [];
|
|
@@ -16481,6 +16502,18 @@
|
|
|
16481
16502
|
}
|
|
16482
16503
|
})();
|
|
16483
16504
|
}
|
|
16505
|
+
/*
|
|
16506
|
+
* Everything about how drawn entities look that applying the item's settings can change.
|
|
16507
|
+
*/
|
|
16508
|
+
getDrawnSettingsSignature() {
|
|
16509
|
+
var _a;
|
|
16510
|
+
return JSON.stringify({
|
|
16511
|
+
zoomControl: exports.RenderManager.GetZoomControlSignature(this.zoomControl),
|
|
16512
|
+
renderPriority: (_a = this.renderPriority) !== null && _a !== void 0 ? _a : null,
|
|
16513
|
+
historicDrawTrack: Boolean(this.item.historicDrawTrack),
|
|
16514
|
+
historicInterpolation: Boolean(this.item.historicInterpolation)
|
|
16515
|
+
});
|
|
16516
|
+
}
|
|
16484
16517
|
applyItemSettings() {
|
|
16485
16518
|
var _a, _b, _c, _d, _e, _f;
|
|
16486
16519
|
// Reset allowed list if there's change.
|
|
@@ -16856,10 +16889,13 @@
|
|
|
16856
16889
|
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
16857
16890
|
this.zoomControl = [this.zoomControl[0]];
|
|
16858
16891
|
}
|
|
16892
|
+
this.drawnSettings = this.getDrawnSettingsSignature();
|
|
16859
16893
|
changed = true;
|
|
16860
16894
|
}
|
|
16861
16895
|
if (scenario != null) {
|
|
16862
16896
|
this.scenario = scenario;
|
|
16897
|
+
// The drawn records now belong to a scenario the item does not name.
|
|
16898
|
+
this.drawnKey = null;
|
|
16863
16899
|
changed = true;
|
|
16864
16900
|
}
|
|
16865
16901
|
if (changed) {
|
|
@@ -16874,6 +16910,16 @@
|
|
|
16874
16910
|
this.doEntityCheck(entityIds);
|
|
16875
16911
|
}
|
|
16876
16912
|
}
|
|
16913
|
+
/**
|
|
16914
|
+
* Switches to another of the item's own styles, restyling what is drawn without re-creating it.
|
|
16915
|
+
*/
|
|
16916
|
+
SwapStyle(item) {
|
|
16917
|
+
if (this.disposed) {
|
|
16918
|
+
return;
|
|
16919
|
+
}
|
|
16920
|
+
this.item = item;
|
|
16921
|
+
this.UpdateSettings({ zoomControl: item.CameraZoomSettings });
|
|
16922
|
+
}
|
|
16877
16923
|
/**
|
|
16878
16924
|
* Narrows a camera-driven check to the entities whose zoom band could actually have changed.
|
|
16879
16925
|
* @param ids
|
|
@@ -17627,6 +17673,8 @@
|
|
|
17627
17673
|
AdoptHandoff(payload) {
|
|
17628
17674
|
var _a;
|
|
17629
17675
|
const { shouldRender } = this.applyItemSettings();
|
|
17676
|
+
this.drawnKey = shouldRender ? Manager.GetHandoffKey(this.item) : null;
|
|
17677
|
+
this.drawnSettings = this.getDrawnSettingsSignature();
|
|
17630
17678
|
this.visualsManager.ReassignMenuItem({
|
|
17631
17679
|
fromMenuItemId: payload.sourceMenuItemId,
|
|
17632
17680
|
toMenuItemId: this.item.id,
|
|
@@ -18002,6 +18050,16 @@
|
|
|
18002
18050
|
this.doEntityCheck(entityIds);
|
|
18003
18051
|
}
|
|
18004
18052
|
}
|
|
18053
|
+
/**
|
|
18054
|
+
* Switches to another of the item's own styles, restyling what is drawn without re-creating it.
|
|
18055
|
+
*/
|
|
18056
|
+
SwapStyle(item) {
|
|
18057
|
+
if (this.disposed) {
|
|
18058
|
+
return;
|
|
18059
|
+
}
|
|
18060
|
+
this.item = item;
|
|
18061
|
+
this.UpdateSettings({ zoomControl: item.CameraZoomSettings });
|
|
18062
|
+
}
|
|
18005
18063
|
async doEntityCheck(ids, force = false) {
|
|
18006
18064
|
var _a, _b;
|
|
18007
18065
|
const api = this.apiGetter.getApi();
|
|
@@ -18702,6 +18760,16 @@
|
|
|
18702
18760
|
this.onGetterUpdate(entityIds);
|
|
18703
18761
|
}
|
|
18704
18762
|
}
|
|
18763
|
+
/**
|
|
18764
|
+
* Switches to another of the item's own styles, restyling what is drawn without re-creating it.
|
|
18765
|
+
*/
|
|
18766
|
+
SwapStyle(item) {
|
|
18767
|
+
if (this.disposed) {
|
|
18768
|
+
return;
|
|
18769
|
+
}
|
|
18770
|
+
this.item = item;
|
|
18771
|
+
this.UpdateSettings({ zoomControl: item.CameraZoomSettings });
|
|
18772
|
+
}
|
|
18705
18773
|
/*
|
|
18706
18774
|
* The lane this item reads through, or null when it does not follow the clock.
|
|
18707
18775
|
*/
|
|
@@ -19161,6 +19229,16 @@
|
|
|
19161
19229
|
this.onGetterUpdate(entityId, true);
|
|
19162
19230
|
}
|
|
19163
19231
|
}
|
|
19232
|
+
/**
|
|
19233
|
+
* Switches to another of the item's own styles, restyling what is drawn without re-creating it.
|
|
19234
|
+
*/
|
|
19235
|
+
SwapStyle(item) {
|
|
19236
|
+
if (this.disposed) {
|
|
19237
|
+
return;
|
|
19238
|
+
}
|
|
19239
|
+
this.item = item;
|
|
19240
|
+
this.UpdateSettings({ zoomControl: item.CameraZoomSettings });
|
|
19241
|
+
}
|
|
19164
19242
|
renderEntity(entity, force = false) {
|
|
19165
19243
|
// Waiting for prior call to finish resolving.
|
|
19166
19244
|
// This avoids race conditions against two sets of overlapping Entities.
|
|
@@ -23030,6 +23108,21 @@
|
|
|
23030
23108
|
}
|
|
23031
23109
|
return children;
|
|
23032
23110
|
}
|
|
23111
|
+
/**
|
|
23112
|
+
* Switches to another of the item's own styles, restyling the loaded tileset without reloading it.
|
|
23113
|
+
*/
|
|
23114
|
+
SwapStyle(item) {
|
|
23115
|
+
var _a;
|
|
23116
|
+
if (this.disposed) {
|
|
23117
|
+
return;
|
|
23118
|
+
}
|
|
23119
|
+
this.item = item;
|
|
23120
|
+
// Before the tileset loads this only stores the pick, and the styler's Init reads the new item.
|
|
23121
|
+
this.styler.UpdateStyleMapping({
|
|
23122
|
+
styleMapping: (_a = item.StyleMapping) !== null && _a !== void 0 ? _a : [],
|
|
23123
|
+
fallbackStyleId: item.styleId
|
|
23124
|
+
});
|
|
23125
|
+
}
|
|
23033
23126
|
Dispose() {
|
|
23034
23127
|
var _a;
|
|
23035
23128
|
if (this.disposed) {
|
|
@@ -24757,6 +24850,16 @@
|
|
|
24757
24850
|
this.doEntityCheck(entityIds);
|
|
24758
24851
|
}
|
|
24759
24852
|
}
|
|
24853
|
+
/**
|
|
24854
|
+
* Switches to another of the item's own styles, restyling what is drawn without re-creating it.
|
|
24855
|
+
*/
|
|
24856
|
+
SwapStyle(item) {
|
|
24857
|
+
if (this.disposed) {
|
|
24858
|
+
return;
|
|
24859
|
+
}
|
|
24860
|
+
this.item = item;
|
|
24861
|
+
this.UpdateSettings({ zoomControl: item.CameraZoomSettings });
|
|
24862
|
+
}
|
|
24760
24863
|
async doEntityCheck(ids, force = false) {
|
|
24761
24864
|
var _a, _b, _c, _d;
|
|
24762
24865
|
if (this.isRunningCheck) {
|
|
@@ -26666,6 +26769,21 @@
|
|
|
26666
26769
|
}
|
|
26667
26770
|
}
|
|
26668
26771
|
}
|
|
26772
|
+
/**
|
|
26773
|
+
* Switches to another of the item's own styles, restyling the loaded tileset without reloading it.
|
|
26774
|
+
*/
|
|
26775
|
+
SwapStyle(item) {
|
|
26776
|
+
if (this.disposed) {
|
|
26777
|
+
return;
|
|
26778
|
+
}
|
|
26779
|
+
this.item = item;
|
|
26780
|
+
if (Manager.NeedsStyler(item)) {
|
|
26781
|
+
this.styler.UpdateStyleMapping({
|
|
26782
|
+
styleMapping: [],
|
|
26783
|
+
fallbackStyleId: item.styleId
|
|
26784
|
+
});
|
|
26785
|
+
}
|
|
26786
|
+
}
|
|
26669
26787
|
Dispose() {
|
|
26670
26788
|
var _a;
|
|
26671
26789
|
if (this.disposed) {
|
|
@@ -27915,6 +28033,23 @@
|
|
|
27915
28033
|
this.viewer.zoomTo(this.cTileset, new Cesium.HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
|
|
27916
28034
|
}
|
|
27917
28035
|
}
|
|
28036
|
+
/**
|
|
28037
|
+
* Switches to another of the item's own styles, restyling the loaded tileset without reloading it.
|
|
28038
|
+
*/
|
|
28039
|
+
SwapStyle(item) {
|
|
28040
|
+
var _a;
|
|
28041
|
+
if (this.disposed) {
|
|
28042
|
+
return;
|
|
28043
|
+
}
|
|
28044
|
+
// Copied for the same reason the constructor copies it.
|
|
28045
|
+
this.item = JSON.parse(JSON.stringify(item));
|
|
28046
|
+
if (this.item.ApplyStyles || this.item.Type == BModels.MenuItem.EType.IonTileset) {
|
|
28047
|
+
this.styler.UpdateStyleMapping({
|
|
28048
|
+
styleMapping: (_a = this.item.StyleMapping) !== null && _a !== void 0 ? _a : [],
|
|
28049
|
+
fallbackStyleId: this.item.styleId
|
|
28050
|
+
});
|
|
28051
|
+
}
|
|
28052
|
+
}
|
|
27918
28053
|
Dispose() {
|
|
27919
28054
|
if (this.disposed) {
|
|
27920
28055
|
return;
|
|
@@ -31440,6 +31575,149 @@
|
|
|
31440
31575
|
AssemblyRenderManager.Manager = Manager;
|
|
31441
31576
|
})(exports.AssemblyRenderManager || (exports.AssemblyRenderManager = {}));
|
|
31442
31577
|
|
|
31578
|
+
(function (MenuItemStyles) {
|
|
31579
|
+
// Tileset items whose render manager applies styleId through a Styler.
|
|
31580
|
+
const TILESET_TYPES = [
|
|
31581
|
+
BModels.MenuItem.EType.CadTileset,
|
|
31582
|
+
BModels.MenuItem.EType.ArbTileset,
|
|
31583
|
+
BModels.MenuItem.EType.IonTileset,
|
|
31584
|
+
BModels.MenuItem.EType.EntityTileset
|
|
31585
|
+
];
|
|
31586
|
+
// Items whose style lives on their zoom control rows.
|
|
31587
|
+
const ZOOM_CONTROL_TYPES = [
|
|
31588
|
+
BModels.MenuItem.EType.Entities,
|
|
31589
|
+
BModels.MenuItem.EType.Entity,
|
|
31590
|
+
BModels.MenuItem.EType.EntitiesIds,
|
|
31591
|
+
BModels.MenuItem.EType.EntitiesLoaded,
|
|
31592
|
+
BModels.MenuItem.EType.DataLab
|
|
31593
|
+
];
|
|
31594
|
+
/**
|
|
31595
|
+
* Returns the ordered styles a user can swap between for the item, or an empty array when it offers no choice.
|
|
31596
|
+
*/
|
|
31597
|
+
function GetStyleIds(item) {
|
|
31598
|
+
var _a;
|
|
31599
|
+
if (isStyledTileset(item)) {
|
|
31600
|
+
return cleanIds(item.styleIds);
|
|
31601
|
+
}
|
|
31602
|
+
if (ZOOM_CONTROL_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
|
|
31603
|
+
return cleanIds((_a = getVisibleRow(item.CameraZoomSettings)) === null || _a === void 0 ? void 0 : _a.StyleIDs);
|
|
31604
|
+
}
|
|
31605
|
+
return [];
|
|
31606
|
+
}
|
|
31607
|
+
MenuItemStyles.GetStyleIds = GetStyleIds;
|
|
31608
|
+
/**
|
|
31609
|
+
* Returns the style the item currently renders with, from styleId or its one non-hidden zoom row.
|
|
31610
|
+
*/
|
|
31611
|
+
function GetStyleId(item) {
|
|
31612
|
+
var _a;
|
|
31613
|
+
if (TILESET_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
|
|
31614
|
+
return item.styleId;
|
|
31615
|
+
}
|
|
31616
|
+
if (ZOOM_CONTROL_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
|
|
31617
|
+
return (_a = getVisibleRow(item.CameraZoomSettings)) === null || _a === void 0 ? void 0 : _a.StyleID;
|
|
31618
|
+
}
|
|
31619
|
+
return undefined;
|
|
31620
|
+
}
|
|
31621
|
+
MenuItemStyles.GetStyleId = GetStyleId;
|
|
31622
|
+
/**
|
|
31623
|
+
* Returns a copy of the item rendering with the given style, or null when that style is not one of its options.
|
|
31624
|
+
*/
|
|
31625
|
+
function WithStyleId(item, styleId) {
|
|
31626
|
+
const styleIds = GetStyleIds(item);
|
|
31627
|
+
const picked = styleIds.find(x => isSameId(x, styleId));
|
|
31628
|
+
if (picked == null) {
|
|
31629
|
+
return null;
|
|
31630
|
+
}
|
|
31631
|
+
if (isStyledTileset(item)) {
|
|
31632
|
+
return { ...item, styleId: picked };
|
|
31633
|
+
}
|
|
31634
|
+
const zItem = item;
|
|
31635
|
+
const visible = getVisibleRow(zItem.CameraZoomSettings);
|
|
31636
|
+
return {
|
|
31637
|
+
...zItem,
|
|
31638
|
+
CameraZoomSettings: zItem.CameraZoomSettings.map(row => {
|
|
31639
|
+
if (row !== visible) {
|
|
31640
|
+
return row;
|
|
31641
|
+
}
|
|
31642
|
+
// An inline style would win over the picked ID.
|
|
31643
|
+
const next = { ...row, StyleID: picked };
|
|
31644
|
+
delete next.Style;
|
|
31645
|
+
return next;
|
|
31646
|
+
})
|
|
31647
|
+
};
|
|
31648
|
+
}
|
|
31649
|
+
MenuItemStyles.WithStyleId = WithStyleId;
|
|
31650
|
+
/**
|
|
31651
|
+
* Returns the item on the first of its styles unless it already uses one, or the same object when it has none.
|
|
31652
|
+
*/
|
|
31653
|
+
function Resolve(item) {
|
|
31654
|
+
var _a;
|
|
31655
|
+
const styleIds = GetStyleIds(item);
|
|
31656
|
+
if (!styleIds.length) {
|
|
31657
|
+
return item;
|
|
31658
|
+
}
|
|
31659
|
+
const current = GetStyleId(item);
|
|
31660
|
+
if (current != null && styleIds.some(x => isSameId(x, current))) {
|
|
31661
|
+
return item;
|
|
31662
|
+
}
|
|
31663
|
+
return (_a = WithStyleId(item, styleIds[0])) !== null && _a !== void 0 ? _a : item;
|
|
31664
|
+
}
|
|
31665
|
+
MenuItemStyles.Resolve = Resolve;
|
|
31666
|
+
/**
|
|
31667
|
+
* Returns a copy on the style a bookmark alternation picked, or the item itself when that is not an option.
|
|
31668
|
+
*/
|
|
31669
|
+
function ApplyAlternation(item, alternation) {
|
|
31670
|
+
var _a, _b, _c;
|
|
31671
|
+
// Alternations are partial items and may carry no Type, so the pick is read from whichever field is present.
|
|
31672
|
+
const alt = alternation;
|
|
31673
|
+
const picked = (_a = alt === null || alt === void 0 ? void 0 : alt.styleId) !== null && _a !== void 0 ? _a : (_b = getVisibleRow(alt === null || alt === void 0 ? void 0 : alt.CameraZoomSettings)) === null || _b === void 0 ? void 0 : _b.StyleID;
|
|
31674
|
+
if (picked == null) {
|
|
31675
|
+
return item;
|
|
31676
|
+
}
|
|
31677
|
+
return (_c = WithStyleId(item, picked)) !== null && _c !== void 0 ? _c : item;
|
|
31678
|
+
}
|
|
31679
|
+
MenuItemStyles.ApplyAlternation = ApplyAlternation;
|
|
31680
|
+
/**
|
|
31681
|
+
* Returns true when the two items differ by nothing but which of their styles is picked.
|
|
31682
|
+
*/
|
|
31683
|
+
function IsStyleChangeOnly(from, to) {
|
|
31684
|
+
if (!from || !to || from.Type !== to.Type) {
|
|
31685
|
+
return false;
|
|
31686
|
+
}
|
|
31687
|
+
const toStyleId = GetStyleId(to);
|
|
31688
|
+
if (toStyleId == null || isSameId(GetStyleId(from), toStyleId)) {
|
|
31689
|
+
return false;
|
|
31690
|
+
}
|
|
31691
|
+
const moved = WithStyleId(from, toStyleId);
|
|
31692
|
+
// A false mismatch only costs the in-place swap, so key order is not normalized.
|
|
31693
|
+
return Boolean(moved) && JSON.stringify(moved) === JSON.stringify(to);
|
|
31694
|
+
}
|
|
31695
|
+
MenuItemStyles.IsStyleChangeOnly = IsStyleChangeOnly;
|
|
31696
|
+
function isStyledTileset(item) {
|
|
31697
|
+
if (!TILESET_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
|
|
31698
|
+
return false;
|
|
31699
|
+
}
|
|
31700
|
+
// These two only run a Styler when asked to.
|
|
31701
|
+
if (item.Type === BModels.MenuItem.EType.ArbTileset || item.Type === BModels.MenuItem.EType.EntityTileset) {
|
|
31702
|
+
return Boolean(item.ApplyStyles);
|
|
31703
|
+
}
|
|
31704
|
+
return true;
|
|
31705
|
+
}
|
|
31706
|
+
function getVisibleRow(rows) {
|
|
31707
|
+
const visible = (rows !== null && rows !== void 0 ? rows : []).filter(x => x && x.DisplayType !== BModels.ZoomControl.EDisplayType.Hidden);
|
|
31708
|
+
return visible.length === 1 ? visible[0] : null;
|
|
31709
|
+
}
|
|
31710
|
+
function cleanIds(ids) {
|
|
31711
|
+
return (ids !== null && ids !== void 0 ? ids : []).filter(x => x != null && x !== "");
|
|
31712
|
+
}
|
|
31713
|
+
/*
|
|
31714
|
+
* Compares style references, which can be an ID typed as a string or a number.
|
|
31715
|
+
*/
|
|
31716
|
+
function isSameId(a, b) {
|
|
31717
|
+
return a != null && b != null && String(a) === String(b);
|
|
31718
|
+
}
|
|
31719
|
+
})(exports.MenuItemStyles || (exports.MenuItemStyles = {}));
|
|
31720
|
+
|
|
31443
31721
|
/**
|
|
31444
31722
|
* Util to batch Tileset and Root Entity coord requests between Menu Items.
|
|
31445
31723
|
* This avoids per-menu-item requests and allows for them to request together if enabled within N ms of each other.
|
|
@@ -31680,6 +31958,8 @@
|
|
|
31680
31958
|
constructor(params) {
|
|
31681
31959
|
this.items = [];
|
|
31682
31960
|
this.pendingHandoffPool = [];
|
|
31961
|
+
// The settings bookmark alternations overwrite on a view's items, as that view authored them.
|
|
31962
|
+
this.authoredAlternations = new WeakMap();
|
|
31683
31963
|
this.onUpdate = null;
|
|
31684
31964
|
// Segments discovered so far per menu item ID.
|
|
31685
31965
|
this.seriesSegments = new Map();
|
|
@@ -31735,7 +32015,7 @@
|
|
|
31735
32015
|
* @returns
|
|
31736
32016
|
*/
|
|
31737
32017
|
RenderItem(params) {
|
|
31738
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
32018
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
31739
32019
|
if (this.viewer.isDestroyed()) {
|
|
31740
32020
|
return null;
|
|
31741
32021
|
}
|
|
@@ -31759,13 +32039,21 @@
|
|
|
31759
32039
|
if (params.modelSpace == null) {
|
|
31760
32040
|
params.modelSpace = false;
|
|
31761
32041
|
}
|
|
32042
|
+
// An item with a style set renders its first style unless the caller already picked one of them.
|
|
32043
|
+
params = { ...params, item: exports.MenuItemStyles.Resolve(params.item) };
|
|
31762
32044
|
let rItem = this.items.find(x => x.id == params.item.id);
|
|
31763
32045
|
let create = true;
|
|
31764
32046
|
// Item already exists so we'll check if we should re-create it.
|
|
31765
32047
|
if (rItem) {
|
|
32048
|
+
// Only the picked style changed, so what is drawn gets restyled rather than rebuilt.
|
|
32049
|
+
if (exports.MenuItemStyles.IsStyleChangeOnly(rItem.item, params.item) && this.isStyleSwapCapable(rItem.renderManager)) {
|
|
32050
|
+
rItem.renderManager.SwapStyle(params.item);
|
|
32051
|
+
rItem.item = params.item;
|
|
32052
|
+
create = false;
|
|
32053
|
+
}
|
|
31766
32054
|
// This means we're updating an entities menu item re-using the same id.
|
|
31767
32055
|
// Eg: a bookmark swap that keeps the same item but changes tags, style, or zoom settings.
|
|
31768
|
-
if (rItem.type == BModels.MenuItem.EType.Entities && params.item.Type == BModels.MenuItem.EType.Entities) {
|
|
32056
|
+
else if (rItem.type == BModels.MenuItem.EType.Entities && params.item.Type == BModels.MenuItem.EType.Entities) {
|
|
31769
32057
|
rItem.renderManager.Init({
|
|
31770
32058
|
item: params.item,
|
|
31771
32059
|
});
|
|
@@ -32100,7 +32388,17 @@
|
|
|
32100
32388
|
// We no longer support folder items being both a folder and an action.
|
|
32101
32389
|
// Now an item must have no action to be a folder.
|
|
32102
32390
|
const isFolder = !params.item.Type || params.item.Type == BModels.MenuItem.EType.None;
|
|
32103
|
-
|
|
32391
|
+
const isRadioFolder = isFolder && Boolean(params.item.childrenAsRadios);
|
|
32392
|
+
if (((_f = params.item.Children) === null || _f === void 0 ? void 0 : _f.length) && params.recursive != false && isRadioFolder) {
|
|
32393
|
+
const picked = this.pickRadioChild(params.item.Children, params.preferredIds);
|
|
32394
|
+
const others = params.item.Children.filter(x => x !== picked && this.items.some(y => y.id === x.id));
|
|
32395
|
+
const childId = this.renderInPlaceOf(others.map(x => x.id), () => this.RenderItem({
|
|
32396
|
+
...params,
|
|
32397
|
+
item: picked
|
|
32398
|
+
}));
|
|
32399
|
+
rItem.childIds = childId ? [childId] : [];
|
|
32400
|
+
}
|
|
32401
|
+
else if (params.item.Children && params.recursive != false && isFolder) {
|
|
32104
32402
|
for (let i = 0; i < params.item.Children.length; i++) {
|
|
32105
32403
|
const childId = this.RenderItem({
|
|
32106
32404
|
...params,
|
|
@@ -32109,8 +32407,8 @@
|
|
|
32109
32407
|
rItem.childIds.push(childId);
|
|
32110
32408
|
}
|
|
32111
32409
|
}
|
|
32112
|
-
if (rItem.renderManager && !((
|
|
32113
|
-
(
|
|
32410
|
+
if (rItem.renderManager && !((_g = rItem.renderManager) === null || _g === void 0 ? void 0 : _g.Disposed)) {
|
|
32411
|
+
(_h = this.onUpdate) === null || _h === void 0 ? void 0 : _h.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
32114
32412
|
}
|
|
32115
32413
|
return rItem.id;
|
|
32116
32414
|
}
|
|
@@ -32159,9 +32457,74 @@
|
|
|
32159
32457
|
(_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: false, itemId: item.id });
|
|
32160
32458
|
}
|
|
32161
32459
|
}
|
|
32460
|
+
/**
|
|
32461
|
+
* Replaces enabled menu items with another, which reuses their graphics where both draw the same data.
|
|
32462
|
+
*/
|
|
32463
|
+
SwapItem(params) {
|
|
32464
|
+
const { fromIds, item, modelSpace } = params;
|
|
32465
|
+
const parents = this.items.filter(x => x.childIds.some(id => fromIds.includes(id)));
|
|
32466
|
+
const id = this.renderInPlaceOf(fromIds, () => this.RenderItem({
|
|
32467
|
+
item,
|
|
32468
|
+
modelSpace
|
|
32469
|
+
}));
|
|
32470
|
+
// Keeps a radio folder's removal reaching the child that replaced its old one.
|
|
32471
|
+
for (const parent of parents) {
|
|
32472
|
+
const kept = parent.childIds.filter(x => !fromIds.includes(x));
|
|
32473
|
+
parent.childIds = id && !kept.includes(id) ? kept.concat(id) : kept;
|
|
32474
|
+
}
|
|
32475
|
+
return id;
|
|
32476
|
+
}
|
|
32477
|
+
/**
|
|
32478
|
+
* Restyles an enabled menu item in place with another of its own styles, returning false when it cannot.
|
|
32479
|
+
*/
|
|
32480
|
+
SetItemStyle(params) {
|
|
32481
|
+
var _a;
|
|
32482
|
+
const { menuItemId, styleId } = params;
|
|
32483
|
+
const rItem = this.items.find(x => x.id === menuItemId);
|
|
32484
|
+
if (!rItem || !this.isStyleSwapCapable(rItem.renderManager) || rItem.renderManager.Disposed) {
|
|
32485
|
+
return false;
|
|
32486
|
+
}
|
|
32487
|
+
const next = exports.MenuItemStyles.WithStyleId(rItem.item, styleId);
|
|
32488
|
+
if (!next) {
|
|
32489
|
+
return false;
|
|
32490
|
+
}
|
|
32491
|
+
rItem.renderManager.SwapStyle(next);
|
|
32492
|
+
rItem.item = next;
|
|
32493
|
+
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
32494
|
+
return true;
|
|
32495
|
+
}
|
|
32496
|
+
/*
|
|
32497
|
+
* Picks the child the caller asked for, else the one already enabled, else the first.
|
|
32498
|
+
*/
|
|
32499
|
+
pickRadioChild(children, preferredIds) {
|
|
32500
|
+
var _a, _b;
|
|
32501
|
+
return ((_b = (_a = children.find(x => preferredIds === null || preferredIds === void 0 ? void 0 : preferredIds.includes(x.id))) !== null && _a !== void 0 ? _a : children.find(x => this.items.some(y => y.id === x.id))) !== null && _b !== void 0 ? _b : children[0]);
|
|
32502
|
+
}
|
|
32503
|
+
/*
|
|
32504
|
+
* Removes the items so the render can claim their graphics, then disposes whatever it left unclaimed.
|
|
32505
|
+
*/
|
|
32506
|
+
renderInPlaceOf(removeIds, render) {
|
|
32507
|
+
const pooledBefore = new Set(this.pendingHandoffPool);
|
|
32508
|
+
for (const id of removeIds) {
|
|
32509
|
+
this.RemoveItemById({
|
|
32510
|
+
menuItemId: id,
|
|
32511
|
+
allowHandoff: true
|
|
32512
|
+
});
|
|
32513
|
+
}
|
|
32514
|
+
const pooled = this.pendingHandoffPool.filter(x => !pooledBefore.has(x));
|
|
32515
|
+
try {
|
|
32516
|
+
return render();
|
|
32517
|
+
}
|
|
32518
|
+
finally {
|
|
32519
|
+
this.disposePooled(x => pooled.includes(x));
|
|
32520
|
+
}
|
|
32521
|
+
}
|
|
32162
32522
|
isHandoffCapable(renderManager) {
|
|
32163
32523
|
return Boolean(renderManager) && typeof renderManager.PrepareHandoff === "function";
|
|
32164
32524
|
}
|
|
32525
|
+
isStyleSwapCapable(renderManager) {
|
|
32526
|
+
return Boolean(renderManager) && typeof renderManager.SwapStyle === "function";
|
|
32527
|
+
}
|
|
32165
32528
|
// Resolves the hand-off key a menu item's data would have.
|
|
32166
32529
|
computeHandoffKey(item, modelSpace) {
|
|
32167
32530
|
if (item.Type === BModels.MenuItem.EType.CadTileset) {
|
|
@@ -32237,12 +32600,15 @@
|
|
|
32237
32600
|
}
|
|
32238
32601
|
// Disposes everything left unclaimed in the pending-hand-off pool.
|
|
32239
32602
|
FlushPendingHandoffs() {
|
|
32603
|
+
this.disposePooled(() => true);
|
|
32604
|
+
}
|
|
32605
|
+
disposePooled(match) {
|
|
32240
32606
|
var _a;
|
|
32241
32607
|
if (!this.pendingHandoffPool.length) {
|
|
32242
32608
|
return;
|
|
32243
32609
|
}
|
|
32244
|
-
const pool = this.pendingHandoffPool;
|
|
32245
|
-
this.pendingHandoffPool =
|
|
32610
|
+
const pool = this.pendingHandoffPool.filter(match);
|
|
32611
|
+
this.pendingHandoffPool = this.pendingHandoffPool.filter(x => !match(x));
|
|
32246
32612
|
for (const item of pool) {
|
|
32247
32613
|
try {
|
|
32248
32614
|
(_a = item.renderManager) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
@@ -32253,6 +32619,26 @@
|
|
|
32253
32619
|
this.ClearSeriesSegments(item.id);
|
|
32254
32620
|
}
|
|
32255
32621
|
}
|
|
32622
|
+
/**
|
|
32623
|
+
* Returns the tags and attenuation the item's view authored, before any bookmark wrote over them.
|
|
32624
|
+
*/
|
|
32625
|
+
GetAuthoredAlternation(item) {
|
|
32626
|
+
var _a;
|
|
32627
|
+
let authored = this.authoredAlternations.get(item);
|
|
32628
|
+
if (!authored) {
|
|
32629
|
+
const eItem = item;
|
|
32630
|
+
const tItem = item;
|
|
32631
|
+
authored = JSON.parse(JSON.stringify({
|
|
32632
|
+
id: item.id,
|
|
32633
|
+
Type: item.Type,
|
|
32634
|
+
BruceEntity: { SelectedExpandLayers: (_a = eItem.BruceEntity) === null || _a === void 0 ? void 0 : _a.SelectedExpandLayers },
|
|
32635
|
+
attenuation: tItem.attenuation,
|
|
32636
|
+
attenuationMax: tItem.attenuationMax
|
|
32637
|
+
}));
|
|
32638
|
+
this.authoredAlternations.set(item, authored);
|
|
32639
|
+
}
|
|
32640
|
+
return authored;
|
|
32641
|
+
}
|
|
32256
32642
|
GetEnabledItemIds() {
|
|
32257
32643
|
return this.items.map(x => x.id);
|
|
32258
32644
|
}
|
|
@@ -33316,6 +33702,7 @@
|
|
|
33316
33702
|
})(exports.EMenuItemState || (exports.EMenuItemState = {}));
|
|
33317
33703
|
// Icons are inline so the library stays dependency free.
|
|
33318
33704
|
const ICON_CHECK = `<svg viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 4L4 7L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
33705
|
+
const ICON_RADIO = `<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" r="3.5" fill="white"/></svg>`;
|
|
33319
33706
|
const ICON_PARTIAL_CHECK = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 12H16" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
33320
33707
|
const ICON_CHEV_DOWN = `<svg viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 1L8 8L1 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
33321
33708
|
const ICON_CHEV_RIGHT = `<svg viewBox="0 0 10 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 1.5L8.5 8.5L1.5 15.5" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
@@ -33519,6 +33906,10 @@
|
|
|
33519
33906
|
margin-right: 8px;
|
|
33520
33907
|
}
|
|
33521
33908
|
|
|
33909
|
+
.NextspaceMenuItemRow >.NextspaceMenuItemRowItem >.NextspaceMenuItemRowCheckbox[is-radio="true"] {
|
|
33910
|
+
border-radius: 50%;
|
|
33911
|
+
}
|
|
33912
|
+
|
|
33522
33913
|
.NextspaceMenuItemRow >.NextspaceMenuItemRowItem >.NextspaceMenuItemRowToggle {
|
|
33523
33914
|
margin-right: 3px;
|
|
33524
33915
|
}
|
|
@@ -33769,13 +34160,15 @@
|
|
|
33769
34160
|
}
|
|
33770
34161
|
return this._waitedForView ? "No view is loaded." : "Loading..";
|
|
33771
34162
|
}
|
|
33772
|
-
_renderRow(item, depth, parent) {
|
|
34163
|
+
_renderRow(item, depth, parent, radioParent) {
|
|
33773
34164
|
var _a;
|
|
33774
34165
|
if (!(item === null || item === void 0 ? void 0 : item.id)) {
|
|
33775
34166
|
return;
|
|
33776
34167
|
}
|
|
33777
34168
|
const isFolder = !item.Type || item.Type === BModels.MenuItem.EType.None;
|
|
33778
|
-
const
|
|
34169
|
+
const isRadioFolder = isFolder && Boolean(item.childrenAsRadios);
|
|
34170
|
+
// Radios are the folder's whole point, so they show even when the folder also hides its children.
|
|
34171
|
+
const children = item.hideChildren && !isRadioFolder ? [] : ((_a = item.Children) !== null && _a !== void 0 ? _a : []);
|
|
33779
34172
|
const hasChildren = children.length > 0;
|
|
33780
34173
|
const row = document.createElement("div");
|
|
33781
34174
|
row.className = "NextspaceMenuItemRow";
|
|
@@ -33807,8 +34200,9 @@
|
|
|
33807
34200
|
}
|
|
33808
34201
|
const checkbox = document.createElement("div");
|
|
33809
34202
|
checkbox.className = "NextspaceMenuItemRowCheckbox";
|
|
34203
|
+
checkbox.setAttribute("is-radio", radioParent ? "true" : "false");
|
|
33810
34204
|
checkbox.onclick = () => {
|
|
33811
|
-
this._toggleItem(item);
|
|
34205
|
+
this._toggleItem(item, radioParent);
|
|
33812
34206
|
};
|
|
33813
34207
|
itemElement.appendChild(checkbox);
|
|
33814
34208
|
const title = document.createElement("div");
|
|
@@ -33858,10 +34252,11 @@
|
|
|
33858
34252
|
itemElement,
|
|
33859
34253
|
checkboxElement: checkbox,
|
|
33860
34254
|
countElement: count,
|
|
33861
|
-
childrenElement
|
|
34255
|
+
childrenElement,
|
|
34256
|
+
radioParent
|
|
33862
34257
|
});
|
|
33863
34258
|
for (const child of children) {
|
|
33864
|
-
this._renderRow(child, depth + 1, childrenElement);
|
|
34259
|
+
this._renderRow(child, depth + 1, childrenElement, isRadioFolder ? item : undefined);
|
|
33865
34260
|
}
|
|
33866
34261
|
}
|
|
33867
34262
|
_getOpen(itemId, depth) {
|
|
@@ -33896,7 +34291,10 @@
|
|
|
33896
34291
|
for (const row of Array.from(this._rows.values())) {
|
|
33897
34292
|
const state = this._resolveState(row.item, enabledIds);
|
|
33898
34293
|
row.itemElement.setAttribute("is-enabled", state === exports.EMenuItemState.Disabled ? "false" : "true");
|
|
33899
|
-
if (state
|
|
34294
|
+
if (row.radioParent && state !== exports.EMenuItemState.Disabled) {
|
|
34295
|
+
row.checkboxElement.innerHTML = ICON_RADIO;
|
|
34296
|
+
}
|
|
34297
|
+
else if (state === exports.EMenuItemState.Enabled) {
|
|
33900
34298
|
row.checkboxElement.innerHTML = ICON_CHECK;
|
|
33901
34299
|
}
|
|
33902
34300
|
else if (state === exports.EMenuItemState.ChildEnabled) {
|
|
@@ -33911,17 +34309,33 @@
|
|
|
33911
34309
|
* Works out a single item's state, rolling up children so a folder can report a partial state.
|
|
33912
34310
|
*/
|
|
33913
34311
|
_resolveState(item, enabledIds) {
|
|
33914
|
-
var _a;
|
|
34312
|
+
var _a, _b;
|
|
33915
34313
|
const isFolder = !item.Type || item.Type === BModels.MenuItem.EType.None;
|
|
33916
34314
|
if (!isFolder) {
|
|
33917
34315
|
return enabledIds.has(item.id) ? exports.EMenuItemState.Enabled : exports.EMenuItemState.Disabled;
|
|
33918
34316
|
}
|
|
34317
|
+
// Only one radio is ever enabled, so the folder is as enabled as that one.
|
|
34318
|
+
if (item.childrenAsRadios && ((_a = item.Children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
34319
|
+
const states = item.Children.map(x => this._resolveState(x, enabledIds));
|
|
34320
|
+
if (states.includes(exports.EMenuItemState.Enabled)) {
|
|
34321
|
+
return exports.EMenuItemState.Enabled;
|
|
34322
|
+
}
|
|
34323
|
+
return states.includes(exports.EMenuItemState.ChildEnabled) ? exports.EMenuItemState.ChildEnabled : exports.EMenuItemState.Disabled;
|
|
34324
|
+
}
|
|
33919
34325
|
// Folders derive from the leaves below them rather than their own enabled flag.
|
|
33920
34326
|
let actionCount = 0;
|
|
33921
34327
|
let enabledActionCount = 0;
|
|
33922
34328
|
const traverse = (current) => {
|
|
33923
|
-
var _a;
|
|
34329
|
+
var _a, _b;
|
|
33924
34330
|
const currentIsFolder = !current.Type || current.Type === BModels.MenuItem.EType.None;
|
|
34331
|
+
// A radio folder counts as one choice rather than as each of its radios.
|
|
34332
|
+
if (currentIsFolder && current.childrenAsRadios && ((_a = current.Children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
34333
|
+
actionCount += 1;
|
|
34334
|
+
if (this._resolveState(current, enabledIds) === exports.EMenuItemState.Enabled) {
|
|
34335
|
+
enabledActionCount += 1;
|
|
34336
|
+
}
|
|
34337
|
+
return;
|
|
34338
|
+
}
|
|
33925
34339
|
if (!currentIsFolder) {
|
|
33926
34340
|
actionCount += 1;
|
|
33927
34341
|
if (enabledIds.has(current.id)) {
|
|
@@ -33929,11 +34343,11 @@
|
|
|
33929
34343
|
}
|
|
33930
34344
|
return;
|
|
33931
34345
|
}
|
|
33932
|
-
if ((
|
|
34346
|
+
if ((_b = current.Children) === null || _b === void 0 ? void 0 : _b.length) {
|
|
33933
34347
|
current.Children.forEach(traverse);
|
|
33934
34348
|
}
|
|
33935
34349
|
};
|
|
33936
|
-
(
|
|
34350
|
+
(_b = item.Children) === null || _b === void 0 ? void 0 : _b.forEach(traverse);
|
|
33937
34351
|
if (actionCount <= 0) {
|
|
33938
34352
|
return enabledIds.has(item.id) ? exports.EMenuItemState.Enabled : exports.EMenuItemState.Disabled;
|
|
33939
34353
|
}
|
|
@@ -33959,7 +34373,7 @@
|
|
|
33959
34373
|
row.countElement.textContent = count.toLocaleString();
|
|
33960
34374
|
}
|
|
33961
34375
|
}
|
|
33962
|
-
_toggleItem(item) {
|
|
34376
|
+
_toggleItem(item, radioParent) {
|
|
33963
34377
|
var _a;
|
|
33964
34378
|
const manager = (_a = this._widget) === null || _a === void 0 ? void 0 : _a._getManager();
|
|
33965
34379
|
if (!manager) {
|
|
@@ -33967,7 +34381,21 @@
|
|
|
33967
34381
|
}
|
|
33968
34382
|
const enabledIds = new Set(manager.GetEnabledItemIds());
|
|
33969
34383
|
const state = this._resolveState(item, enabledIds);
|
|
33970
|
-
|
|
34384
|
+
// A radio stays picked until another one is, the folder's own checkbox turns them all off.
|
|
34385
|
+
if (radioParent && state === exports.EMenuItemState.Enabled) {
|
|
34386
|
+
return;
|
|
34387
|
+
}
|
|
34388
|
+
let siblingIds = [];
|
|
34389
|
+
if (radioParent && state === exports.EMenuItemState.Disabled) {
|
|
34390
|
+
siblingIds = radioParent.Children.filter(x => x !== item).flatMap(x => this._getEnabledIdsUnder(x, enabledIds));
|
|
34391
|
+
}
|
|
34392
|
+
if (siblingIds.length) {
|
|
34393
|
+
manager.SwapItem({
|
|
34394
|
+
fromIds: siblingIds,
|
|
34395
|
+
item
|
|
34396
|
+
});
|
|
34397
|
+
}
|
|
34398
|
+
else if (state === exports.EMenuItemState.Enabled) {
|
|
33971
34399
|
this._disableItem(item);
|
|
33972
34400
|
}
|
|
33973
34401
|
else {
|
|
@@ -33977,6 +34405,16 @@
|
|
|
33977
34405
|
}
|
|
33978
34406
|
this._stateQueue.Call(true);
|
|
33979
34407
|
}
|
|
34408
|
+
/*
|
|
34409
|
+
* Returns the highest enabled ids at or below the item, since removing one removes everything under it.
|
|
34410
|
+
*/
|
|
34411
|
+
_getEnabledIdsUnder(item, enabledIds) {
|
|
34412
|
+
var _a;
|
|
34413
|
+
if (enabledIds.has(item.id)) {
|
|
34414
|
+
return [item.id];
|
|
34415
|
+
}
|
|
34416
|
+
return ((_a = item.Children) !== null && _a !== void 0 ? _a : []).flatMap(x => this._getEnabledIdsUnder(x, enabledIds));
|
|
34417
|
+
}
|
|
33980
34418
|
_disableItem(item) {
|
|
33981
34419
|
var _a, _b;
|
|
33982
34420
|
const manager = (_a = this._widget) === null || _a === void 0 ? void 0 : _a._getManager();
|
|
@@ -35505,33 +35943,50 @@
|
|
|
35505
35943
|
}
|
|
35506
35944
|
const renderedItemIds = [];
|
|
35507
35945
|
if ((menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) && (enabledIds === null || enabledIds === void 0 ? void 0 : enabledIds.length)) {
|
|
35508
|
-
const
|
|
35946
|
+
const alternateItems = (item) => {
|
|
35947
|
+
var _a, _b, _c, _d;
|
|
35948
|
+
// The project view menu item contains the instruction to enable tags, the bookmark specifies which ones.
|
|
35949
|
+
if (item.Type == BModels.MenuItem.EType.Entities && ((_a = item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandLayers)) {
|
|
35950
|
+
const eItem = item;
|
|
35951
|
+
// A setting the bookmark leaves out gets the view's own value back, not the last bookmark's.
|
|
35952
|
+
const authored = manager.GetAuthoredAlternation(item);
|
|
35953
|
+
const eItemAlt = alternations[item.id];
|
|
35954
|
+
const tags = (_b = eItemAlt === null || eItemAlt === void 0 ? void 0 : eItemAlt.BruceEntity) === null || _b === void 0 ? void 0 : _b.SelectedExpandLayers;
|
|
35955
|
+
eItem.BruceEntity = {
|
|
35956
|
+
...eItem.BruceEntity,
|
|
35957
|
+
SelectedExpandLayers: tags !== undefined ? tags : (_c = authored.BruceEntity) === null || _c === void 0 ? void 0 : _c.SelectedExpandLayers,
|
|
35958
|
+
};
|
|
35959
|
+
}
|
|
35960
|
+
else if (item.Type == BModels.MenuItem.EType.EntityTileset) {
|
|
35961
|
+
const tItem = item;
|
|
35962
|
+
const authored = manager.GetAuthoredAlternation(item);
|
|
35963
|
+
const tItemAlt = alternations[item.id];
|
|
35964
|
+
const hasAttenuation = (tItemAlt === null || tItemAlt === void 0 ? void 0 : tItemAlt.attenuation) !== undefined || (tItemAlt === null || tItemAlt === void 0 ? void 0 : tItemAlt.attenuationMax) !== undefined;
|
|
35965
|
+
const source = hasAttenuation ? tItemAlt : authored;
|
|
35966
|
+
tItem.attenuation = source.attenuation;
|
|
35967
|
+
tItem.attenuationMax = source.attenuationMax;
|
|
35968
|
+
}
|
|
35969
|
+
(_d = item.Children) === null || _d === void 0 ? void 0 : _d.forEach(alternateItems);
|
|
35970
|
+
};
|
|
35971
|
+
/*
|
|
35972
|
+
* Lays each picked style over a copy, so it never stays on the view's item for a later bookmark.
|
|
35973
|
+
*/
|
|
35974
|
+
const styleItems = (item) => {
|
|
35509
35975
|
var _a;
|
|
35510
|
-
|
|
35511
|
-
|
|
35512
|
-
|
|
35513
|
-
|
|
35514
|
-
const eItem = item;
|
|
35515
|
-
if (eItem.BruceEntity.ExpandLayers) {
|
|
35516
|
-
const eItemAlt = alternations[item.id];
|
|
35517
|
-
eItem.BruceEntity = {
|
|
35518
|
-
...eItem.BruceEntity,
|
|
35519
|
-
SelectedExpandLayers: (_a = eItemAlt.BruceEntity) === null || _a === void 0 ? void 0 : _a.SelectedExpandLayers,
|
|
35520
|
-
};
|
|
35521
|
-
}
|
|
35522
|
-
}
|
|
35523
|
-
else if (item.Type == BModels.MenuItem.EType.EntityTileset) {
|
|
35524
|
-
const tItem = item;
|
|
35525
|
-
const tItemAlt = alternations[item.id];
|
|
35526
|
-
tItem.attenuation = tItemAlt.attenuation;
|
|
35527
|
-
tItem.attenuationMax = tItemAlt.attenuationMax;
|
|
35528
|
-
}
|
|
35976
|
+
let next = alternations[item.id] ? exports.MenuItemStyles.ApplyAlternation(item, alternations[item.id]) : item;
|
|
35977
|
+
const children = (_a = item.Children) === null || _a === void 0 ? void 0 : _a.map(styleItems);
|
|
35978
|
+
if (children === null || children === void 0 ? void 0 : children.some((child, i) => child !== item.Children[i])) {
|
|
35979
|
+
next = { ...next, Children: children };
|
|
35529
35980
|
}
|
|
35981
|
+
return next;
|
|
35982
|
+
};
|
|
35983
|
+
const traverseItems = async (item) => {
|
|
35530
35984
|
if (enabledIds.includes(item.id)) {
|
|
35531
35985
|
const itemId = await manager.RenderItem({
|
|
35532
35986
|
item: item,
|
|
35533
35987
|
getters: getters,
|
|
35534
|
-
modelSpace: contentType === BModels.ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE
|
|
35988
|
+
modelSpace: contentType === BModels.ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE,
|
|
35989
|
+
preferredIds: enabledIds
|
|
35535
35990
|
});
|
|
35536
35991
|
renderedItemIds.push(itemId);
|
|
35537
35992
|
}
|
|
@@ -35541,8 +35996,11 @@
|
|
|
35541
35996
|
}
|
|
35542
35997
|
}
|
|
35543
35998
|
};
|
|
35544
|
-
|
|
35545
|
-
|
|
35999
|
+
// Tag and attenuation alternations write into the view's items, since Navigator's tag tree reads them back.
|
|
36000
|
+
menuItems.forEach(alternateItems);
|
|
36001
|
+
const styled = menuItems.map(styleItems);
|
|
36002
|
+
for (let i = 0; i < styled.length; i++) {
|
|
36003
|
+
await traverseItems(styled[i]);
|
|
35546
36004
|
}
|
|
35547
36005
|
}
|
|
35548
36006
|
return {
|
|
@@ -54978,7 +55436,7 @@ void main() {
|
|
|
54978
55436
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
54979
55437
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
54980
55438
|
|
|
54981
|
-
const VERSION = "7.6.
|
|
55439
|
+
const VERSION = "7.6.3";
|
|
54982
55440
|
/**
|
|
54983
55441
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
54984
55442
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|