bruce-cesium 2.5.2 → 2.5.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.
@@ -1975,7 +1975,6 @@
1975
1975
  rendered = rendered.filter(function (x) { return x != null; });
1976
1976
  if (rendered.length) {
1977
1977
  rootEntity_1 = new Cesium.Entity({});
1978
- params.viewer.entities.add(rootEntity_1);
1979
1978
  rootEntity_1._siblingGraphics = [];
1980
1979
  rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_h = params.viewer) === null || _h === void 0 ? void 0 : _h.terrainProvider);
1981
1980
  rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
@@ -2179,7 +2178,7 @@
2179
2178
  recordHeightRef: heightRef,
2180
2179
  returnHeightRef: heightRef
2181
2180
  }),
2182
- show: false
2181
+ show: true
2183
2182
  });
2184
2183
  }
2185
2184
  }
@@ -2226,7 +2225,7 @@
2226
2225
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2227
2226
  },
2228
2227
  position: pos === null || pos === void 0 ? void 0 : pos.clone(),
2229
- show: false
2228
+ show: true
2230
2229
  });
2231
2230
  if (outline && outlineWidth > 0) {
2232
2231
  if (!exHeightRef && outlineHeight > 0) {
@@ -2275,16 +2274,10 @@
2275
2274
  recordHeightRef: heightRef,
2276
2275
  returnHeightRef: heightRef
2277
2276
  }),
2278
- show: false
2277
+ show: true
2279
2278
  });
2280
2279
  }
2281
2280
  if (cEntity) {
2282
- params.viewer.entities.add(cEntity);
2283
- if (siblings) {
2284
- siblings.forEach(function (sibling) {
2285
- params.viewer.entities.add(sibling);
2286
- });
2287
- }
2288
2281
  cEntity._siblingGraphics = siblings;
2289
2282
  }
2290
2283
  return [2 /*return*/, cEntity];
@@ -2452,9 +2445,8 @@
2452
2445
  recordHeightRef: heightRef,
2453
2446
  returnHeightRef: heightRef
2454
2447
  }),
2455
- show: false
2448
+ show: true
2456
2449
  });
2457
- params.viewer.entities.add(cEntity);
2458
2450
  return cEntity;
2459
2451
  }
2460
2452
  Polyline.Render = Render;
@@ -2579,7 +2571,7 @@
2579
2571
  recordHeightRef: heightRef,
2580
2572
  returnHeightRef: heightRef
2581
2573
  }),
2582
- show: false
2574
+ show: true
2583
2575
  });
2584
2576
  cEntity._siblingGraphics = [];
2585
2577
  if (width > 0 && cLineColor) {
@@ -2630,9 +2622,8 @@
2630
2622
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2631
2623
  shadows: Cesium.ShadowMode.ENABLED
2632
2624
  },
2633
- show: false
2625
+ show: true
2634
2626
  });
2635
- params.viewer.entities.add(cEntityBorder);
2636
2627
  cEntityBorder._parentEntity = cEntity;
2637
2628
  cEntity._siblingGraphics.push(cEntityBorder);
2638
2629
  for (var i = 0; i < holePosses.length; i++) {
@@ -2662,14 +2653,12 @@
2662
2653
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2663
2654
  shadows: Cesium.ShadowMode.ENABLED,
2664
2655
  },
2665
- show: false
2656
+ show: true
2666
2657
  });
2667
2658
  cEntity._siblingGraphics.push(cEntityHole);
2668
2659
  cEntityHole._parentEntity = cEntity;
2669
- params.viewer.entities.add(cEntityHole);
2670
2660
  }
2671
2661
  }
2672
- params.viewer.entities.add(cEntity);
2673
2662
  return cEntity;
2674
2663
  }
2675
2664
  Polygon.Render = Render;
@@ -2794,7 +2783,7 @@
2794
2783
  },
2795
2784
  orientation: orientation,
2796
2785
  position: pos,
2797
- show: false
2786
+ show: true
2798
2787
  });
2799
2788
  var model = cEntity.model;
2800
2789
  model._clientFileId = params.lodClientFileId;
@@ -2802,7 +2791,6 @@
2802
2791
  record: scale,
2803
2792
  style: styleScale
2804
2793
  };
2805
- params.viewer.entities.add(cEntity);
2806
2794
  return cEntity;
2807
2795
  }
2808
2796
  Model3d.Render = Render;
@@ -3540,18 +3528,29 @@
3540
3528
  updateCEntityShow(viewer, sibling, show, true);
3541
3529
  }
3542
3530
  }
3543
- if (viewer.entities.contains(visual)) {
3544
- visual.show = show;
3531
+ /**
3532
+ * Do NOT use ".show" as it causes crashes in Cesium polylines that are clamped to ground.
3533
+ * We could target them specifically here but we may be getting overall performance gain by just removing stuff from the scene.
3534
+ */
3535
+ if (!show && viewer.entities.contains(visual)) {
3536
+ viewer.entities.remove(visual);
3537
+ }
3538
+ else if (show && !viewer.entities.contains(visual)) {
3539
+ viewer.entities.add(visual);
3545
3540
  }
3546
3541
  }
3547
3542
  function updateEntityShow(viewer, visual, show) {
3548
- if (!isAlive$1(viewer, visual)) {
3549
- return;
3550
- }
3551
3543
  if (visual instanceof Cesium.Entity) {
3544
+ if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
3545
+ return;
3546
+ }
3552
3547
  updateCEntityShow(viewer, visual, show, false);
3548
+ return;
3553
3549
  }
3554
- else if (visual instanceof Cesium.Primitive) {
3550
+ if (!isAlive$1(viewer, visual)) {
3551
+ return;
3552
+ }
3553
+ if (visual instanceof Cesium.Primitive) {
3555
3554
  if (viewer.scene.primitives.contains(visual)) {
3556
3555
  visual.show = show;
3557
3556
  }
@@ -14806,7 +14805,7 @@
14806
14805
  ViewerUtils.CreateWidgets = CreateWidgets;
14807
14806
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
14808
14807
 
14809
- var VERSION$1 = "2.5.2";
14808
+ var VERSION$1 = "2.5.3";
14810
14809
 
14811
14810
  exports.VERSION = VERSION$1;
14812
14811
  exports.CesiumViewMonitor = CesiumViewMonitor;