bruce-cesium 7.4.7 → 7.4.8

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.
@@ -31045,6 +31045,36 @@
31045
31045
 
31046
31046
  const VIEWER_LEFT_PANEL_WIDGET_KEY = "_viewerLeftPanelWidget";
31047
31047
  const VIEWER_LEFT_PANEL_CSS_VAR_LEFT = "--nextspace-left-panel-width";
31048
+ // Size of a tab button's icon, and the drawing grid the built-in icons are authored on.
31049
+ const TAB_ICON_SIZE = 32;
31050
+ /**
31051
+ * Builds a tab's svg icon, fitted to the button whatever grid it was drawn on.
31052
+ */
31053
+ function CreateTabIconSvg(icon) {
31054
+ const SVG_NS = "http://www.w3.org/2000/svg";
31055
+ const parsed = /<svg[\s>]/i.test(icon !== null && icon !== void 0 ? icon : "") ? new DOMParser().parseFromString(icon, "image/svg+xml") : null;
31056
+ const root = parsed === null || parsed === void 0 ? void 0 : parsed.documentElement;
31057
+ let svg;
31058
+ if (root && root.localName === "svg" && !root.getElementsByTagName("parsererror").length) {
31059
+ svg = document.importNode(root, true);
31060
+ if (!svg.getAttribute("viewBox")) {
31061
+ // Without one the drawing would not scale, so its own size becomes the grid.
31062
+ const width = parseFloat(svg.getAttribute("width"));
31063
+ const height = parseFloat(svg.getAttribute("height"));
31064
+ if (width > 0 && height > 0) {
31065
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
31066
+ }
31067
+ }
31068
+ }
31069
+ else {
31070
+ svg = document.createElementNS(SVG_NS, "svg");
31071
+ svg.setAttribute("viewBox", `0 0 ${TAB_ICON_SIZE} ${TAB_ICON_SIZE}`);
31072
+ svg.innerHTML = icon !== null && icon !== void 0 ? icon : "";
31073
+ }
31074
+ svg.setAttribute("width", String(TAB_ICON_SIZE));
31075
+ svg.setAttribute("height", String(TAB_ICON_SIZE));
31076
+ return svg;
31077
+ }
31048
31078
  class WidgetLeftPanel extends exports.Widget.AWidget {
31049
31079
  get ViewId() {
31050
31080
  return this._viewId;
@@ -31143,7 +31173,7 @@
31143
31173
  if (this._viewId !== viewId) {
31144
31174
  return;
31145
31175
  }
31146
- this.bookmarks = data.bookmarks;
31176
+ this.bookmarks = data.bookmarks.filter(exports.ViewRenderEngine.IsBookmarkSupported);
31147
31177
  this.bookmarkGroups = groups;
31148
31178
  }
31149
31179
  catch (e) {
@@ -31265,6 +31295,18 @@
31265
31295
  cursor: pointer;
31266
31296
  }
31267
31297
 
31298
+ .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon >img {
31299
+ display: block;
31300
+ max-width: 100%;
31301
+ max-height: 100%;
31302
+ object-fit: contain;
31303
+ }
31304
+
31305
+ .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon >i {
31306
+ color: #fff;
31307
+ font-size: 18px;
31308
+ }
31309
+
31268
31310
  .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled="true"] >.NextspaceLeftPanelButtonIcon {
31269
31311
  background-color: #fff;
31270
31312
  }
@@ -31273,6 +31315,10 @@
31273
31315
  filter: invert(1);
31274
31316
  }
31275
31317
 
31318
+ .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled="true"] >.NextspaceLeftPanelButtonIcon >i {
31319
+ color: #000;
31320
+ }
31321
+
31276
31322
  .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-disabled="true"] {
31277
31323
  opacity: .5;
31278
31324
  pointer-events: none
@@ -31376,6 +31422,10 @@
31376
31422
  icon = params.iconImgUrl;
31377
31423
  iconSource = "file-url";
31378
31424
  }
31425
+ else if (params.iconFontClass) {
31426
+ icon = params.iconFontClass;
31427
+ iconSource = "font";
31428
+ }
31379
31429
  else if (params.svgStr) {
31380
31430
  icon = params.svgStr;
31381
31431
  iconSource = "svg";
@@ -31390,21 +31440,17 @@
31390
31440
  const buttonBookmarksIcon = document.createElement("div");
31391
31441
  buttonBookmarksIcon.className = "NextspaceLeftPanelButtonIcon";
31392
31442
  if (iconSource == "svg") {
31393
- const buttonBookmarksIconSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
31394
- buttonBookmarksIconSvg.setAttribute("viewBox", "0 0 32 32");
31395
- buttonBookmarksIconSvg.setAttribute("width", "32");
31396
- buttonBookmarksIconSvg.setAttribute("height", "32");
31397
- buttonBookmarksIconSvg.innerHTML = icon;
31398
- buttonBookmarksIcon.appendChild(buttonBookmarksIconSvg);
31443
+ buttonBookmarksIcon.appendChild(CreateTabIconSvg(icon));
31399
31444
  }
31400
31445
  else if (iconSource == "file-url") {
31401
31446
  const buttonBookmarksIconImg = document.createElement("img");
31402
31447
  buttonBookmarksIconImg.src = icon;
31403
31448
  buttonBookmarksIcon.appendChild(buttonBookmarksIconImg);
31404
- buttonBookmarksIcon.setAttribute("style", `
31405
- max-width: 32px;
31406
- max-height: 32px;
31407
- `);
31449
+ }
31450
+ else if (iconSource == "font") {
31451
+ const buttonBookmarksIconFont = document.createElement("i");
31452
+ buttonBookmarksIconFont.className = icon;
31453
+ buttonBookmarksIcon.appendChild(buttonBookmarksIconFont);
31408
31454
  }
31409
31455
  tabButton.appendChild(buttonBookmarksIcon);
31410
31456
  tabButton.onclick = () => {
@@ -34080,6 +34126,27 @@
34080
34126
  scene.globe.depthTestAgainstTerrain = Boolean(gOcclusion);
34081
34127
  }
34082
34128
  (function (ViewRenderEngine) {
34129
+ const SUPPORTED_CONTENT_TYPES = [
34130
+ BModels.ProjectViewBookmark.EContentType.WEB_3D,
34131
+ BModels.ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE,
34132
+ BModels.ProjectViewBookmark.EContentType.WEB_3D_SPLIT_PLUGIN
34133
+ ];
34134
+ /**
34135
+ * Whether a bookmark is a Cesium scene this engine can render.
34136
+ */
34137
+ function IsBookmarkSupported(bookmark) {
34138
+ var _a, _b;
34139
+ if (!bookmark) {
34140
+ return false;
34141
+ }
34142
+ const bSettings = ((_a = bookmark.Settings) !== null && _a !== void 0 ? _a : {});
34143
+ if (bSettings.contentType) {
34144
+ return SUPPORTED_CONTENT_TYPES.includes(bSettings.contentType);
34145
+ }
34146
+ // A bookmark ported from the 2D Navigator carries a zoom level rather than a 3D camera.
34147
+ return typeof ((_b = bSettings.camera) === null || _b === void 0 ? void 0 : _b.zoom) !== "number";
34148
+ }
34149
+ ViewRenderEngine.IsBookmarkSupported = IsBookmarkSupported;
34083
34150
  async function Render(params) {
34084
34151
  var _a, _b;
34085
34152
  if (!params.manager && params.viewer) {
@@ -34380,7 +34447,7 @@
34380
34447
  if (counter != this.reloadCounter) {
34381
34448
  return;
34382
34449
  }
34383
- this.bookmarks = data.bookmarks;
34450
+ this.bookmarks = data.bookmarks.filter(exports.ViewRenderEngine.IsBookmarkSupported);
34384
34451
  }
34385
34452
  catch (e) {
34386
34453
  console.error(e);
@@ -50743,7 +50810,7 @@ void main() {
50743
50810
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
50744
50811
  })(exports.StyleUtils || (exports.StyleUtils = {}));
50745
50812
 
50746
- const VERSION = "7.4.7";
50813
+ const VERSION = "7.4.8";
50747
50814
  /**
50748
50815
  * Updates the environment instance used by bruce-cesium to one specified.
50749
50816
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -50796,6 +50863,7 @@ void main() {
50796
50863
  exports.WidgetInfoView = WidgetInfoView;
50797
50864
  exports.VIEWER_LEFT_PANEL_WIDGET_KEY = VIEWER_LEFT_PANEL_WIDGET_KEY;
50798
50865
  exports.VIEWER_LEFT_PANEL_CSS_VAR_LEFT = VIEWER_LEFT_PANEL_CSS_VAR_LEFT;
50866
+ exports.CreateTabIconSvg = CreateTabIconSvg;
50799
50867
  exports.WidgetLeftPanel = WidgetLeftPanel;
50800
50868
  exports.WidgetNavCompass = WidgetNavCompass$$1;
50801
50869
  exports.VIEWER_VIEW_BAR_WIDGET_KEY = VIEWER_VIEW_BAR_WIDGET_KEY;