bruce-cesium 7.4.8 → 7.5.0

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.
@@ -1464,6 +1464,48 @@
1464
1464
  ViewUtils.GetModelSpace = GetModelSpace;
1465
1465
  })(exports.ViewUtils || (exports.ViewUtils = {}));
1466
1466
 
1467
+ // End time of the frames already being requested for a viewer, so overlapping animations share one loop.
1468
+ const renderDriverEnds = new WeakMap();
1469
+ // A browser frame where there is one, so the requests keep pace with Cesium's own loop.
1470
+ function nextFrame(callback) {
1471
+ if (typeof requestAnimationFrame === "function") {
1472
+ requestAnimationFrame(callback);
1473
+ }
1474
+ else {
1475
+ setTimeout(callback, 16);
1476
+ }
1477
+ }
1478
+ /**
1479
+ * Keeps frames coming until a time based animation has ended, then draws one more for its final value.
1480
+ */
1481
+ function requestRendersFor(viewer, durationMs) {
1482
+ var _a;
1483
+ const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
1484
+ if (typeof (scene === null || scene === void 0 ? void 0 : scene.requestRender) !== "function" || ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer))) {
1485
+ return;
1486
+ }
1487
+ scene.requestRender();
1488
+ const endAt = Date.now() + Math.max(durationMs || 0, 0);
1489
+ if (renderDriverEnds.has(viewer)) {
1490
+ renderDriverEnds.set(viewer, Math.max(renderDriverEnds.get(viewer), endAt));
1491
+ return;
1492
+ }
1493
+ renderDriverEnds.set(viewer, endAt);
1494
+ const tick = () => {
1495
+ var _a;
1496
+ if ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer)) {
1497
+ renderDriverEnds.delete(viewer);
1498
+ return;
1499
+ }
1500
+ scene.requestRender();
1501
+ if (Date.now() >= renderDriverEnds.get(viewer)) {
1502
+ renderDriverEnds.delete(viewer);
1503
+ return;
1504
+ }
1505
+ nextFrame(tick);
1506
+ };
1507
+ nextFrame(tick);
1508
+ }
1467
1509
  function getColor(viewer, obj) {
1468
1510
  let value = null;
1469
1511
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
@@ -1580,6 +1622,7 @@
1580
1622
  this.durationMs = 0;
1581
1623
  }
1582
1624
  this.startTime = new Date();
1625
+ requestRendersFor(this.viewer, this.durationMs);
1583
1626
  }
1584
1627
  IsDone() {
1585
1628
  const now = new Date();
@@ -1631,12 +1674,14 @@
1631
1674
  }
1632
1675
  if (!this.paused) {
1633
1676
  this.startTime = new Date();
1677
+ requestRendersFor(this.viewer, this.durationMs);
1634
1678
  }
1635
1679
  }
1636
1680
  Play() {
1637
1681
  if (this.paused) {
1638
1682
  this.paused = false;
1639
1683
  this.startTime = new Date();
1684
+ requestRendersFor(this.viewer, this.durationMs);
1640
1685
  }
1641
1686
  }
1642
1687
  GetValue() {
@@ -1714,6 +1759,8 @@
1714
1759
  setMark(startColor, mark);
1715
1760
  setMark(color, mark);
1716
1761
  let startTime = new Date();
1762
+ // A feature's colour change does not ask for a frame, the final one included.
1763
+ requestRendersFor(viewer, durationMs);
1717
1764
  let removal = viewer.scene.postUpdate.addEventListener(() => {
1718
1765
  if (!isFeatureAlive(viewer, feature)) {
1719
1766
  removal === null || removal === void 0 ? void 0 : removal();
@@ -1785,6 +1832,7 @@
1785
1832
  this.startPos3d = Cesium.Cartesian3.clone(this.targetPos3d);
1786
1833
  }
1787
1834
  this.startTime = new Date();
1835
+ requestRendersFor(this.viewer, this.durationMs);
1788
1836
  }
1789
1837
  GetValue() {
1790
1838
  const now = new Date();
@@ -1816,6 +1864,7 @@
1816
1864
  this.startHeadingDeg = 0;
1817
1865
  }
1818
1866
  this.startTime = new Date();
1867
+ requestRendersFor(this.viewer, this.durationMs);
1819
1868
  }
1820
1869
  IsDone() {
1821
1870
  const now = new Date();
@@ -31327,12 +31376,13 @@
31327
31376
  .NextspaceLeftPanel >.NextspaceLeftPanelTabContent {
31328
31377
  display: none;
31329
31378
  width: 300px;
31330
- height: 100%;
31331
31379
  position: absolute;
31332
31380
  top: 0;
31381
+ bottom: 0;
31333
31382
  left: 50px;
31334
31383
  background-color: #21272a;
31335
- padding: 40px 30px 30px;
31384
+ box-sizing: content-box;
31385
+ padding: 30px 20px 12px 20px;
31336
31386
  flex-direction: column;
31337
31387
  flex-grow: 1;
31338
31388
  flex-shrink: 1;
@@ -34147,6 +34197,18 @@
34147
34197
  return typeof ((_b = bSettings.camera) === null || _b === void 0 ? void 0 : _b.zoom) !== "number";
34148
34198
  }
34149
34199
  ViewRenderEngine.IsBookmarkSupported = IsBookmarkSupported;
34200
+ /**
34201
+ * Drops the view's default bookmark when it is not a Cesium scene, so the view renders without it.
34202
+ * A bookmark the caller asked for by ID is kept.
34203
+ */
34204
+ function KeepDefaultBookmark(view, requestedId, bookmark) {
34205
+ // Legacy views store a different bookmark shape.
34206
+ if (requestedId || !bookmark || (view === null || view === void 0 ? void 0 : view.DataVersion) == 1) {
34207
+ return bookmark;
34208
+ }
34209
+ return IsBookmarkSupported(bookmark) ? bookmark : null;
34210
+ }
34211
+ ViewRenderEngine.KeepDefaultBookmark = KeepDefaultBookmark;
34150
34212
  async function Render(params) {
34151
34213
  var _a, _b;
34152
34214
  if (!params.manager && params.viewer) {
@@ -34184,6 +34246,7 @@
34184
34246
  viewId: params.viewId,
34185
34247
  bookmarkId: bookmarkId
34186
34248
  })).bookmark : null;
34249
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34187
34250
  }
34188
34251
  if (!assertIteration$1(params.viewer, iteration)) {
34189
34252
  return;
@@ -34244,6 +34307,7 @@
34244
34307
  viewId: params.viewId,
34245
34308
  bookmarkId: bookmarkId
34246
34309
  })).bookmark : null;
34310
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34247
34311
  }
34248
34312
  const viewer = params.manager.Viewer;
34249
34313
  const scene = viewer.scene;
@@ -50810,7 +50874,7 @@ void main() {
50810
50874
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
50811
50875
  })(exports.StyleUtils || (exports.StyleUtils = {}));
50812
50876
 
50813
- const VERSION = "7.4.8";
50877
+ const VERSION = "7.5.0";
50814
50878
  /**
50815
50879
  * Updates the environment instance used by bruce-cesium to one specified.
50816
50880
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.