bruce-cesium 6.9.0 → 6.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2597,7 +2597,9 @@
2597
2597
  constructor(params) {
2598
2598
  this.widgetId = BModels.ObjectUtils.UId();
2599
2599
  let { viewer, container, manager } = params;
2600
- if (!container) {
2600
+ // A host app can pass an undefined viewer (eg. mid-teardown); fall back to
2601
+ // no container rather than crashing on viewer.container.
2602
+ if (!container && viewer) {
2601
2603
  container = viewer.container;
2602
2604
  }
2603
2605
  this._viewer = viewer;
@@ -3153,7 +3155,10 @@
3153
3155
  this.customControls = new Map();
3154
3156
  this._generateStyles();
3155
3157
  this._generateElement();
3156
- this._viewer[VIEWER_VIEW_BAR_WIDGET_KEY] = this;
3158
+ // Guard against a host app constructing this widget with no live viewer.
3159
+ if (this._viewer) {
3160
+ this._viewer[VIEWER_VIEW_BAR_WIDGET_KEY] = this;
3161
+ }
3157
3162
  }
3158
3163
  Dispose() {
3159
3164
  super.Dispose();
@@ -23350,7 +23355,10 @@
23350
23355
  this._viewId = params.viewId;
23351
23356
  this._generateStyles();
23352
23357
  this._generateElement();
23353
- this._viewer[VIEWER_LEFT_PANEL_WIDGET_KEY] = this;
23358
+ // Guard against a host app constructing this widget with no live viewer.
23359
+ if (this._viewer) {
23360
+ this._viewer[VIEWER_LEFT_PANEL_WIDGET_KEY] = this;
23361
+ }
23354
23362
  this._loading = this.loadBookmarks();
23355
23363
  this._loading.then(() => {
23356
23364
  if (params.runFirstBookmark && this.bookmarks.length) {
@@ -23792,10 +23800,18 @@
23792
23800
  return;
23793
23801
  }
23794
23802
  const clazz = this.customTabs.get(this._enabledPanelTab);
23795
- tabContent = new clazz({
23796
- widget: this,
23797
- container: container
23798
- });
23803
+ try {
23804
+ tabContent = new clazz({
23805
+ widget: this,
23806
+ container: container
23807
+ });
23808
+ }
23809
+ catch (e) {
23810
+ // Partner-supplied tab content class; a throwing constructor shouldn't take
23811
+ // down the whole panel.
23812
+ console.error(e);
23813
+ return;
23814
+ }
23799
23815
  break;
23800
23816
  }
23801
23817
  this._enabledTabContent = tabContent;
@@ -23817,17 +23833,18 @@
23817
23833
  document.documentElement.style.setProperty(VIEWER_LEFT_PANEL_CSS_VAR_LEFT, "0px");
23818
23834
  }
23819
23835
  SelectBookmark(bookmark) {
23836
+ var _a;
23820
23837
  const isFirstEnabled = !this._lastEnabledBookmarkId;
23821
23838
  this._lastEnabledBookmarkId = bookmark.ID;
23822
23839
  exports.ViewRenderEngine.Render({
23823
- apiGetter: this._apiGetters.GetBruceGetter(),
23840
+ apiGetter: (_a = this._apiGetters) === null || _a === void 0 ? void 0 : _a.GetBruceGetter(),
23824
23841
  bookmark: bookmark,
23825
23842
  bookmarkId: bookmark.ID,
23826
23843
  manager: this._manager,
23827
23844
  skipTransition: isFirstEnabled,
23828
23845
  viewer: this._viewer,
23829
23846
  viewId: this._viewId
23830
- });
23847
+ }).catch((e) => console.error(e));
23831
23848
  if (this._onBookmarkSelect) {
23832
23849
  this._onBookmarkSelect.Trigger(bookmark);
23833
23850
  }
@@ -26523,7 +26540,10 @@
26523
26540
  }
26524
26541
  this._updateBookmarks();
26525
26542
  });
26526
- this._viewer[VIEWER_BOOKMARKS_WIDGET_KEY] = this;
26543
+ // Guard against a host app constructing this widget with no live viewer.
26544
+ if (this._viewer) {
26545
+ this._viewer[VIEWER_BOOKMARKS_WIDGET_KEY] = this;
26546
+ }
26527
26547
  }
26528
26548
  LoadViewId(params) {
26529
26549
  let { viewId, runFirstBookmark, autoPlay, bookmarkId } = params;
@@ -26901,9 +26921,10 @@
26901
26921
  `;
26902
26922
  }
26903
26923
  _updateBookmarks() {
26924
+ var _a;
26904
26925
  const bookmarks = this.bookmarks;
26905
26926
  this._element.style.display = bookmarks.length ? "flex" : "none";
26906
- const api = this._apiGetters.GetBruceApi();
26927
+ const api = (_a = this._apiGetters) === null || _a === void 0 ? void 0 : _a.GetBruceApi();
26907
26928
  const row = this._row;
26908
26929
  row.innerHTML = "";
26909
26930
  for (const bookmark of bookmarks) {
@@ -26945,7 +26966,7 @@
26945
26966
  skipTransition: isFirstEnabled,
26946
26967
  viewId: this._viewId,
26947
26968
  viewer: this._viewer
26948
- });
26969
+ }).catch((e) => console.error(e));
26949
26970
  }
26950
26971
  _updateBookmark() {
26951
26972
  const allBookmarks = this._row.querySelectorAll(".NextspaceBookmarksRowItem");
@@ -29026,7 +29047,12 @@
29026
29047
  this._cesiumEventRemoval = null;
29027
29048
  }
29028
29049
  _listenSelection() {
29050
+ var _a, _b;
29029
29051
  this._disposeCesiumEvent();
29052
+ // No live viewer/scene to attach cursor listeners to (eg. widget constructed without one).
29053
+ if (!((_b = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) === null || _b === void 0 ? void 0 : _b.canvas)) {
29054
+ return;
29055
+ }
29030
29056
  const events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
29031
29057
  const throttle = new CursorBarMouseEventThrottle(this._viewer);
29032
29058
  let lastHoverPos = null;
@@ -31348,6 +31374,8 @@
31348
31374
  this._isWalkthroughActive = false;
31349
31375
  this._walkthroughBar = null;
31350
31376
  this._isVR = false;
31377
+ // Fires whenever walkthrough mode is toggled on/off via this widget's own button.
31378
+ this.OnWalkthroughChange = new BModels.BruceEvent();
31351
31379
  this._generateStyles();
31352
31380
  this._generateElement();
31353
31381
  this._listenToRenders();
@@ -31996,6 +32024,9 @@
31996
32024
  this._updateStablePivot(pivot);
31997
32025
  });
31998
32026
  }
32027
+ IsWalkthroughActive() {
32028
+ return this._isWalkthroughActive;
32029
+ }
31999
32030
  _toggleWalkthrough() {
32000
32031
  this._setWalkthrough(!this._isWalkthroughActive);
32001
32032
  }
@@ -32020,6 +32051,7 @@
32020
32051
  (_c = this._walkthroughBar) === null || _c === void 0 ? void 0 : _c.Dispose();
32021
32052
  this._walkthroughBar = null;
32022
32053
  }
32054
+ this.OnWalkthroughChange.Trigger(active);
32023
32055
  }
32024
32056
  _toggleVR() {
32025
32057
  this._setVR(!this._isVR);
@@ -38291,7 +38323,7 @@
38291
38323
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
38292
38324
  })(exports.StyleUtils || (exports.StyleUtils = {}));
38293
38325
 
38294
- const VERSION = "6.9.0";
38326
+ const VERSION = "6.9.2";
38295
38327
  /**
38296
38328
  * Updates the environment instance used by bruce-cesium to one specified.
38297
38329
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.