bruce-cesium 6.8.8 → 6.9.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.
- package/dist/bruce-cesium.es5.js +2127 -1282
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +2124 -1279
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/cesium-animated-property.js +7 -3
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +12 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +75 -9
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/widgets/common/cursorbar-mouse-event-throttle.js +173 -0
- package/dist/lib/widgets/common/cursorbar-mouse-event-throttle.js.map +1 -0
- package/dist/lib/widgets/common/walkthrough.js +8 -0
- package/dist/lib/widgets/common/walkthrough.js.map +1 -1
- package/dist/lib/widgets/controls-view-bar/widget-control-view-bar-search.js +10 -18
- package/dist/lib/widgets/controls-view-bar/widget-control-view-bar-search.js.map +1 -1
- package/dist/lib/widgets/widget-cursorbar.js +51 -713
- package/dist/lib/widgets/widget-cursorbar.js.map +1 -1
- package/dist/lib/widgets/widget-nav-compass-hold-loader.js +86 -0
- package/dist/lib/widgets/widget-nav-compass-hold-loader.js.map +1 -0
- package/dist/lib/widgets/widget-nav-compass-utils.js +470 -0
- package/dist/lib/widgets/widget-nav-compass-utils.js.map +1 -0
- package/dist/lib/widgets/widget-nav-compass-walkthrough-bar.js +419 -0
- package/dist/lib/widgets/widget-nav-compass-walkthrough-bar.js.map +1 -0
- package/dist/lib/widgets/widget-nav-compass.js +499 -229
- package/dist/lib/widgets/widget-nav-compass.js.map +1 -1
- package/dist/lib/widgets/widget-view-bar.js +36 -13
- package/dist/lib/widgets/widget-view-bar.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-cad-render-manager.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +8 -2
- package/dist/types/widgets/common/cursorbar-mouse-event-throttle.d.ts +47 -0
- package/dist/types/widgets/common/walkthrough.d.ts +9 -0
- package/dist/types/widgets/widget-cursorbar.d.ts +1 -14
- package/dist/types/widgets/widget-nav-compass-hold-loader.d.ts +16 -0
- package/dist/types/widgets/widget-nav-compass-utils.d.ts +80 -0
- package/dist/types/widgets/widget-nav-compass-walkthrough-bar.d.ts +31 -0
- package/dist/types/widgets/widget-nav-compass.d.ts +45 -10
- package/dist/types/widgets/widget-view-bar.d.ts +1 -0
- package/package.json +3 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -494,8 +494,10 @@
|
|
|
494
494
|
this.startColor = this.startColor.clone();
|
|
495
495
|
}
|
|
496
496
|
if (!this.startColor) {
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
// No prior colour to animate from (eg: a freshly-created graphic).
|
|
498
|
+
// Starting from WHITE would itself be a visible flash, so just skip the animation.
|
|
499
|
+
this.startColor = this.targetColor.clone();
|
|
500
|
+
this.durationMs = 0;
|
|
499
501
|
}
|
|
500
502
|
this.startTime = new Date();
|
|
501
503
|
}
|
|
@@ -608,7 +610,9 @@
|
|
|
608
610
|
}
|
|
609
611
|
}
|
|
610
612
|
else {
|
|
611
|
-
|
|
613
|
+
// No prior colour to animate from (eg: a freshly-loaded feature).
|
|
614
|
+
// Starting from WHITE would itself be a visible flash, so start from the target colour instead.
|
|
615
|
+
startColor = (color === null || color === void 0 ? void 0 : color.clone) ? color.clone() : color;
|
|
612
616
|
}
|
|
613
617
|
}
|
|
614
618
|
// Don't animate if the colour is the same.
|
|
@@ -2710,6 +2714,9 @@
|
|
|
2710
2714
|
if (this._element && this._element.parentElement) {
|
|
2711
2715
|
this._element.parentElement.removeChild(this._element);
|
|
2712
2716
|
}
|
|
2717
|
+
if (this._results && this._results.parentElement) {
|
|
2718
|
+
this._results.parentElement.removeChild(this._results);
|
|
2719
|
+
}
|
|
2713
2720
|
}
|
|
2714
2721
|
Toggle() {
|
|
2715
2722
|
if (this.Disposed) {
|
|
@@ -2732,16 +2739,9 @@
|
|
|
2732
2739
|
style.id = this.STYLESHEET_ID;
|
|
2733
2740
|
style.innerHTML = `
|
|
2734
2741
|
.NextspaceSearchBar {
|
|
2735
|
-
top: 10px;
|
|
2736
|
-
right: 10px;
|
|
2737
2742
|
display: flex;
|
|
2738
2743
|
box-sizing: border-box;
|
|
2739
|
-
|
|
2740
|
-
background: #21272a;
|
|
2741
|
-
border-radius: 9px;
|
|
2742
|
-
height: 48px;
|
|
2743
|
-
padding-left: 2px;
|
|
2744
|
-
padding-right: 2px;
|
|
2744
|
+
height: 100%;
|
|
2745
2745
|
font-family: sans-serif;
|
|
2746
2746
|
}
|
|
2747
2747
|
|
|
@@ -2774,17 +2774,13 @@
|
|
|
2774
2774
|
}
|
|
2775
2775
|
|
|
2776
2776
|
.NextspaceSearchBarResults {
|
|
2777
|
-
background
|
|
2778
|
-
|
|
2779
|
-
|
|
2777
|
+
/* No background of its own: it's a normal-flow section of the same
|
|
2778
|
+
translucent/blurred ViewBar panel, not a separate floating box. */
|
|
2779
|
+
border-top: 1px solid rgba(255, 255, 255, 0.12);
|
|
2780
|
+
display: none;
|
|
2780
2781
|
flex-direction: column;
|
|
2781
|
-
|
|
2782
|
-
padding: 12px 8px 8px;
|
|
2783
|
-
position: absolute;
|
|
2784
|
-
top: calc(100% - 6px);
|
|
2782
|
+
padding: 8px;
|
|
2785
2783
|
width: 100%;
|
|
2786
|
-
left: 0;
|
|
2787
|
-
z-index: 1;
|
|
2788
2784
|
}
|
|
2789
2785
|
|
|
2790
2786
|
.NextspaceSearchBarResultsItem {
|
|
@@ -2871,9 +2867,9 @@
|
|
|
2871
2867
|
};
|
|
2872
2868
|
const results = document.createElement("div");
|
|
2873
2869
|
results.className = "NextspaceSearchBarResults";
|
|
2874
|
-
element.appendChild(results);
|
|
2875
2870
|
results.style.display = "none";
|
|
2876
2871
|
this._results = results;
|
|
2872
|
+
this.WidgetViewBar.Element.appendChild(results);
|
|
2877
2873
|
this.Container.appendChild(element);
|
|
2878
2874
|
this._element = element;
|
|
2879
2875
|
}
|
|
@@ -3180,13 +3176,13 @@
|
|
|
3180
3176
|
style.id = this.STYLESHEET_ID;
|
|
3181
3177
|
style.innerHTML = `
|
|
3182
3178
|
.NextspaceViewBar {
|
|
3183
|
-
|
|
3184
|
-
|
|
3179
|
+
background: rgba(33, 39, 42, 0.8);
|
|
3180
|
+
backdrop-filter: blur(20px);
|
|
3181
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
3185
3182
|
border-radius: 9px;
|
|
3186
3183
|
display: flex;
|
|
3184
|
+
flex-direction: column;
|
|
3187
3185
|
flex-shrink: 1;
|
|
3188
|
-
height: 48px;
|
|
3189
|
-
justify-content: center;
|
|
3190
3186
|
position: absolute;
|
|
3191
3187
|
z-index: 1;
|
|
3192
3188
|
top: 10px;
|
|
@@ -3198,6 +3194,14 @@
|
|
|
3198
3194
|
box-sizing: border-box;
|
|
3199
3195
|
}
|
|
3200
3196
|
|
|
3197
|
+
.NextspaceViewBarRow {
|
|
3198
|
+
align-items: center;
|
|
3199
|
+
display: flex;
|
|
3200
|
+
flex-shrink: 0;
|
|
3201
|
+
height: 44px;
|
|
3202
|
+
justify-content: center;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3201
3205
|
.NextspaceViewBarControl {
|
|
3202
3206
|
align-items: center;
|
|
3203
3207
|
border-radius: 0;
|
|
@@ -3213,9 +3217,19 @@
|
|
|
3213
3217
|
width: 46px;
|
|
3214
3218
|
}
|
|
3215
3219
|
|
|
3220
|
+
.NextspaceViewBarControl:first-of-type {
|
|
3221
|
+
border-radius: 9px 0 0 9px;
|
|
3222
|
+
padding-left: 8px;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
.NextspaceViewBarControl:last-of-type {
|
|
3226
|
+
border-radius: 0 9px 9px 0;
|
|
3227
|
+
padding-right: 8px;
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3216
3230
|
.NextspaceViewBarControlIcon {
|
|
3217
|
-
width:
|
|
3218
|
-
height:
|
|
3231
|
+
width: 28px;
|
|
3232
|
+
height: 28px;
|
|
3219
3233
|
display: flex;
|
|
3220
3234
|
align-items: center;
|
|
3221
3235
|
justify-content: center;
|
|
@@ -3231,6 +3245,7 @@
|
|
|
3231
3245
|
|
|
3232
3246
|
.NextspaceViewBarControl[is-enabled="true"] {
|
|
3233
3247
|
background: #33b1ff;
|
|
3248
|
+
box-shadow: inset 0 2px 0 0 #64c4ff;
|
|
3234
3249
|
}
|
|
3235
3250
|
|
|
3236
3251
|
.NextspaceViewBarEndBreaker {
|
|
@@ -3248,6 +3263,10 @@
|
|
|
3248
3263
|
_generateElement() {
|
|
3249
3264
|
const element = document.createElement("div");
|
|
3250
3265
|
element.className = "NextspaceViewBar";
|
|
3266
|
+
const row = document.createElement("div");
|
|
3267
|
+
row.className = "NextspaceViewBarRow";
|
|
3268
|
+
element.appendChild(row);
|
|
3269
|
+
this._row = row;
|
|
3251
3270
|
this.Container.appendChild(element);
|
|
3252
3271
|
this._element = element;
|
|
3253
3272
|
this._addBarControl({
|
|
@@ -3255,7 +3274,7 @@
|
|
|
3255
3274
|
title: "Search",
|
|
3256
3275
|
iconDisabled: {
|
|
3257
3276
|
icon: `
|
|
3258
|
-
<svg class="" width="
|
|
3277
|
+
<svg class="" width="28" height="28" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.3283 6C9.73857 6 6 9.73857 6 14.3283C6 18.918 9.73857 22.6566 14.3283 22.6566C16.3242 22.6566 18.1571 21.9479 19.5937 20.7714L24.5663 25.7439C24.643 25.8239 24.7349 25.8877 24.8366 25.9316C24.9383 25.9756 25.0478 25.9988 25.1586 26C25.2694 26.0011 25.3793 25.9801 25.4819 25.9382C25.5845 25.8963 25.6777 25.8344 25.756 25.756C25.8344 25.6777 25.8963 25.5845 25.9382 25.4819C25.9801 25.3793 26.0011 25.2694 26 25.1586C25.9988 25.0478 25.9756 24.9383 25.9316 24.8366C25.8877 24.7349 25.8239 24.643 25.7439 24.5663L20.7714 19.5937C21.9479 18.1571 22.6566 16.3242 22.6566 14.3283C22.6566 9.73857 18.918 6 14.3283 6ZM14.3283 7.66566C18.0178 7.66566 20.9909 10.6388 20.9909 14.3283C20.9909 18.0178 18.0178 20.9909 14.3283 20.9909C10.6388 20.9909 7.66566 18.0178 7.66566 14.3283C7.66566 10.6388 10.6388 7.66566 14.3283 7.66566Z" fill="white"></path></svg>
|
|
3259
3278
|
`,
|
|
3260
3279
|
iconSource: "svg"
|
|
3261
3280
|
},
|
|
@@ -3263,7 +3282,7 @@
|
|
|
3263
3282
|
});
|
|
3264
3283
|
const breaker = document.createElement("div");
|
|
3265
3284
|
breaker.className = "NextspaceViewBarEndBreaker";
|
|
3266
|
-
this.
|
|
3285
|
+
this._row.appendChild(breaker);
|
|
3267
3286
|
this._addBarControl({
|
|
3268
3287
|
control: "fullscreen",
|
|
3269
3288
|
title: "Fullscreen",
|
|
@@ -3289,7 +3308,7 @@
|
|
|
3289
3308
|
AddBarControl(params) {
|
|
3290
3309
|
this.customControls.set(params.control, params.content);
|
|
3291
3310
|
// We insert before the end breaker.
|
|
3292
|
-
const endBreaker = this.
|
|
3311
|
+
const endBreaker = this._row.querySelector(".NextspaceViewBarEndBreaker");
|
|
3293
3312
|
const afterElement = endBreaker ? endBreaker.previousElementSibling : null;
|
|
3294
3313
|
let icon;
|
|
3295
3314
|
let iconSource;
|
|
@@ -3360,21 +3379,21 @@
|
|
|
3360
3379
|
}
|
|
3361
3380
|
}
|
|
3362
3381
|
else {
|
|
3363
|
-
this.
|
|
3382
|
+
this._row.appendChild(tabButton);
|
|
3364
3383
|
}
|
|
3365
3384
|
switch (control) {
|
|
3366
3385
|
case "fullscreen":
|
|
3367
3386
|
controller = new WidgetControlViewBarFullscreen({
|
|
3368
3387
|
widget: this,
|
|
3369
3388
|
element: tabButton,
|
|
3370
|
-
container: this.
|
|
3389
|
+
container: this._row
|
|
3371
3390
|
});
|
|
3372
3391
|
break;
|
|
3373
3392
|
case "searchbar":
|
|
3374
3393
|
controller = new WidgetControlViewBarSearch({
|
|
3375
3394
|
widget: this,
|
|
3376
3395
|
element: tabButton,
|
|
3377
|
-
container: this.
|
|
3396
|
+
container: this._row
|
|
3378
3397
|
});
|
|
3379
3398
|
break;
|
|
3380
3399
|
default:
|
|
@@ -3385,7 +3404,7 @@
|
|
|
3385
3404
|
const clazz = this.customControls.get(control);
|
|
3386
3405
|
controller = new clazz({
|
|
3387
3406
|
widget: this,
|
|
3388
|
-
container: this.
|
|
3407
|
+
container: this._row
|
|
3389
3408
|
});
|
|
3390
3409
|
break;
|
|
3391
3410
|
}
|
|
@@ -6324,7 +6343,12 @@
|
|
|
6324
6343
|
cache.isIsolatedAny = register.GetIsIsolatedAny();
|
|
6325
6344
|
}
|
|
6326
6345
|
if (cache.isIsolatedAny) {
|
|
6327
|
-
|
|
6346
|
+
if (cache.isolationOpacity === undefined) {
|
|
6347
|
+
cache.isolationOpacity = register.GetIsolationOpacity();
|
|
6348
|
+
}
|
|
6349
|
+
if (cache.isolationOpacity == null) {
|
|
6350
|
+
return false;
|
|
6351
|
+
}
|
|
6328
6352
|
}
|
|
6329
6353
|
}
|
|
6330
6354
|
// We show all regos in the same highest priority level.
|
|
@@ -6378,10 +6402,19 @@
|
|
|
6378
6402
|
}
|
|
6379
6403
|
}
|
|
6380
6404
|
if (refresh === true || (refresh !== false && (refresh === null || refresh === void 0 ? void 0 : refresh.opacity))) {
|
|
6381
|
-
|
|
6405
|
+
let effectiveOpacity = state.opacity;
|
|
6406
|
+
if ((effectiveOpacity == null || effectiveOpacity == 1) && !state.isolated && visible) {
|
|
6407
|
+
if (cache.isolationOpacity === undefined) {
|
|
6408
|
+
cache.isolationOpacity = register.GetIsolationOpacity();
|
|
6409
|
+
}
|
|
6410
|
+
if (cache.isolationOpacity != null) {
|
|
6411
|
+
effectiveOpacity = cache.isolationOpacity;
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
if (effectiveOpacity != null && effectiveOpacity != 1) {
|
|
6382
6415
|
exports.EntityUtils.SetOpacity({
|
|
6383
6416
|
entity: rego.visual,
|
|
6384
|
-
opacity:
|
|
6417
|
+
opacity: effectiveOpacity,
|
|
6385
6418
|
viewer: viewer,
|
|
6386
6419
|
requestRender: false
|
|
6387
6420
|
});
|
|
@@ -6521,6 +6554,10 @@
|
|
|
6521
6554
|
// Caches GetIsIsolatedAny(). `null` means "unknown, recompute".
|
|
6522
6555
|
// Invalidated on any write that could affect isolation.
|
|
6523
6556
|
this.isolatedAnyCache = null;
|
|
6557
|
+
// Caches GetIsolationOpacity(). `undefined` means "unknown, recompute", `null` means
|
|
6558
|
+
// "isolation (if any) is the legacy boolean/full-hide kind, not a numeric dim".
|
|
6559
|
+
// Invalidated alongside isolatedAnyCache.
|
|
6560
|
+
this.isolationOpacityCache = undefined;
|
|
6524
6561
|
// Lazy OverrideStates() bookkeeping. See cancelLazyOverride()/startLazyOverride().
|
|
6525
6562
|
this.lazyOverrideToken = 0;
|
|
6526
6563
|
this.lazyOverrideActive = false;
|
|
@@ -6702,12 +6739,12 @@
|
|
|
6702
6739
|
if (!state || isBlankState(state)) {
|
|
6703
6740
|
return;
|
|
6704
6741
|
}
|
|
6742
|
+
const updateAll = state.hasOwnProperty("isolated");
|
|
6705
6743
|
const refresh = {
|
|
6706
6744
|
highlighted: state.hasOwnProperty("highlighted"),
|
|
6707
6745
|
selected: state.hasOwnProperty("selected"),
|
|
6708
|
-
opacity: state.hasOwnProperty("opacity")
|
|
6746
|
+
opacity: state.hasOwnProperty("opacity") || updateAll
|
|
6709
6747
|
};
|
|
6710
|
-
const updateAll = state.hasOwnProperty("isolated");
|
|
6711
6748
|
let changed = this.setStateValues(state);
|
|
6712
6749
|
// Update the related Entity.
|
|
6713
6750
|
if (changed && update) {
|
|
@@ -6765,6 +6802,7 @@
|
|
|
6765
6802
|
const updateRefreshMarkers = (state) => {
|
|
6766
6803
|
if (state.hasOwnProperty("isolated")) {
|
|
6767
6804
|
updateAll = true;
|
|
6805
|
+
refreshAccumulated.opacity = true;
|
|
6768
6806
|
}
|
|
6769
6807
|
let values = refresh[state.entityId];
|
|
6770
6808
|
if (!values) {
|
|
@@ -6863,6 +6901,7 @@
|
|
|
6863
6901
|
}
|
|
6864
6902
|
if (keys.includes("isolated")) {
|
|
6865
6903
|
this.isolatedAnyCache = null;
|
|
6904
|
+
this.isolationOpacityCache = undefined;
|
|
6866
6905
|
}
|
|
6867
6906
|
let changed = false;
|
|
6868
6907
|
const eStates = this.states[entityId] || {};
|
|
@@ -7700,18 +7739,28 @@
|
|
|
7700
7739
|
SetIsolated(params) {
|
|
7701
7740
|
var _a;
|
|
7702
7741
|
const { entityIds, isolated: isolate, requestRender, menuItemId, source, doUpdate } = params;
|
|
7742
|
+
let isolatedValue;
|
|
7743
|
+
if (isolate === true) {
|
|
7744
|
+
isolatedValue = true;
|
|
7745
|
+
}
|
|
7746
|
+
else if (typeof isolate === "number" && !isNaN(isolate)) {
|
|
7747
|
+
isolatedValue = Math.max(0, Math.min(1, isolate));
|
|
7748
|
+
}
|
|
7749
|
+
else {
|
|
7750
|
+
isolatedValue = null;
|
|
7751
|
+
}
|
|
7703
7752
|
for (let i = 0; i < entityIds.length; i++) {
|
|
7704
7753
|
const entityId = entityIds[i];
|
|
7705
7754
|
this.setStateValues({
|
|
7706
7755
|
entityId: entityId,
|
|
7707
7756
|
menuItemId: menuItemId,
|
|
7708
7757
|
// Null means it will be deleted from the object.
|
|
7709
|
-
isolated:
|
|
7758
|
+
isolated: isolatedValue
|
|
7710
7759
|
});
|
|
7711
7760
|
const update = {
|
|
7712
7761
|
entityId: entityId,
|
|
7713
7762
|
type: EVisualUpdateType.Update,
|
|
7714
|
-
isolated:
|
|
7763
|
+
isolated: isolatedValue
|
|
7715
7764
|
};
|
|
7716
7765
|
if (source) {
|
|
7717
7766
|
update.source = source;
|
|
@@ -7721,9 +7770,12 @@
|
|
|
7721
7770
|
}
|
|
7722
7771
|
}
|
|
7723
7772
|
if (doUpdate !== false) {
|
|
7773
|
+
// Always a full refresh (not just when isolating): un-isolating these entities can
|
|
7774
|
+
// change opacity for every other entity too, eg: if this was the last isolated
|
|
7775
|
+
// entity, everyone else needs to revert from a numeric dim back to full opacity.
|
|
7724
7776
|
this.updateAllEntities({
|
|
7725
7777
|
requestRender: false,
|
|
7726
|
-
refresh:
|
|
7778
|
+
refresh: true
|
|
7727
7779
|
});
|
|
7728
7780
|
if (requestRender != false) {
|
|
7729
7781
|
this.viewer.scene.requestRender();
|
|
@@ -7736,7 +7788,9 @@
|
|
|
7736
7788
|
entityId: id,
|
|
7737
7789
|
menuItemId: menuItemId
|
|
7738
7790
|
});
|
|
7739
|
-
|
|
7791
|
+
// Truthy check (not strict `=== true`) so a numeric isolate value (see
|
|
7792
|
+
// GetIsolationOpacity()) still counts as "this entity is isolated".
|
|
7793
|
+
return Boolean(state.isolated);
|
|
7740
7794
|
}
|
|
7741
7795
|
GetIsIsolatedAny() {
|
|
7742
7796
|
if (this.isolatedAnyCache == null) {
|
|
@@ -7744,6 +7798,36 @@
|
|
|
7744
7798
|
}
|
|
7745
7799
|
return this.isolatedAnyCache;
|
|
7746
7800
|
}
|
|
7801
|
+
/**
|
|
7802
|
+
* Returns the opacity that should be applied to non-isolated entities while isolation is
|
|
7803
|
+
* active, or null if isolation (if any) is the legacy boolean kind.
|
|
7804
|
+
*/
|
|
7805
|
+
GetIsolationOpacity() {
|
|
7806
|
+
if (this.isolationOpacityCache !== undefined) {
|
|
7807
|
+
return this.isolationOpacityCache;
|
|
7808
|
+
}
|
|
7809
|
+
let sawBooleanIsolate = false;
|
|
7810
|
+
let minOpacity = null;
|
|
7811
|
+
for (const entityStates of Object.values(this.states)) {
|
|
7812
|
+
if (!entityStates) {
|
|
7813
|
+
continue;
|
|
7814
|
+
}
|
|
7815
|
+
for (const item of Object.values(entityStates)) {
|
|
7816
|
+
const isolated = item === null || item === void 0 ? void 0 : item.isolated;
|
|
7817
|
+
if (isolated === true) {
|
|
7818
|
+
sawBooleanIsolate = true;
|
|
7819
|
+
}
|
|
7820
|
+
else if (typeof isolated === "number" && !isNaN(isolated)) {
|
|
7821
|
+
const clamped = Math.max(0, Math.min(1, isolated));
|
|
7822
|
+
if (minOpacity == null || clamped < minOpacity) {
|
|
7823
|
+
minOpacity = clamped;
|
|
7824
|
+
}
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
}
|
|
7828
|
+
this.isolationOpacityCache = sawBooleanIsolate ? null : minOpacity;
|
|
7829
|
+
return this.isolationOpacityCache;
|
|
7830
|
+
}
|
|
7747
7831
|
/**
|
|
7748
7832
|
* Returns all isolated entity ids, without regard to menu item id.
|
|
7749
7833
|
* @returns
|
|
@@ -7770,6 +7854,7 @@
|
|
|
7770
7854
|
if (changed) {
|
|
7771
7855
|
// Mutated `isolated` directly rather than through setStateValues().
|
|
7772
7856
|
this.isolatedAnyCache = false;
|
|
7857
|
+
this.isolationOpacityCache = null;
|
|
7773
7858
|
}
|
|
7774
7859
|
if (changed && (params === null || params === void 0 ? void 0 : params.doUpdate) !== false) {
|
|
7775
7860
|
this.updateAllEntities({
|
|
@@ -14195,6 +14280,9 @@
|
|
|
14195
14280
|
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
14196
14281
|
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
14197
14282
|
this.somethingIsolated = null;
|
|
14283
|
+
// Dim opacity to apply to non-isolated features on load, when isolation is opacity-based rather than a full hide.
|
|
14284
|
+
// Null means isolation (if any) is the legacy full-hide kind.
|
|
14285
|
+
this.somethingIsolatedOpacity = null;
|
|
14198
14286
|
this.somethingIsolatedDateTime = null;
|
|
14199
14287
|
// Entity ID -> rego.
|
|
14200
14288
|
// We retain this information as a quick look-up on what has been registered.
|
|
@@ -14845,9 +14933,12 @@
|
|
|
14845
14933
|
// 5s cache.
|
|
14846
14934
|
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
14847
14935
|
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
14936
|
+
this.somethingIsolatedOpacity = this.visualsManager.GetIsolationOpacity();
|
|
14848
14937
|
this.somethingIsolatedDateTime = new Date();
|
|
14849
14938
|
}
|
|
14850
14939
|
// Override the default hide state set by the style.
|
|
14940
|
+
// Applying the isolation dim/hide here (rather than showing at full opacity and
|
|
14941
|
+
// letting the async styler queue correct it later) avoids a load-in flicker.
|
|
14851
14942
|
let hide = false;
|
|
14852
14943
|
if (state) {
|
|
14853
14944
|
if (state.hidden) {
|
|
@@ -14857,7 +14948,12 @@
|
|
|
14857
14948
|
hide = true;
|
|
14858
14949
|
}
|
|
14859
14950
|
else if (!state.isolated && this.somethingIsolated) {
|
|
14860
|
-
|
|
14951
|
+
if (this.somethingIsolatedOpacity != null) {
|
|
14952
|
+
feature.color = Cesium.Color.WHITE.clone().withAlpha(this.somethingIsolatedOpacity);
|
|
14953
|
+
}
|
|
14954
|
+
else {
|
|
14955
|
+
hide = true;
|
|
14956
|
+
}
|
|
14861
14957
|
}
|
|
14862
14958
|
}
|
|
14863
14959
|
feature.show = !hide;
|
|
@@ -28351,342 +28447,179 @@
|
|
|
28351
28447
|
MeasureCreator.Polygon = Polygon;
|
|
28352
28448
|
})(exports.MeasureCreator || (exports.MeasureCreator = {}));
|
|
28353
28449
|
|
|
28354
|
-
|
|
28355
|
-
|
|
28356
|
-
|
|
28357
|
-
|
|
28358
|
-
|
|
28359
|
-
|
|
28360
|
-
|
|
28361
|
-
|
|
28362
|
-
|
|
28363
|
-
|
|
28364
|
-
|
|
28365
|
-
|
|
28366
|
-
|
|
28367
|
-
|
|
28368
|
-
|
|
28369
|
-
const
|
|
28370
|
-
|
|
28371
|
-
|
|
28450
|
+
// Adaptive hover-raycast delay brackets, keyed by smoothed scene FPS.
|
|
28451
|
+
// Mirrors cesium-navigator-ui's useMouseEvents: <20fps -> 350ms, <40fps -> 250ms, else 150ms.
|
|
28452
|
+
const HOVER_DELAY_FAST_MS = 150;
|
|
28453
|
+
const HOVER_DELAY_MID_MS = 250;
|
|
28454
|
+
const HOVER_DELAY_SLOW_MS = 350;
|
|
28455
|
+
const HOVER_DELAY_BRACKET_FPS_MID = 40;
|
|
28456
|
+
const HOVER_DELAY_BRACKET_FPS_SLOW = 20;
|
|
28457
|
+
// Minimum time between delay-bracket switches, so the delay itself doesn't flicker.
|
|
28458
|
+
const DELAY_SWITCH_MIN_INTERVAL_MS = 1000;
|
|
28459
|
+
// Scene is considered "slow" below ~60fps, with hysteresis to avoid flicker at the boundary.
|
|
28460
|
+
const SLOW_SCENE_ENTER_FPS = 55;
|
|
28461
|
+
const SLOW_SCENE_EXIT_FPS = 62;
|
|
28462
|
+
// While the scene is slow, hover raycasts are debounced until the cursor has been still this long.
|
|
28463
|
+
const CURSOR_SETTLE_MS = 150;
|
|
28464
|
+
// After camera movement ends, wait this long before forcing a fresh hover raycast.
|
|
28465
|
+
const POST_MOVE_RECHECK_DELAY_MS = 100;
|
|
28466
|
+
// Consecutive still frames (position/direction unchanged) before we consider the camera settled.
|
|
28467
|
+
// Cesium's own moveEnd event fires noticeably late, so this is checked independently per-frame.
|
|
28468
|
+
const STILL_FRAMES_TO_SETTLE = 2;
|
|
28469
|
+
// If the cursor hasn't moved more than this many pixels and the render frame hasn't advanced,
|
|
28470
|
+
// skip re-raycasting entirely (same scene, same cursor position -> same pick result).
|
|
28471
|
+
const STALE_RAYCAST_DISTANCE_PX = 2;
|
|
28372
28472
|
/**
|
|
28373
|
-
*
|
|
28374
|
-
*
|
|
28473
|
+
* Tracks scene FPS and camera-movement state to drive an adaptive hover-raycast throttle,
|
|
28474
|
+
* following the design of cesium-navigator-ui's `useMouseEvents` hook as closely as possible
|
|
28475
|
+
* so the cursorbar widget avoids over-sampling hover picks on slow scenes/devices.
|
|
28375
28476
|
*/
|
|
28376
|
-
|
|
28377
|
-
|
|
28378
|
-
|
|
28379
|
-
|
|
28380
|
-
|
|
28477
|
+
class CursorBarMouseEventThrottle {
|
|
28478
|
+
constructor(viewer) {
|
|
28479
|
+
this._renderFrameCount = 0;
|
|
28480
|
+
this._lastCameraPos = null;
|
|
28481
|
+
this._lastCameraDir = null;
|
|
28482
|
+
this._stillFrameCount = 0;
|
|
28483
|
+
this._isCameraMoving = false;
|
|
28484
|
+
this._lastFrameTime = null;
|
|
28485
|
+
this._avgFps = null;
|
|
28486
|
+
this._isSlowScene = false;
|
|
28487
|
+
this._hoverDelayMs = HOVER_DELAY_FAST_MS;
|
|
28488
|
+
this._lastDelaySwitchTime = 0;
|
|
28489
|
+
this._lastRaycast = null;
|
|
28490
|
+
this._onSettle = null;
|
|
28491
|
+
this._postMoveRecheckTimeout = null;
|
|
28492
|
+
this._viewer = viewer;
|
|
28493
|
+
const onPostRender = () => this._onPostRender();
|
|
28494
|
+
viewer.scene.postRender.addEventListener(onPostRender);
|
|
28495
|
+
this._postRenderRemoval = () => viewer.scene.postRender.removeEventListener(onPostRender);
|
|
28496
|
+
const onMoveStart = () => this._setCameraMoving(true);
|
|
28497
|
+
const onMoveEnd = () => this._settleCameraMovement();
|
|
28498
|
+
viewer.camera.moveStart.addEventListener(onMoveStart);
|
|
28499
|
+
viewer.camera.moveEnd.addEventListener(onMoveEnd);
|
|
28500
|
+
this._moveStartRemoval = () => viewer.camera.moveStart.removeEventListener(onMoveStart);
|
|
28501
|
+
this._moveEndRemoval = () => viewer.camera.moveEnd.removeEventListener(onMoveEnd);
|
|
28381
28502
|
}
|
|
28382
|
-
|
|
28383
|
-
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
|
|
28387
|
-
|
|
28388
|
-
|
|
28389
|
-
|
|
28390
|
-
|
|
28391
|
-
|
|
28392
|
-
count += 1;
|
|
28393
|
-
}
|
|
28394
|
-
let forward = actions.get(EAction.Forward);
|
|
28395
|
-
if (forward) {
|
|
28396
|
-
totalHeading += heading;
|
|
28397
|
-
count += 1;
|
|
28398
|
-
}
|
|
28399
|
-
if (actions.get(EAction.Backward)) {
|
|
28400
|
-
totalHeading += heading + 180;
|
|
28401
|
-
count += 1;
|
|
28402
|
-
}
|
|
28403
|
-
if (left && forward) {
|
|
28404
|
-
totalHeading = heading - 45;
|
|
28405
|
-
}
|
|
28406
|
-
else {
|
|
28407
|
-
totalHeading /= count;
|
|
28408
|
-
}
|
|
28409
|
-
return totalHeading;
|
|
28410
|
-
}
|
|
28411
|
-
/**
|
|
28412
|
-
* Updates camera position and orientation based on current actions.
|
|
28413
|
-
*/
|
|
28414
|
-
function doMovementTick(viewer) {
|
|
28415
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28416
|
-
if (!data) {
|
|
28417
|
-
return;
|
|
28418
|
-
}
|
|
28419
|
-
const canvas = viewer.canvas;
|
|
28420
|
-
const camera = viewer.camera;
|
|
28421
|
-
const moveRate = data.moveType == exports.Walkthrough.EMoveType.Walk ? data.walkMoveRate : data.flyMoveRate;
|
|
28422
|
-
if (data.actions.get(EAction.Looking)) {
|
|
28423
|
-
let width = canvas.clientWidth;
|
|
28424
|
-
let height = canvas.clientHeight;
|
|
28425
|
-
// Coordinate (0.0, 0.0) will be where the mouse was clicked.
|
|
28426
|
-
let x = (data.mousePosCurrent.x - data.mousePosStart.x) / width;
|
|
28427
|
-
let y = -(data.mousePosCurrent.y - data.mousePosStart.y) / height;
|
|
28428
|
-
let lookFactor = 0.1;
|
|
28429
|
-
camera.lookRight(x * lookFactor);
|
|
28430
|
-
camera.lookUp(y * lookFactor);
|
|
28431
|
-
}
|
|
28432
|
-
let lookStep = 0.03;
|
|
28433
|
-
if (data.actions.get(EAction.LookLeft)) {
|
|
28434
|
-
camera.lookLeft(lookStep);
|
|
28435
|
-
}
|
|
28436
|
-
if (data.actions.get(EAction.LookRight)) {
|
|
28437
|
-
camera.lookRight(lookStep);
|
|
28503
|
+
Dispose() {
|
|
28504
|
+
var _a, _b, _c;
|
|
28505
|
+
(_a = this._postRenderRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
28506
|
+
(_b = this._moveStartRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
28507
|
+
(_c = this._moveEndRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
28508
|
+
if (this._postMoveRecheckTimeout) {
|
|
28509
|
+
clearTimeout(this._postMoveRecheckTimeout);
|
|
28510
|
+
this._postMoveRecheckTimeout = null;
|
|
28511
|
+
}
|
|
28512
|
+
this._onSettle = null;
|
|
28438
28513
|
}
|
|
28439
|
-
|
|
28440
|
-
|
|
28514
|
+
/**
|
|
28515
|
+
* Called after camera movement settles (or immediately once) to trigger a forced hover
|
|
28516
|
+
* recheck. Matches Navigator's `hoverRecheckRef`.
|
|
28517
|
+
*/
|
|
28518
|
+
SetOnSettle(onSettle) {
|
|
28519
|
+
this._onSettle = onSettle;
|
|
28441
28520
|
}
|
|
28442
|
-
|
|
28443
|
-
|
|
28521
|
+
GetHoverDelayMs() {
|
|
28522
|
+
return this._hoverDelayMs;
|
|
28444
28523
|
}
|
|
28445
|
-
|
|
28446
|
-
|
|
28524
|
+
IsSlowScene() {
|
|
28525
|
+
return this._isSlowScene;
|
|
28447
28526
|
}
|
|
28448
|
-
|
|
28449
|
-
|
|
28527
|
+
IsCameraBusy() {
|
|
28528
|
+
return this._isCameraMoving;
|
|
28450
28529
|
}
|
|
28451
|
-
|
|
28452
|
-
|
|
28530
|
+
/**
|
|
28531
|
+
* True if the scene hasn't rendered a new frame and the cursor is within a couple pixels
|
|
28532
|
+
* of the last raycast, meaning a fresh raycast would return the same result.
|
|
28533
|
+
*/
|
|
28534
|
+
ShouldSkipRaycast(x, y) {
|
|
28535
|
+
if (!this._lastRaycast) {
|
|
28536
|
+
return false;
|
|
28537
|
+
}
|
|
28538
|
+
const sceneUnchanged = this._lastRaycast.frame === this._renderFrameCount;
|
|
28539
|
+
const dx = x - this._lastRaycast.x;
|
|
28540
|
+
const dy = y - this._lastRaycast.y;
|
|
28541
|
+
const cursorSettled = (dx * dx + dy * dy) <= (STALE_RAYCAST_DISTANCE_PX * STALE_RAYCAST_DISTANCE_PX);
|
|
28542
|
+
return sceneUnchanged && cursorSettled;
|
|
28453
28543
|
}
|
|
28454
|
-
|
|
28455
|
-
|
|
28544
|
+
RecordRaycast(x, y) {
|
|
28545
|
+
this._lastRaycast = { frame: this._renderFrameCount, x, y };
|
|
28456
28546
|
}
|
|
28457
|
-
|
|
28458
|
-
|
|
28459
|
-
|
|
28460
|
-
|
|
28461
|
-
|
|
28462
|
-
|
|
28463
|
-
camera.moveBackward(moveRate);
|
|
28464
|
-
}
|
|
28465
|
-
if (data.actions.get(EAction.Left)) {
|
|
28466
|
-
camera.moveLeft(moveRate);
|
|
28467
|
-
}
|
|
28468
|
-
if (data.actions.get(EAction.Right)) {
|
|
28469
|
-
camera.moveRight(moveRate);
|
|
28547
|
+
_setCameraMoving(moving) {
|
|
28548
|
+
this._isCameraMoving = moving;
|
|
28549
|
+
this._stillFrameCount = 0;
|
|
28550
|
+
if (this._postMoveRecheckTimeout) {
|
|
28551
|
+
clearTimeout(this._postMoveRecheckTimeout);
|
|
28552
|
+
this._postMoveRecheckTimeout = null;
|
|
28470
28553
|
}
|
|
28471
28554
|
}
|
|
28472
|
-
|
|
28473
|
-
|
|
28474
|
-
if (
|
|
28475
|
-
|
|
28476
|
-
data.actions.get(EAction.Forward) ||
|
|
28477
|
-
data.actions.get(EAction.Backward)) {
|
|
28478
|
-
const heading = getMovementHeading(viewer);
|
|
28479
|
-
const pos = viewer.camera.positionCartographic;
|
|
28480
|
-
const newPos = _offsetPoint({
|
|
28481
|
-
altitude: pos.height,
|
|
28482
|
-
latitude: Cesium.Math.toDegrees(pos.latitude),
|
|
28483
|
-
longitude: Cesium.Math.toDegrees(pos.longitude)
|
|
28484
|
-
}, moveRate, heading);
|
|
28485
|
-
camera.position = Cesium.Cartesian3.fromDegrees(newPos.longitude, newPos.latitude, newPos.altitude);
|
|
28555
|
+
_settleCameraMovement() {
|
|
28556
|
+
this._isCameraMoving = false;
|
|
28557
|
+
if (this._postMoveRecheckTimeout) {
|
|
28558
|
+
clearTimeout(this._postMoveRecheckTimeout);
|
|
28486
28559
|
}
|
|
28487
|
-
|
|
28488
|
-
|
|
28489
|
-
|
|
28490
|
-
|
|
28491
|
-
|
|
28492
|
-
|
|
28493
|
-
|
|
28494
|
-
|
|
28495
|
-
|
|
28496
|
-
|
|
28497
|
-
|
|
28498
|
-
|
|
28499
|
-
|
|
28500
|
-
|
|
28501
|
-
|
|
28502
|
-
|
|
28503
|
-
|
|
28504
|
-
|
|
28505
|
-
|
|
28506
|
-
|
|
28507
|
-
|
|
28508
|
-
|
|
28509
|
-
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
|
|
28514
|
-
|
|
28515
|
-
|
|
28516
|
-
|
|
28517
|
-
|
|
28518
|
-
|
|
28519
|
-
|
|
28520
|
-
|
|
28521
|
-
|
|
28522
|
-
|
|
28523
|
-
|
|
28524
|
-
|
|
28525
|
-
|
|
28526
|
-
|
|
28527
|
-
data.actions.set(EAction.Forward, keyDown);
|
|
28528
|
-
}
|
|
28529
|
-
else if (key == "s") {
|
|
28530
|
-
data.actions.set(EAction.Backward, keyDown);
|
|
28531
|
-
}
|
|
28532
|
-
else if (key == "a") {
|
|
28533
|
-
data.actions.set(EAction.Left, keyDown);
|
|
28534
|
-
}
|
|
28535
|
-
else if (key == "d") {
|
|
28536
|
-
data.actions.set(EAction.Right, keyDown);
|
|
28537
|
-
}
|
|
28538
|
-
else if (key == "q") {
|
|
28539
|
-
data.actions.set(EAction.Up, keyDown);
|
|
28540
|
-
}
|
|
28541
|
-
else if (key == "e") {
|
|
28542
|
-
data.actions.set(EAction.Down, keyDown);
|
|
28543
|
-
}
|
|
28544
|
-
else if (key == "arrowup") {
|
|
28545
|
-
data.actions.set(EAction.LookUp, keyDown);
|
|
28546
|
-
}
|
|
28547
|
-
else if (key == "arrowdown") {
|
|
28548
|
-
data.actions.set(EAction.LookDown, keyDown);
|
|
28549
|
-
}
|
|
28550
|
-
else if (key == "arrowleft") {
|
|
28551
|
-
data.actions.set(EAction.LookLeft, keyDown);
|
|
28552
|
-
}
|
|
28553
|
-
else if (key == "arrowright") {
|
|
28554
|
-
data.actions.set(EAction.LookRight, keyDown);
|
|
28555
|
-
}
|
|
28556
|
-
}
|
|
28557
|
-
(function (Walkthrough) {
|
|
28558
|
-
let EMoveType;
|
|
28559
|
-
(function (EMoveType) {
|
|
28560
|
-
EMoveType["Walk"] = "WALK";
|
|
28561
|
-
EMoveType["Fly"] = "FLY";
|
|
28562
|
-
})(EMoveType = Walkthrough.EMoveType || (Walkthrough.EMoveType = {}));
|
|
28563
|
-
function Start(params) {
|
|
28564
|
-
Stop(params);
|
|
28565
|
-
const viewer = params.viewer;
|
|
28566
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY] = {
|
|
28567
|
-
walkMoveRate: DEFAULT_WALK_MOVE_RATE,
|
|
28568
|
-
flyMoveRate: DEFAULT_FLY_MOVE_RATE,
|
|
28569
|
-
moveType: DEFAULT_MOVE_TYPE,
|
|
28570
|
-
actions: new Map(),
|
|
28571
|
-
...viewer[VIEWER_WALKTHROUGH_DATA_KEY]
|
|
28572
|
-
};
|
|
28573
|
-
data.handlerScreenSpace = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
|
|
28574
|
-
exports.ViewUtils.SetLockedCameraStatus({
|
|
28575
|
-
viewer: viewer,
|
|
28576
|
-
status: true
|
|
28577
|
-
});
|
|
28578
|
-
let lastCheck;
|
|
28579
|
-
let currentTime = new Date();
|
|
28580
|
-
const interval = setInterval(() => {
|
|
28581
|
-
lastCheck = new Date();
|
|
28582
|
-
if (lastCheck.getTime() - currentTime.getTime() >= (1000 / 60)) {
|
|
28583
|
-
doMovementTick(viewer);
|
|
28584
|
-
currentTime = new Date();
|
|
28585
|
-
}
|
|
28586
|
-
}, 1000 / 60);
|
|
28587
|
-
data.tickRemoval = () => {
|
|
28588
|
-
clearInterval(interval);
|
|
28589
|
-
};
|
|
28590
|
-
let keyDown = (e) => {
|
|
28591
|
-
checkKeybind(viewer, e.key, true);
|
|
28592
|
-
};
|
|
28593
|
-
document.addEventListener("keydown", keyDown, false);
|
|
28594
|
-
let keyUp = (e) => {
|
|
28595
|
-
checkKeybind(viewer, e.key, false);
|
|
28596
|
-
};
|
|
28597
|
-
document.addEventListener("keyup", keyUp, false);
|
|
28598
|
-
data.handlerKeysRemoval = () => {
|
|
28599
|
-
document.removeEventListener("keydown", keyDown);
|
|
28600
|
-
document.removeEventListener("keyup", keyUp);
|
|
28601
|
-
};
|
|
28602
|
-
data.handlerScreenSpace.setInputAction((e) => {
|
|
28603
|
-
data.actions.set(EAction.Looking, true);
|
|
28604
|
-
data.mousePosCurrent = data.mousePosStart = Cesium.Cartesian2.clone(e.position);
|
|
28605
|
-
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
28606
|
-
data.handlerScreenSpace.setInputAction(((e) => {
|
|
28607
|
-
data.mousePosCurrent = e.endPosition;
|
|
28608
|
-
}), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
28609
|
-
data.handlerScreenSpace.setInputAction(() => {
|
|
28610
|
-
data.actions.set(EAction.Looking, false);
|
|
28611
|
-
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
28612
|
-
}
|
|
28613
|
-
Walkthrough.Start = Start;
|
|
28614
|
-
function Stop(params) {
|
|
28615
|
-
var _a, _b;
|
|
28616
|
-
const viewer = params.viewer;
|
|
28617
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28618
|
-
exports.ViewUtils.SetLockedCameraStatus({
|
|
28619
|
-
viewer: viewer,
|
|
28620
|
-
status: false
|
|
28621
|
-
});
|
|
28622
|
-
if (data) {
|
|
28623
|
-
(_a = data.handlerScreenSpace) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
28624
|
-
data.handlerScreenSpace = null;
|
|
28625
|
-
(_b = data.tickRemoval) === null || _b === void 0 ? void 0 : _b.call(data);
|
|
28626
|
-
data.tickRemoval = null;
|
|
28627
|
-
if (data.handlerKeysRemoval) {
|
|
28628
|
-
data.handlerKeysRemoval();
|
|
28629
|
-
data.handlerKeysRemoval = null;
|
|
28630
|
-
}
|
|
28560
|
+
this._postMoveRecheckTimeout = setTimeout(() => {
|
|
28561
|
+
var _a;
|
|
28562
|
+
this._postMoveRecheckTimeout = null;
|
|
28563
|
+
(_a = this._onSettle) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
28564
|
+
}, POST_MOVE_RECHECK_DELAY_MS);
|
|
28565
|
+
}
|
|
28566
|
+
_onPostRender() {
|
|
28567
|
+
this._renderFrameCount++;
|
|
28568
|
+
// Cesium's own moveStart/moveEnd fire noticeably late, so we also independently detect
|
|
28569
|
+
// camera movement by diffing position/direction between consecutive rendered frames.
|
|
28570
|
+
const camera = this._viewer.camera;
|
|
28571
|
+
if (this._lastCameraPos && this._lastCameraDir) {
|
|
28572
|
+
const unchanged = Cesium.Cartesian3.equalsEpsilon(camera.positionWC, this._lastCameraPos, Cesium.Math.EPSILON7) &&
|
|
28573
|
+
Cesium.Cartesian3.equalsEpsilon(camera.directionWC, this._lastCameraDir, Cesium.Math.EPSILON7);
|
|
28574
|
+
if (!unchanged) {
|
|
28575
|
+
this._setCameraMoving(true);
|
|
28576
|
+
}
|
|
28577
|
+
else if (this._isCameraMoving) {
|
|
28578
|
+
this._stillFrameCount++;
|
|
28579
|
+
if (this._stillFrameCount >= STILL_FRAMES_TO_SETTLE) {
|
|
28580
|
+
this._settleCameraMovement();
|
|
28581
|
+
}
|
|
28582
|
+
}
|
|
28583
|
+
}
|
|
28584
|
+
this._lastCameraPos = camera.positionWC.clone();
|
|
28585
|
+
this._lastCameraDir = camera.directionWC.clone();
|
|
28586
|
+
this._updateFps();
|
|
28587
|
+
}
|
|
28588
|
+
_updateFps() {
|
|
28589
|
+
const now = performance.now();
|
|
28590
|
+
if (this._lastFrameTime != null) {
|
|
28591
|
+
const dt = now - this._lastFrameTime;
|
|
28592
|
+
if (dt > 0) {
|
|
28593
|
+
const instantFps = 1000 / dt;
|
|
28594
|
+
this._avgFps = this._avgFps == null ? instantFps : (this._avgFps * 0.9 + instantFps * 0.1);
|
|
28595
|
+
}
|
|
28596
|
+
}
|
|
28597
|
+
this._lastFrameTime = now;
|
|
28598
|
+
if (this._avgFps == null) {
|
|
28599
|
+
return;
|
|
28631
28600
|
}
|
|
28632
|
-
|
|
28633
|
-
|
|
28634
|
-
|
|
28635
|
-
const viewer = params.viewer;
|
|
28636
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28637
|
-
return (data === null || data === void 0 ? void 0 : data.handlerScreenSpace) != null;
|
|
28638
|
-
}
|
|
28639
|
-
Walkthrough.IsRunning = IsRunning;
|
|
28640
|
-
function SetWalkMoveRate(params) {
|
|
28641
|
-
var _a;
|
|
28642
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28643
|
-
if (data) {
|
|
28644
|
-
data.walkMoveRate = params.rate;
|
|
28601
|
+
// Hysteresis around the slow-scene threshold to avoid flip-flopping at the boundary.
|
|
28602
|
+
if (!this._isSlowScene && this._avgFps < SLOW_SCENE_ENTER_FPS) {
|
|
28603
|
+
this._isSlowScene = true;
|
|
28645
28604
|
}
|
|
28646
|
-
|
|
28647
|
-
|
|
28648
|
-
function SetMoveType(params) {
|
|
28649
|
-
var _a;
|
|
28650
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28651
|
-
if (data) {
|
|
28652
|
-
data.moveType = params.type;
|
|
28605
|
+
else if (this._isSlowScene && this._avgFps > SLOW_SCENE_EXIT_FPS) {
|
|
28606
|
+
this._isSlowScene = false;
|
|
28653
28607
|
}
|
|
28654
|
-
|
|
28655
|
-
|
|
28656
|
-
|
|
28657
|
-
|
|
28658
|
-
|
|
28659
|
-
|
|
28660
|
-
}
|
|
28661
|
-
Walkthrough.GetWalkMoveRate = GetWalkMoveRate;
|
|
28662
|
-
function GetFlyMoveRate(params) {
|
|
28663
|
-
var _a;
|
|
28664
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28665
|
-
return data === null || data === void 0 ? void 0 : data.flyMoveRate;
|
|
28666
|
-
}
|
|
28667
|
-
Walkthrough.GetFlyMoveRate = GetFlyMoveRate;
|
|
28668
|
-
function SetFlyMoveRate(params) {
|
|
28669
|
-
var _a;
|
|
28670
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28671
|
-
if (data) {
|
|
28672
|
-
data.flyMoveRate = params.rate;
|
|
28608
|
+
const targetDelay = this._avgFps < HOVER_DELAY_BRACKET_FPS_SLOW ? HOVER_DELAY_SLOW_MS :
|
|
28609
|
+
this._avgFps < HOVER_DELAY_BRACKET_FPS_MID ? HOVER_DELAY_MID_MS :
|
|
28610
|
+
HOVER_DELAY_FAST_MS;
|
|
28611
|
+
if (targetDelay !== this._hoverDelayMs && (now - this._lastDelaySwitchTime) > DELAY_SWITCH_MIN_INTERVAL_MS) {
|
|
28612
|
+
this._hoverDelayMs = targetDelay;
|
|
28613
|
+
this._lastDelaySwitchTime = now;
|
|
28673
28614
|
}
|
|
28674
28615
|
}
|
|
28675
|
-
|
|
28676
|
-
function GetMoveType(params) {
|
|
28677
|
-
var _a;
|
|
28678
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28679
|
-
return data === null || data === void 0 ? void 0 : data.moveType;
|
|
28680
|
-
}
|
|
28681
|
-
Walkthrough.GetMoveType = GetMoveType;
|
|
28682
|
-
})(exports.Walkthrough || (exports.Walkthrough = {}));
|
|
28616
|
+
}
|
|
28683
28617
|
|
|
28684
28618
|
var ECursor;
|
|
28685
28619
|
(function (ECursor) {
|
|
28686
28620
|
ECursor["Select"] = "select";
|
|
28687
28621
|
ECursor["Pan"] = "pan";
|
|
28688
28622
|
ECursor["Measure"] = "measure";
|
|
28689
|
-
ECursor["Walkthrough"] = "walkthrough";
|
|
28690
28623
|
})(ECursor || (ECursor = {}));
|
|
28691
28624
|
var ESecondaryCursor;
|
|
28692
28625
|
(function (ESecondaryCursor) {
|
|
@@ -28696,13 +28629,7 @@
|
|
|
28696
28629
|
ESecondaryCursor["MeasurePoint"] = "measure-point";
|
|
28697
28630
|
ESecondaryCursor["MeasurePolyline"] = "measure-polyline";
|
|
28698
28631
|
ESecondaryCursor["MeasurePolygon"] = "measure-polygon";
|
|
28699
|
-
ESecondaryCursor["WalkthroughPin"] = "walkthrough-pin";
|
|
28700
28632
|
})(ESecondaryCursor || (ESecondaryCursor = {}));
|
|
28701
|
-
const KEY_WALKTHROUGH_MODE = "WidgetCursorBar.Walkthrough.Mode";
|
|
28702
|
-
const KEY_WALKTHROUGH_SPEED_FLY = "WidgetCursorBar.Walkthrough.SpeedFly";
|
|
28703
|
-
const KEY_WALKTHROUGH_SPEED_WALK = "WidgetCursorBar.Walkthrough.SpeedWalk";
|
|
28704
|
-
const KEY_WALKTHROUGH_EXPANDED = "WidgetCursorBar.Walkthrough.Expanded";
|
|
28705
|
-
const VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM = "--viewer-walkthrough-panel-bottom";
|
|
28706
28633
|
class WidgetCursorBar extends exports.Widget.AWidget {
|
|
28707
28634
|
constructor(params) {
|
|
28708
28635
|
super(params);
|
|
@@ -28715,22 +28642,15 @@
|
|
|
28715
28642
|
if (this._selectedCursor == ECursor.Select || this._selectedSecondaryCursor == ESecondaryCursor.Select) {
|
|
28716
28643
|
this._listenSelection();
|
|
28717
28644
|
}
|
|
28718
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
28719
28645
|
}
|
|
28720
28646
|
Dispose() {
|
|
28721
|
-
var _a, _b
|
|
28647
|
+
var _a, _b;
|
|
28722
28648
|
super.Dispose();
|
|
28723
28649
|
this._disposeMeasureTool();
|
|
28724
28650
|
this._disposeCesiumEvent();
|
|
28725
|
-
this._disposeWalkthroughBar();
|
|
28726
28651
|
if ((_b = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.canvas) === null || _b === void 0 ? void 0 : _b.style.cursor) {
|
|
28727
28652
|
this._viewer.canvas.style.removeProperty("cursor");
|
|
28728
28653
|
}
|
|
28729
|
-
if (((_c = this._viewer) === null || _c === void 0 ? void 0 : _c.scene) && !this._viewer.isDestroyed()) {
|
|
28730
|
-
exports.Walkthrough.Stop({
|
|
28731
|
-
viewer: this._viewer
|
|
28732
|
-
});
|
|
28733
|
-
}
|
|
28734
28654
|
}
|
|
28735
28655
|
_generateStyles() {
|
|
28736
28656
|
if (document.getElementById(this.STYLESHEET_ID)) {
|
|
@@ -28753,7 +28673,6 @@
|
|
|
28753
28673
|
box-sizing: border-box;
|
|
28754
28674
|
display: flex;
|
|
28755
28675
|
flex-direction: column;
|
|
28756
|
-
overflow: hidden;
|
|
28757
28676
|
pointer-events: none;
|
|
28758
28677
|
color: black;
|
|
28759
28678
|
}
|
|
@@ -28771,9 +28690,13 @@
|
|
|
28771
28690
|
|
|
28772
28691
|
.NextspaceCursorBarPrimContent {
|
|
28773
28692
|
align-items: center;
|
|
28774
|
-
background
|
|
28693
|
+
background: rgba(33, 39, 42, 0.8);
|
|
28694
|
+
-webkit-backdrop-filter: blur(20px);
|
|
28695
|
+
backdrop-filter: blur(20px);
|
|
28696
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
28775
28697
|
border-radius: 9px;
|
|
28776
28698
|
display: flex;
|
|
28699
|
+
height: 44px;
|
|
28777
28700
|
pointer-events: auto;
|
|
28778
28701
|
width: -webkit-max-content;
|
|
28779
28702
|
width: max-content;
|
|
@@ -28789,21 +28712,18 @@
|
|
|
28789
28712
|
border-radius: 0;
|
|
28790
28713
|
display: flex;
|
|
28791
28714
|
height: 100%;
|
|
28792
|
-
height: -webkit-max-content;
|
|
28793
|
-
height: max-content;
|
|
28794
28715
|
justify-content: center;
|
|
28795
|
-
padding:
|
|
28796
|
-
padding-left: 8px;
|
|
28716
|
+
padding: 6px 4px;
|
|
28797
28717
|
}
|
|
28798
28718
|
|
|
28799
28719
|
.NextspaceCursorBarPrimControl:first-of-type .NextspaceCursorBarPrimControlInner {
|
|
28800
28720
|
border-radius: 9px 0 0 9px;
|
|
28801
|
-
padding-left:
|
|
28721
|
+
padding-left: 4px;
|
|
28802
28722
|
}
|
|
28803
28723
|
|
|
28804
28724
|
.NextspaceCursorBarPrimControl:last-of-type .NextspaceCursorBarPrimControlInner {
|
|
28805
28725
|
border-radius: 0 9px 9px 0;
|
|
28806
|
-
padding-right:
|
|
28726
|
+
padding-right: 4px;
|
|
28807
28727
|
}
|
|
28808
28728
|
|
|
28809
28729
|
.NextspaceCursorBarPrimControl:first-of-type:last-of-type .NextspaceCursorBarPrimControlInner {
|
|
@@ -28829,6 +28749,7 @@
|
|
|
28829
28749
|
|
|
28830
28750
|
.NextspaceCursorBarPrimControlInner[is-selected="true"] {
|
|
28831
28751
|
background: #33b1ff;
|
|
28752
|
+
box-shadow: inset 0 2px 0 0 #64c4ff;
|
|
28832
28753
|
}
|
|
28833
28754
|
|
|
28834
28755
|
.NextspaceCursorBarSec {
|
|
@@ -28859,8 +28780,7 @@
|
|
|
28859
28780
|
height: -webkit-max-content;
|
|
28860
28781
|
height: max-content;
|
|
28861
28782
|
justify-content: center;
|
|
28862
|
-
padding:
|
|
28863
|
-
padding-left: 8px;
|
|
28783
|
+
padding: 6px;
|
|
28864
28784
|
border: 2px solid transparent;
|
|
28865
28785
|
flex-shrink: 0;
|
|
28866
28786
|
margin: 6px 0 6px 6px;
|
|
@@ -28878,7 +28798,7 @@
|
|
|
28878
28798
|
}
|
|
28879
28799
|
|
|
28880
28800
|
.NextspaceCursorBarSecControl:first-of-type {
|
|
28881
|
-
padding-left:
|
|
28801
|
+
padding-left: 6px;
|
|
28882
28802
|
}
|
|
28883
28803
|
|
|
28884
28804
|
.NextspaceCursorBarSecControlIcon {
|
|
@@ -28899,165 +28819,6 @@
|
|
|
28899
28819
|
transform: scale(1.2);
|
|
28900
28820
|
}
|
|
28901
28821
|
|
|
28902
|
-
.NextspaceWalkthroughBar {
|
|
28903
|
-
position: absolute;
|
|
28904
|
-
z-index: 1;
|
|
28905
|
-
bottom: 10px;
|
|
28906
|
-
left: calc(45px + var(${VIEWER_LEFT_PANEL_CSS_VAR_LEFT}));
|
|
28907
|
-
width: min(1100px, calc(100vw - 205px));
|
|
28908
|
-
box-sizing: border-box;
|
|
28909
|
-
display: flex;
|
|
28910
|
-
flex-direction: column;
|
|
28911
|
-
pointer-events: auto;
|
|
28912
|
-
font-size: 12px;
|
|
28913
|
-
font-family: Arial;
|
|
28914
|
-
transition: 0.3s ease;
|
|
28915
|
-
}
|
|
28916
|
-
|
|
28917
|
-
.NextspaceWalkthroughBar * {
|
|
28918
|
-
box-sizing: border-box;
|
|
28919
|
-
}
|
|
28920
|
-
|
|
28921
|
-
.NextspaceWalkthroughBar[expanded="false"] {
|
|
28922
|
-
width: 395px;
|
|
28923
|
-
}
|
|
28924
|
-
|
|
28925
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarInputs {
|
|
28926
|
-
flex-direction: row;
|
|
28927
|
-
margin-right: 0;
|
|
28928
|
-
}
|
|
28929
|
-
|
|
28930
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarRow {
|
|
28931
|
-
margin-right: 25px;
|
|
28932
|
-
margin-bottom: 0;
|
|
28933
|
-
}
|
|
28934
|
-
|
|
28935
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarRowTip,
|
|
28936
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarTips {
|
|
28937
|
-
display: none;
|
|
28938
|
-
}
|
|
28939
|
-
|
|
28940
|
-
.NextspaceWalkthroughBarContent {
|
|
28941
|
-
background-color: white;
|
|
28942
|
-
border-radius: 8px;
|
|
28943
|
-
display: flex;
|
|
28944
|
-
flex-direction: row;
|
|
28945
|
-
padding: 14px 18px;
|
|
28946
|
-
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
28947
|
-
}
|
|
28948
|
-
|
|
28949
|
-
.NextspaceWalkthroughBarTitle {
|
|
28950
|
-
opacity: 0.7;
|
|
28951
|
-
color: white;
|
|
28952
|
-
font-size: 12px;
|
|
28953
|
-
font-family: Arial;
|
|
28954
|
-
font-style: normal;
|
|
28955
|
-
letter-spacing: 0.15em;
|
|
28956
|
-
margin-bottom: 15px;
|
|
28957
|
-
position: absolute;
|
|
28958
|
-
top: -15px;
|
|
28959
|
-
left: 5px;
|
|
28960
|
-
}
|
|
28961
|
-
|
|
28962
|
-
.NextspaceWalkthroughBarInputs {
|
|
28963
|
-
display: flex;
|
|
28964
|
-
flex-direction: column;
|
|
28965
|
-
margin-right: 40px;
|
|
28966
|
-
}
|
|
28967
|
-
|
|
28968
|
-
.NextspaceWalkthroughBarRowTip {
|
|
28969
|
-
color: #000;
|
|
28970
|
-
font-family: Arial;
|
|
28971
|
-
font-size: 12px;
|
|
28972
|
-
font-style: normal;
|
|
28973
|
-
font-weight: 300;
|
|
28974
|
-
letter-spacing: .01em;
|
|
28975
|
-
background: #efefefbf;
|
|
28976
|
-
padding: 8px;
|
|
28977
|
-
gap: 6px;
|
|
28978
|
-
border-radius: 5px;
|
|
28979
|
-
}
|
|
28980
|
-
|
|
28981
|
-
.NextspaceWalkthroughBarRow {
|
|
28982
|
-
align-items: center;
|
|
28983
|
-
display: flex;
|
|
28984
|
-
margin-bottom: 5px;
|
|
28985
|
-
}
|
|
28986
|
-
|
|
28987
|
-
.NextspaceWalkthroughBarInputs .NextspaceWalkthroughBarRow {
|
|
28988
|
-
margin-right: 20px;
|
|
28989
|
-
}
|
|
28990
|
-
|
|
28991
|
-
.NextspaceWalkthroughBarRowLabel {
|
|
28992
|
-
margin-right: 8px;
|
|
28993
|
-
flex-shrink: 0;
|
|
28994
|
-
}
|
|
28995
|
-
|
|
28996
|
-
.NextspaceWalkthroughBarRowValue {
|
|
28997
|
-
flex-grow: 1;
|
|
28998
|
-
max-width: 120px;
|
|
28999
|
-
}
|
|
29000
|
-
|
|
29001
|
-
.NextspaceWalkthroughBarRowValue input {
|
|
29002
|
-
width: 100%;
|
|
29003
|
-
padding: 4px;
|
|
29004
|
-
border: 1px solid #ccc;
|
|
29005
|
-
border-radius: 4px;
|
|
29006
|
-
}
|
|
29007
|
-
|
|
29008
|
-
.NextspaceWalkthroughBarIcon {
|
|
29009
|
-
margin-right: 20px;
|
|
29010
|
-
flex-shrink: 0;
|
|
29011
|
-
}
|
|
29012
|
-
|
|
29013
|
-
.NextspaceWalkthroughButtonClose {
|
|
29014
|
-
position: absolute;
|
|
29015
|
-
top: 6px;
|
|
29016
|
-
right: 8px;
|
|
29017
|
-
z-index: 1;
|
|
29018
|
-
font-size: 25px;
|
|
29019
|
-
color: black;
|
|
29020
|
-
cursor: pointer;
|
|
29021
|
-
transition: 0.3s ease;
|
|
29022
|
-
}
|
|
29023
|
-
|
|
29024
|
-
.NextspaceWalkthroughButtonExpand {
|
|
29025
|
-
position: absolute;
|
|
29026
|
-
top: 6px;
|
|
29027
|
-
right: 40px;
|
|
29028
|
-
z-index: 1;
|
|
29029
|
-
font-size: 25px;
|
|
29030
|
-
color: black;
|
|
29031
|
-
cursor: pointer;
|
|
29032
|
-
transition: 0.3s ease;
|
|
29033
|
-
display: flex;
|
|
29034
|
-
align-items: center;
|
|
29035
|
-
justify-content: center;
|
|
29036
|
-
height: 24px;
|
|
29037
|
-
width: 24px;
|
|
29038
|
-
}
|
|
29039
|
-
|
|
29040
|
-
.NextspaceWalkthroughButtonClose:hover,
|
|
29041
|
-
.NextspaceWalkthroughButtonExpand:hover {
|
|
29042
|
-
transform: scale(1.2);
|
|
29043
|
-
}
|
|
29044
|
-
|
|
29045
|
-
.NextspaceWalkthroughBarTips {
|
|
29046
|
-
flex-grow: 1;
|
|
29047
|
-
flex-shrink: 1;
|
|
29048
|
-
display: flex;
|
|
29049
|
-
color: black;
|
|
29050
|
-
font-size: 12px;
|
|
29051
|
-
font-family: Arial;
|
|
29052
|
-
}
|
|
29053
|
-
|
|
29054
|
-
.NextspaceWalkthroughBarTips >* {
|
|
29055
|
-
margin-right: 24px;
|
|
29056
|
-
}
|
|
29057
|
-
|
|
29058
|
-
.NextspaceWalkthroughBarTips >*:last-child {
|
|
29059
|
-
margin-right: 0;
|
|
29060
|
-
}
|
|
29061
28822
|
`;
|
|
29062
28823
|
document.head.appendChild(style);
|
|
29063
28824
|
}
|
|
@@ -29083,7 +28844,6 @@
|
|
|
29083
28844
|
this._generateSelect();
|
|
29084
28845
|
this._generatePan();
|
|
29085
28846
|
this._generateMeasure();
|
|
29086
|
-
this._generateWalkthrough();
|
|
29087
28847
|
this._updateControls();
|
|
29088
28848
|
this.Container.appendChild(element);
|
|
29089
28849
|
this._element = element;
|
|
@@ -29102,16 +28862,8 @@
|
|
|
29102
28862
|
`;
|
|
29103
28863
|
div.appendChild(inner);
|
|
29104
28864
|
inner.addEventListener("click", () => {
|
|
29105
|
-
var _a;
|
|
29106
28865
|
this._disposeMeasureTool();
|
|
29107
28866
|
this._disposeCesiumEvent();
|
|
29108
|
-
this._disposeWalkthroughBar();
|
|
29109
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29110
|
-
exports.Walkthrough.Stop({
|
|
29111
|
-
viewer: this._viewer
|
|
29112
|
-
});
|
|
29113
|
-
}
|
|
29114
|
-
this._disposeWalkthroughBar();
|
|
29115
28867
|
onClick();
|
|
29116
28868
|
this._updateControls();
|
|
29117
28869
|
});
|
|
@@ -29241,473 +28993,6 @@
|
|
|
29241
28993
|
this._enabledMeasureTool.Start();
|
|
29242
28994
|
}, polygonSvg);
|
|
29243
28995
|
}
|
|
29244
|
-
_generateWalkthrough() {
|
|
29245
|
-
const svg = `
|
|
29246
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29247
|
-
<path d="M17.5033 4C16.8406 4 16.205 4.26339 15.7364 4.73223C15.2678 5.20107 15.0045 5.83696 15.0045 6.5C15.0045 7.16304 15.2678 7.79893 15.7364 8.26777C16.205 8.73661 16.8406 9 17.5033 9C18.166 9 18.8015 8.73661 19.2701 8.26777C19.7388 7.79893 20.002 7.16304 20.002 6.5C20.002 5.83696 19.7388 5.20107 19.2701 4.73223C18.8015 4.26339 18.166 4 17.5033 4ZM15.5023 10C15.1066 10 14.7378 10.1015 14.4052 10.2656C14.3549 10.2813 14.306 10.3009 14.2588 10.3242L10.3448 12.1992C10.1322 12.3003 9.96216 12.4733 9.86453 12.6875L8.09784 16.5859C8.0405 16.7059 8.00764 16.836 8.00118 16.9688C7.99472 17.1016 8.01479 17.2344 8.06021 17.3593C8.10563 17.4843 8.1755 17.5989 8.26572 17.6965C8.35594 17.7941 8.46471 17.8727 8.58567 17.9278C8.70662 17.9828 8.83733 18.0132 8.97016 18.0171C9.10299 18.0211 9.23526 17.9984 9.35924 17.9506C9.48323 17.9028 9.59644 17.8307 9.69225 17.7386C9.78806 17.6464 9.86454 17.5361 9.91724 17.4141L11.3638 14.2246L12.658 13.8359C12.3918 15.2411 12.0603 16.9816 12.0587 16.9902C12.0583 16.9923 12.0572 16.994 12.0568 16.9961C12.0568 16.9961 12.0568 17 12.0568 17C12.024 17.1615 12.006 17.3288 12.006 17.5C12.006 18.271 12.3631 18.9514 12.9118 19.4102L12.9196 19.4336L16.8103 22.5L17.923 26.6953L18.0225 27.1953C18.0677 27.4221 18.19 27.6263 18.3687 27.773C18.5474 27.9197 18.7714 27.9999 19.0025 28C19.2676 28 19.5218 27.8946 19.7093 27.7071C19.8967 27.5196 20.002 27.2652 20.002 27C20.0019 26.9344 19.9954 26.869 19.9825 26.8047V26.8008C19.9812 26.7969 19.9799 26.793 19.9786 26.7891L18.983 21.8047C18.9562 21.6693 18.9017 21.541 18.8229 21.4277L16.9528 18.0039C16.9546 17.9951 16.953 17.9854 16.9547 17.9766L17.9366 13.0625L17.9347 13.0605C17.9762 12.8798 18.003 12.6933 18.003 12.5C18.003 11.1207 16.8837 10.0011 15.5023 10ZM19.3871 13.7422L18.9186 16.0078L19.3344 16.3809C19.4093 16.4489 19.4962 16.5059 19.5882 16.5469L22.5866 17.9102V17.9082C22.7165 17.9681 22.8576 17.9994 23.0005 18C23.2656 18 23.5198 17.8946 23.7073 17.7071C23.8947 17.5196 24 17.2652 24 17C23.9996 16.8084 23.9442 16.6209 23.8404 16.4599C23.7366 16.2989 23.5887 16.1711 23.4144 16.0918V16.0898L20.5545 14.7891L19.3871 13.7422ZM11.9631 20.7246L11.4497 22.4219L9.22228 26.3613L9.1481 26.4863L9.15005 26.4883C9.13825 26.5087 9.12718 26.5296 9.11686 26.5508L9.10905 26.5625C9.0425 26.6987 9.00778 26.8484 9.00754 27C9.00754 27.2652 9.11285 27.5196 9.30029 27.7071C9.48773 27.8946 9.74195 28 10.007 28C10.1647 27.9999 10.3201 27.9626 10.4606 27.891C10.601 27.8193 10.7225 27.7155 10.8152 27.5879H10.8172L10.8328 27.5645C10.8334 27.5632 10.8341 27.5618 10.8347 27.5605L14.1592 22.5117L11.9631 20.7246Z" fill="white"/>
|
|
29248
|
-
</svg>
|
|
29249
|
-
`;
|
|
29250
|
-
this._generateControl("Walkthrough", ECursor.Walkthrough, () => {
|
|
29251
|
-
var _a;
|
|
29252
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29253
|
-
this._selectedCursor = this._selectedCursor == ECursor.Walkthrough ? ECursor.Select : ECursor.Walkthrough;
|
|
29254
|
-
if (this._selectedCursor == ECursor.Walkthrough) {
|
|
29255
|
-
this._generateWalkthroughSecondary();
|
|
29256
|
-
this._updateSecondary();
|
|
29257
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29258
|
-
exports.Walkthrough.Start({
|
|
29259
|
-
viewer: this._viewer
|
|
29260
|
-
});
|
|
29261
|
-
let moveType = localStorage.getItem(KEY_WALKTHROUGH_MODE);
|
|
29262
|
-
if (!moveType) {
|
|
29263
|
-
moveType = exports.Walkthrough.EMoveType.Walk;
|
|
29264
|
-
}
|
|
29265
|
-
exports.Walkthrough.SetMoveType({
|
|
29266
|
-
type: moveType,
|
|
29267
|
-
viewer: this._viewer
|
|
29268
|
-
});
|
|
29269
|
-
let speed = localStorage.getItem(KEY_WALKTHROUGH_SPEED_FLY);
|
|
29270
|
-
if (speed != null && !isNaN(+speed)) {
|
|
29271
|
-
exports.Walkthrough.SetFlyMoveRate({
|
|
29272
|
-
rate: +speed,
|
|
29273
|
-
viewer: this._viewer
|
|
29274
|
-
});
|
|
29275
|
-
}
|
|
29276
|
-
speed = localStorage.getItem(KEY_WALKTHROUGH_SPEED_WALK);
|
|
29277
|
-
if (speed != null && !isNaN(+speed)) {
|
|
29278
|
-
exports.Walkthrough.SetWalkMoveRate({
|
|
29279
|
-
rate: +speed,
|
|
29280
|
-
viewer: this._viewer
|
|
29281
|
-
});
|
|
29282
|
-
}
|
|
29283
|
-
}
|
|
29284
|
-
this._generateWalkthroughBar();
|
|
29285
|
-
}
|
|
29286
|
-
else {
|
|
29287
|
-
this._secondary.style.display = "none";
|
|
29288
|
-
}
|
|
29289
|
-
if (this._selectedCursor == ECursor.Select || this._selectedSecondaryCursor == ESecondaryCursor.Select) {
|
|
29290
|
-
this._listenSelection();
|
|
29291
|
-
}
|
|
29292
|
-
this.OnCursorChange.Trigger(this._selectedCursor);
|
|
29293
|
-
}, svg);
|
|
29294
|
-
}
|
|
29295
|
-
_generateWalkthroughSecondary() {
|
|
29296
|
-
this._secondaryContent.innerHTML = "";
|
|
29297
|
-
this._secondary.style.display = "flex";
|
|
29298
|
-
const selectSvg = `
|
|
29299
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29300
|
-
<path d="M11.0706 25L9 7L23 17.8592L15.3135 18.3375L11.0706 25Z" fill="white" stroke="white" strokeLinejoin="round"/>
|
|
29301
|
-
</svg>
|
|
29302
|
-
`;
|
|
29303
|
-
this._generateSecondaryControl("Select", ESecondaryCursor.Select, () => {
|
|
29304
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29305
|
-
this._walkthroughPinEventRemoval();
|
|
29306
|
-
this._walkthroughPinEventRemoval = null;
|
|
29307
|
-
}
|
|
29308
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29309
|
-
this._listenSelection();
|
|
29310
|
-
}, selectSvg);
|
|
29311
|
-
const panSvg = `
|
|
29312
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29313
|
-
<path d="M15.5652 6C14.9172 6 14.3913 6.51692 14.3913 7.15385V14.4615H13.6087V8.69231C13.6087 8.05538 13.0828 7.53846 12.4348 7.53846C11.7868 7.53846 11.2609 8.05538 11.2609 8.69231V14.4615V16.7692V19.6734C11.2609 19.6734 9.0069 18.2402 7.87211 17.7548C7.55594 17.6194 7.22575 17.5385 6.89079 17.5385C5.1401 17.5385 5 19.0769 5 19.0769L8.13043 21.3846L10.6357 24.3398C11.5279 25.3922 12.85 26 14.243 26H19.8696C21.5983 26 23 24.6223 23 22.9231V14.4615V11C23 10.3631 22.4741 9.84615 21.8261 9.84615C21.1781 9.84615 20.6522 10.3631 20.6522 11V14.4615H19.8696V8.69231C19.8696 8.05538 19.3437 7.53846 18.6957 7.53846C18.0477 7.53846 17.5217 8.05538 17.5217 8.69231V14.4615H16.7391V7.15385C16.7391 6.51692 16.2132 6 15.5652 6Z" fill="white"/>
|
|
29314
|
-
</svg>
|
|
29315
|
-
`;
|
|
29316
|
-
this._generateSecondaryControl("Pan", ESecondaryCursor.Pan, () => {
|
|
29317
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29318
|
-
this._walkthroughPinEventRemoval();
|
|
29319
|
-
this._walkthroughPinEventRemoval = null;
|
|
29320
|
-
}
|
|
29321
|
-
if (this._selectedSecondaryCursor == ESecondaryCursor.Pan) {
|
|
29322
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29323
|
-
this._listenSelection();
|
|
29324
|
-
}
|
|
29325
|
-
else {
|
|
29326
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Pan;
|
|
29327
|
-
}
|
|
29328
|
-
this._updateSecondary();
|
|
29329
|
-
}, panSvg);
|
|
29330
|
-
const pinSvg = `
|
|
29331
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29332
|
-
<path d="M6 20H18C18.55 20 19 20.45 19 21C19 21.55 18.55 22 18 22H6C5.45 22 5 21.55 5 21C5 20.45 5.45 20 6 20ZM12 7C10.9 7 10 7.9 10 9C10 10.1 10.9 11 12 11C13.1 11 14 10.1 14 9C14 7.9 13.1 7 12 7ZM12 2C15.27 2 19 4.46 19 9.15C19 12.13 16.87 15.27 12.61 18.54C12.25 18.82 11.75 18.82 11.39 18.54C7.13 15.26 5 12.13 5 9.15C5 4.46 8.73 2 12 2Z" fill="white"/>
|
|
29333
|
-
</svg>
|
|
29334
|
-
`;
|
|
29335
|
-
this._generateSecondaryControl("Move to point", ESecondaryCursor.WalkthroughPin, () => {
|
|
29336
|
-
if (this._selectedSecondaryCursor == ESecondaryCursor.WalkthroughPin) {
|
|
29337
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29338
|
-
this._listenSelection();
|
|
29339
|
-
}
|
|
29340
|
-
else {
|
|
29341
|
-
this._selectedSecondaryCursor = ESecondaryCursor.WalkthroughPin;
|
|
29342
|
-
this._initWalkthroughPin();
|
|
29343
|
-
}
|
|
29344
|
-
this._updateSecondary();
|
|
29345
|
-
}, pinSvg);
|
|
29346
|
-
}
|
|
29347
|
-
_initWalkthroughPin() {
|
|
29348
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29349
|
-
this._walkthroughPinEventRemoval();
|
|
29350
|
-
this._walkthroughPinEventRemoval = null;
|
|
29351
|
-
}
|
|
29352
|
-
let pointer;
|
|
29353
|
-
let events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
|
|
29354
|
-
this._walkthroughPinEventRemoval = () => {
|
|
29355
|
-
var _a;
|
|
29356
|
-
if (events && !events.isDestroyed()) {
|
|
29357
|
-
events.destroy();
|
|
29358
|
-
events = null;
|
|
29359
|
-
}
|
|
29360
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.scene.isDestroyed()) {
|
|
29361
|
-
if (pointer && this._viewer.entities.contains(pointer)) {
|
|
29362
|
-
this._viewer.entities.remove(pointer);
|
|
29363
|
-
}
|
|
29364
|
-
pointer = null;
|
|
29365
|
-
this._viewer.scene.requestRender();
|
|
29366
|
-
}
|
|
29367
|
-
};
|
|
29368
|
-
let dropPosition3d;
|
|
29369
|
-
let dropOnTerrain = false;
|
|
29370
|
-
events.setInputAction((e) => {
|
|
29371
|
-
const pos2d = e.endPosition;
|
|
29372
|
-
// First try find a position on a 'thing'.
|
|
29373
|
-
// This lets us put our pin underground if there is something there.
|
|
29374
|
-
let pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, pos2d, true, pointer ? [pointer] : null);
|
|
29375
|
-
dropOnTerrain = false;
|
|
29376
|
-
// Fallback to position including terrain as an option.
|
|
29377
|
-
if (!BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29378
|
-
pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, pos2d, false, pointer ? [pointer] : null);
|
|
29379
|
-
dropOnTerrain = true;
|
|
29380
|
-
}
|
|
29381
|
-
if (BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29382
|
-
dropPosition3d = pos3d;
|
|
29383
|
-
}
|
|
29384
|
-
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
29385
|
-
let processing = false;
|
|
29386
|
-
events.setInputAction(async (e) => {
|
|
29387
|
-
if (processing) {
|
|
29388
|
-
return;
|
|
29389
|
-
}
|
|
29390
|
-
processing = true;
|
|
29391
|
-
try {
|
|
29392
|
-
if (!BModels.Cartes.ValidateCartes3(dropPosition3d) && e.position) {
|
|
29393
|
-
// First try find a position on a 'thing'.
|
|
29394
|
-
// This lets us put our pin underground if there is something there.
|
|
29395
|
-
let pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, e.position, true);
|
|
29396
|
-
dropOnTerrain = false;
|
|
29397
|
-
// Fallback to position including terrain as an option.
|
|
29398
|
-
if (!BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29399
|
-
pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, e.position, false);
|
|
29400
|
-
dropOnTerrain = true;
|
|
29401
|
-
}
|
|
29402
|
-
dropPosition3d = pos3d;
|
|
29403
|
-
}
|
|
29404
|
-
let pos3d = dropPosition3d === null || dropPosition3d === void 0 ? void 0 : dropPosition3d.clone();
|
|
29405
|
-
if (BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29406
|
-
const carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
29407
|
-
// If we can raycast to something then we won't adjust above terrain.
|
|
29408
|
-
// Eg: we clicked on an Entity so if it's underground, that's likely intended.
|
|
29409
|
-
if (dropOnTerrain) {
|
|
29410
|
-
const terrainCarto = carto.clone();
|
|
29411
|
-
terrainCarto.height = 0;
|
|
29412
|
-
if (this._viewer.scene.terrainProvider instanceof Cesium.EllipsoidTerrainProvider) ;
|
|
29413
|
-
else {
|
|
29414
|
-
const sample = await Cesium.sampleTerrainMostDetailed(this._viewer.scene.terrainProvider, [terrainCarto]);
|
|
29415
|
-
const terrainHeight = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
29416
|
-
if (terrainHeight != null) {
|
|
29417
|
-
if (carto.height < terrainHeight) {
|
|
29418
|
-
carto.height = terrainHeight;
|
|
29419
|
-
}
|
|
29420
|
-
}
|
|
29421
|
-
}
|
|
29422
|
-
}
|
|
29423
|
-
// Add average human height.
|
|
29424
|
-
carto.height += 1.7;
|
|
29425
|
-
pos3d = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height);
|
|
29426
|
-
this._viewer.camera.flyTo({
|
|
29427
|
-
destination: pos3d,
|
|
29428
|
-
duration: 2,
|
|
29429
|
-
orientation: {
|
|
29430
|
-
heading: this._viewer.camera.heading,
|
|
29431
|
-
pitch: Cesium.Math.toRadians(0),
|
|
29432
|
-
roll: Cesium.Math.toRadians(0)
|
|
29433
|
-
}
|
|
29434
|
-
});
|
|
29435
|
-
// Disable this picking cursor.
|
|
29436
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29437
|
-
this._listenSelection();
|
|
29438
|
-
this._updateSecondary();
|
|
29439
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29440
|
-
this._walkthroughPinEventRemoval();
|
|
29441
|
-
this._walkthroughPinEventRemoval = null;
|
|
29442
|
-
}
|
|
29443
|
-
}
|
|
29444
|
-
}
|
|
29445
|
-
catch (e) {
|
|
29446
|
-
console.error(e);
|
|
29447
|
-
}
|
|
29448
|
-
processing = false;
|
|
29449
|
-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
29450
|
-
}
|
|
29451
|
-
/**
|
|
29452
|
-
* Generates the Walkthrough controls bar at the bottom of the screen.
|
|
29453
|
-
* This bar will be collapsable to show minimal information.
|
|
29454
|
-
* A TODO is to break this class into pieces similar the ViewBar.
|
|
29455
|
-
*/
|
|
29456
|
-
_generateWalkthroughBar() {
|
|
29457
|
-
this._disposeWalkthroughBar();
|
|
29458
|
-
const element = document.createElement("div");
|
|
29459
|
-
element.className = "NextspaceWalkthroughBar";
|
|
29460
|
-
this.Container.appendChild(element);
|
|
29461
|
-
const content = document.createElement("div");
|
|
29462
|
-
content.className = "NextspaceWalkthroughBarContent";
|
|
29463
|
-
element.appendChild(content);
|
|
29464
|
-
const inputs = document.createElement("div");
|
|
29465
|
-
inputs.className = "NextspaceWalkthroughBarInputs";
|
|
29466
|
-
inputs.style.marginRight = "40px";
|
|
29467
|
-
const title = document.createElement("div");
|
|
29468
|
-
title.className = "NextspaceWalkthroughBarTitle";
|
|
29469
|
-
title.innerText = "Walkthrough";
|
|
29470
|
-
inputs.appendChild(title);
|
|
29471
|
-
// Expanded by default to show how to use Walkthrough.
|
|
29472
|
-
let expanded = localStorage.getItem(KEY_WALKTHROUGH_EXPANDED) != "false";
|
|
29473
|
-
// Close button.
|
|
29474
|
-
{
|
|
29475
|
-
const svg = `
|
|
29476
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29477
|
-
<path d="M18.3002 5.70973C17.9102 5.31973 17.2802 5.31973 16.8902 5.70973L12.0002 10.5897L7.11022 5.69973C6.72022 5.30973 6.09021 5.30973 5.70021 5.69973C5.31021 6.08973 5.31021 6.71973 5.70021 7.10973L10.5902 11.9997L5.70021 16.8897C5.31021 17.2797 5.31021 17.9097 5.70021 18.2997C6.09021 18.6897 6.72022 18.6897 7.11022 18.2997L12.0002 13.4097L16.8902 18.2997C17.2802 18.6897 17.9102 18.6897 18.3002 18.2997C18.6902 17.9097 18.6902 17.2797 18.3002 16.8897L13.4102 11.9997L18.3002 7.10973C18.6802 6.72973 18.6802 6.08973 18.3002 5.70973Z" fill="black"/>
|
|
29478
|
-
</svg>
|
|
29479
|
-
`;
|
|
29480
|
-
const close = document.createElement("div");
|
|
29481
|
-
close.className = "NextspaceWalkthroughButtonClose";
|
|
29482
|
-
close.innerHTML = svg;
|
|
29483
|
-
close.onclick = () => {
|
|
29484
|
-
var _a;
|
|
29485
|
-
// Toggles off the Walkthrough mode (enables first primary cursor).
|
|
29486
|
-
// TODO: We need a more elegant way to handle this.
|
|
29487
|
-
this._secondary.style.display = "none";
|
|
29488
|
-
this._selectedCursor = ECursor.Select;
|
|
29489
|
-
this._selectedSecondaryCursor = ESecondaryCursor.None;
|
|
29490
|
-
this._updateControls();
|
|
29491
|
-
this._updateSecondary();
|
|
29492
|
-
this._disposeWalkthroughBar();
|
|
29493
|
-
this._listenSelection();
|
|
29494
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29495
|
-
exports.Walkthrough.Stop({
|
|
29496
|
-
viewer: this._viewer
|
|
29497
|
-
});
|
|
29498
|
-
}
|
|
29499
|
-
this.OnCursorChange.Trigger(this._selectedCursor);
|
|
29500
|
-
};
|
|
29501
|
-
content.appendChild(close);
|
|
29502
|
-
}
|
|
29503
|
-
// Toggle expand button.
|
|
29504
|
-
{
|
|
29505
|
-
const svgExpand = `
|
|
29506
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29507
|
-
<path d="M6 14C5.45 14 5 14.45 5 15V18C5 18.55 5.45 19 6 19H9C9.55 19 10 18.55 10 18C10 17.45 9.55 17 9 17H7V15C7 14.45 6.55 14 6 14ZM6 10C6.55 10 7 9.55 7 9V7H9C9.55 7 10 6.55 10 6C10 5.45 9.55 5 9 5H6C5.45 5 5 5.45 5 6V9C5 9.55 5.45 10 6 10ZM17 17H15C14.45 17 14 17.45 14 18C14 18.55 14.45 19 15 19H18C18.55 19 19 18.55 19 18V15C19 14.45 18.55 14 18 14C17.45 14 17 14.45 17 15V17ZM14 6C14 6.55 14.45 7 15 7H17V9C17 9.55 17.45 10 18 10C18.55 10 19 9.55 19 9V6C19 5.45 18.55 5 18 5H15C14.45 5 14 5.45 14 6Z" fill="black"/>
|
|
29508
|
-
</svg>
|
|
29509
|
-
`;
|
|
29510
|
-
const svgMinimize = `
|
|
29511
|
-
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29512
|
-
<path d="M15 1L1 0.999999" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
29513
|
-
</svg>
|
|
29514
|
-
`;
|
|
29515
|
-
const heightCollapsed = "70px";
|
|
29516
|
-
const heightExpanded = "150px";
|
|
29517
|
-
const expand = document.createElement("div");
|
|
29518
|
-
expand.className = "NextspaceWalkthroughButtonExpand";
|
|
29519
|
-
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
29520
|
-
expand.onclick = () => {
|
|
29521
|
-
expanded = !expanded;
|
|
29522
|
-
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
29523
|
-
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
29524
|
-
localStorage.setItem(KEY_WALKTHROUGH_EXPANDED, expanded ? "true" : "false");
|
|
29525
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
29526
|
-
};
|
|
29527
|
-
content.appendChild(expand);
|
|
29528
|
-
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
29529
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
29530
|
-
}
|
|
29531
|
-
content.appendChild(inputs);
|
|
29532
|
-
const tips = document.createElement("div");
|
|
29533
|
-
tips.className = "NextspaceWalkthroughBarTips";
|
|
29534
|
-
{
|
|
29535
|
-
const wasd = document.createElement("div");
|
|
29536
|
-
wasd.setAttribute("style", `
|
|
29537
|
-
display: flex;
|
|
29538
|
-
flex-direction: column;
|
|
29539
|
-
justify-content: flex-end;
|
|
29540
|
-
`);
|
|
29541
|
-
const wasdSvg = `
|
|
29542
|
-
<svg width="132" height="87" viewBox="0 0 188 124" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="128" y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="64" y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><path d="M88.2841 39L83.5114 21.5455H85.6591L89.3068 35.7614H89.4773L93.1932 21.5455H95.5795L99.2955 35.7614H99.4659L103.114 21.5455H105.261L100.489 39H98.3068L94.4545 25.0909H94.3182L90.4659 39H88.2841Z" fill="#525252"></path><path d="M24.8295 103H22.6136L29.0227 85.5455H31.2045L37.6136 103H35.3977L30.1818 88.3068H30.0455L24.8295 103ZM25.6477 96.1818H34.5795V98.0568H25.6477V96.1818Z" fill="#525252"></path><path d="M97.6591 89.9091C97.5568 89.0455 97.142 88.375 96.4148 87.8977C95.6875 87.4205 94.7955 87.1818 93.7386 87.1818C92.9659 87.1818 92.2898 87.3068 91.7102 87.5568C91.1364 87.8068 90.6875 88.1506 90.3636 88.5881C90.0455 89.0256 89.8864 89.5227 89.8864 90.0795C89.8864 90.5455 89.9972 90.946 90.2188 91.2812C90.446 91.6108 90.7358 91.8864 91.0881 92.108C91.4403 92.3239 91.8097 92.5028 92.196 92.6449C92.5824 92.7812 92.9375 92.892 93.2614 92.9773L95.0341 93.4545C95.4886 93.5739 95.9943 93.7386 96.5511 93.9489C97.1136 94.1591 97.6506 94.446 98.1619 94.8097C98.679 95.1676 99.1051 95.6278 99.4403 96.1903C99.7756 96.7528 99.9432 97.4432 99.9432 98.2614C99.9432 99.2045 99.696 100.057 99.2017 100.818C98.7131 101.58 97.9972 102.185 97.054 102.634C96.1165 103.082 94.9773 103.307 93.6364 103.307C92.3864 103.307 91.304 103.105 90.3892 102.702C89.4801 102.298 88.7642 101.736 88.2415 101.014C87.7244 100.293 87.4318 99.4545 87.3636 98.5H89.5455C89.6023 99.1591 89.8239 99.7045 90.2102 100.136C90.6023 100.562 91.0966 100.881 91.6932 101.091C92.2955 101.295 92.9432 101.398 93.6364 101.398C94.4432 101.398 95.1676 101.267 95.8097 101.006C96.4517 100.739 96.9602 100.369 97.3352 99.8977C97.7102 99.4205 97.8977 98.8636 97.8977 98.2273C97.8977 97.6477 97.7358 97.1761 97.4119 96.8125C97.0881 96.4489 96.6619 96.1534 96.1335 95.9261C95.6051 95.6989 95.0341 95.5 94.4205 95.3295L92.2727 94.7159C90.9091 94.3239 89.8295 93.7642 89.0341 93.0369C88.2386 92.3097 87.8409 91.358 87.8409 90.1818C87.8409 89.2045 88.1051 88.3523 88.6335 87.625C89.1676 86.892 89.8835 86.3239 90.7812 85.9205C91.6847 85.5114 92.6932 85.3068 93.8068 85.3068C94.9318 85.3068 95.9318 85.5085 96.8068 85.9119C97.6818 86.3097 98.375 86.8551 98.8864 87.5483C99.4034 88.2415 99.6761 89.0284 99.7045 89.9091H97.6591Z" fill="#525252"></path><path d="M157.5 103H152.114V85.5455H157.739C159.432 85.5455 160.881 85.8949 162.085 86.5938C163.29 87.2869 164.213 88.2841 164.855 89.5852C165.497 90.8807 165.818 92.4318 165.818 94.2386C165.818 96.0568 165.494 97.6222 164.847 98.9347C164.199 100.241 163.256 101.247 162.017 101.952C160.778 102.651 159.273 103 157.5 103ZM154.227 101.125H157.364C158.807 101.125 160.003 100.847 160.952 100.29C161.901 99.733 162.608 98.9403 163.074 97.9119C163.54 96.8835 163.773 95.6591 163.773 94.2386C163.773 92.8295 163.543 91.6165 163.082 90.5994C162.622 89.5767 161.935 88.7926 161.02 88.2472C160.105 87.696 158.966 87.4205 157.602 87.4205H154.227V101.125Z" fill="#525252"></path></svg>
|
|
29543
|
-
`;
|
|
29544
|
-
wasd.innerHTML = wasdSvg;
|
|
29545
|
-
wasd.innerHTML += `
|
|
29546
|
-
<div style="margin-top: 5px;">
|
|
29547
|
-
Click W,A,S,D on your keyboard to move your camera.
|
|
29548
|
-
</div>
|
|
29549
|
-
`;
|
|
29550
|
-
tips.appendChild(wasd);
|
|
29551
|
-
const arrows = document.createElement("div");
|
|
29552
|
-
arrows.setAttribute("style", `
|
|
29553
|
-
display: flex;
|
|
29554
|
-
flex-direction: column;
|
|
29555
|
-
justify-content: flex-end;
|
|
29556
|
-
`);
|
|
29557
|
-
const arrowsSvg = `
|
|
29558
|
-
<svg width="132" height="87" viewBox="0 0 188 124" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="128" y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect x="64" y="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><path d="M95.2503 38.75V24.7875L101.35 30.8875C101.838 31.375 102.638 31.375 103.125 30.8875C103.613 30.4 103.613 29.6125 103.125 29.125L94.8878 20.8875C94.4003 20.4 93.6128 20.4 93.1253 20.8875L84.8753 29.1125C84.3878 29.6 84.3878 30.3875 84.8753 30.875C85.3628 31.3625 86.1503 31.3625 86.6378 30.875L92.7503 24.7875V38.75C92.7503 39.4375 93.3128 40 94.0003 40C94.6878 40 95.2503 39.4375 95.2503 38.75Z" fill="#525252"></path><path d="M38.75 92.7497H24.7875L30.8875 86.6497C31.375 86.1622 31.375 85.3622 30.8875 84.8747C30.4 84.3872 29.6125 84.3872 29.125 84.8747L20.8875 93.1122C20.4 93.5997 20.4 94.3872 20.8875 94.8747L29.1125 103.125C29.6 103.612 30.3875 103.612 30.875 103.125C31.3625 102.637 31.3625 101.85 30.875 101.362L24.7875 95.2497H38.75C39.4375 95.2497 40 94.6872 40 93.9997C40 93.3122 39.4375 92.7497 38.75 92.7497Z" fill="#525252"></path><path d="M150.25 95.2503H164.213L158.113 101.35C157.625 101.838 157.625 102.638 158.113 103.125C158.6 103.613 159.388 103.613 159.875 103.125L168.113 94.8878C168.6 94.4003 168.6 93.6128 168.113 93.1253L159.888 84.8753C159.4 84.3878 158.613 84.3878 158.125 84.8753C157.638 85.3628 157.638 86.1503 158.125 86.6378L164.213 92.7503H150.25C149.563 92.7503 149 93.3128 149 94.0003C149 94.6878 149.563 95.2503 150.25 95.2503Z" fill="#525252"></path><path d="M92.7497 85.25V99.2125L86.6497 93.1125C86.1622 92.625 85.3622 92.625 84.8747 93.1125C84.3872 93.6 84.3872 94.3875 84.8747 94.875L93.1122 103.113C93.5997 103.6 94.3872 103.6 94.8747 103.113L103.125 94.8875C103.612 94.4 103.612 93.6125 103.125 93.125C102.637 92.6375 101.85 92.6375 101.362 93.125L95.2497 99.2125V85.25C95.2497 84.5625 94.6872 84 93.9997 84C93.3122 84 92.7497 84.5625 92.7497 85.25Z" fill="#525252"></path></svg>
|
|
29559
|
-
`;
|
|
29560
|
-
arrows.innerHTML = arrowsSvg;
|
|
29561
|
-
arrows.innerHTML += `
|
|
29562
|
-
<div style="margin-top: 5px;">
|
|
29563
|
-
Click the arrow keys to pan.
|
|
29564
|
-
</div>
|
|
29565
|
-
`;
|
|
29566
|
-
tips.appendChild(arrows);
|
|
29567
|
-
const upDown = document.createElement("div");
|
|
29568
|
-
upDown.setAttribute("style", `
|
|
29569
|
-
display: flex;
|
|
29570
|
-
flex-direction: column;
|
|
29571
|
-
justify-content: flex-end;
|
|
29572
|
-
`);
|
|
29573
|
-
const upDownSvg = `
|
|
29574
|
-
<svg width="87" height="42" viewBox="0 0 124 60" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="64" width="60" height="60" rx="6" fill="#ebebeb"></rect><rect width="60" height="60" rx="6" fill="#ebebeb"></rect><path d="M29.4545 33.5455H31.7727L33.7159 36.1023L34.2273 36.7841L37.125 40.6364H34.8068L32.8977 38.0795L32.4205 37.4318L29.4545 33.5455ZM37.8409 30.2727C37.8409 32.1136 37.5085 33.7045 36.8438 35.0455C36.179 36.3864 35.267 37.4205 34.108 38.1477C32.9489 38.875 31.625 39.2386 30.1364 39.2386C28.6477 39.2386 27.3239 38.875 26.1648 38.1477C25.0057 37.4205 24.0938 36.3864 23.429 35.0455C22.7642 33.7045 22.4318 32.1136 22.4318 30.2727C22.4318 28.4318 22.7642 26.8409 23.429 25.5C24.0938 24.1591 25.0057 23.125 26.1648 22.3977C27.3239 21.6705 28.6477 21.3068 30.1364 21.3068C31.625 21.3068 32.9489 21.6705 34.108 22.3977C35.267 23.125 36.179 24.1591 36.8438 25.5C37.5085 26.8409 37.8409 28.4318 37.8409 30.2727ZM35.7955 30.2727C35.7955 28.7614 35.5426 27.4858 35.0369 26.446C34.5369 25.4062 33.858 24.6193 33 24.0852C32.1477 23.5511 31.1932 23.2841 30.1364 23.2841C29.0795 23.2841 28.1222 23.5511 27.2642 24.0852C26.4119 24.6193 25.733 25.4062 25.2273 26.446C24.7273 27.4858 24.4773 28.7614 24.4773 30.2727C24.4773 31.7841 24.7273 33.0597 25.2273 34.0994C25.733 35.1392 26.4119 35.9261 27.2642 36.4602C28.1222 36.9943 29.0795 37.2614 30.1364 37.2614C31.1932 37.2614 32.1477 36.9943 33 36.4602C33.858 35.9261 34.5369 35.1392 35.0369 34.0994C35.5426 33.0597 35.7955 31.7841 35.7955 30.2727Z" fill="#525252"></path><path d="M88.1136 39V21.5455H98.6477V23.4205H90.2273V29.3182H98.1023V31.1932H90.2273V37.125H98.7841V39H88.1136Z" fill="#525252"></path></svg>
|
|
29575
|
-
`;
|
|
29576
|
-
upDown.innerHTML = upDownSvg;
|
|
29577
|
-
upDown.innerHTML += `
|
|
29578
|
-
<div style="margin-top: 5px;">
|
|
29579
|
-
Click Q and E to move up and down.
|
|
29580
|
-
</div>
|
|
29581
|
-
`;
|
|
29582
|
-
tips.appendChild(upDown);
|
|
29583
|
-
}
|
|
29584
|
-
content.appendChild(tips);
|
|
29585
|
-
// Reference to our speed slider so we can adjust it when the move type changes.
|
|
29586
|
-
let moveRateInput = null;
|
|
29587
|
-
// Fly toggle row.
|
|
29588
|
-
{
|
|
29589
|
-
const row = document.createElement("div");
|
|
29590
|
-
row.className = "NextspaceWalkthroughBarRow";
|
|
29591
|
-
inputs.appendChild(row);
|
|
29592
|
-
const label = document.createElement("div");
|
|
29593
|
-
label.className = "NextspaceWalkthroughBarRowLabel";
|
|
29594
|
-
label.innerText = "Fly";
|
|
29595
|
-
row.appendChild(label);
|
|
29596
|
-
const toggle = document.createElement("input");
|
|
29597
|
-
toggle.className = "NextspaceWalkthroughBarRowToggle";
|
|
29598
|
-
toggle.type = "checkbox";
|
|
29599
|
-
row.appendChild(toggle);
|
|
29600
|
-
toggle.checked = exports.Walkthrough.GetMoveType({
|
|
29601
|
-
viewer: this._viewer
|
|
29602
|
-
}) == exports.Walkthrough.EMoveType.Fly;
|
|
29603
|
-
toggle.addEventListener("change", () => {
|
|
29604
|
-
const newType = toggle.checked ? exports.Walkthrough.EMoveType.Fly : exports.Walkthrough.EMoveType.Walk;
|
|
29605
|
-
exports.Walkthrough.SetMoveType({
|
|
29606
|
-
viewer: this._viewer,
|
|
29607
|
-
type: newType
|
|
29608
|
-
});
|
|
29609
|
-
// Update the speed slider to match the new move type.
|
|
29610
|
-
if (moveRateInput) {
|
|
29611
|
-
if (newType == exports.Walkthrough.EMoveType.Fly) {
|
|
29612
|
-
const rate = exports.Walkthrough.GetFlyMoveRate({
|
|
29613
|
-
viewer: this._viewer
|
|
29614
|
-
});
|
|
29615
|
-
moveRateInput.value = (rate * 50).toFixed(2);
|
|
29616
|
-
}
|
|
29617
|
-
else {
|
|
29618
|
-
const rate = exports.Walkthrough.GetWalkMoveRate({
|
|
29619
|
-
viewer: this._viewer
|
|
29620
|
-
});
|
|
29621
|
-
moveRateInput.value = (rate * 500).toFixed(2);
|
|
29622
|
-
}
|
|
29623
|
-
}
|
|
29624
|
-
localStorage.setItem(KEY_WALKTHROUGH_MODE, newType);
|
|
29625
|
-
});
|
|
29626
|
-
// Tip for the row.
|
|
29627
|
-
// Will be hidden while collapsed through css.
|
|
29628
|
-
{
|
|
29629
|
-
const tip = document.createElement("div");
|
|
29630
|
-
tip.style.marginBottom = "10px";
|
|
29631
|
-
tip.className = "NextspaceWalkthroughBarRowTip";
|
|
29632
|
-
tip.innerText = "Flying means the camera will not maintain its height.";
|
|
29633
|
-
inputs.appendChild(tip);
|
|
29634
|
-
}
|
|
29635
|
-
}
|
|
29636
|
-
// Speed slider row.
|
|
29637
|
-
{
|
|
29638
|
-
const row = document.createElement("div");
|
|
29639
|
-
row.className = "NextspaceWalkthroughBarRow";
|
|
29640
|
-
inputs.appendChild(row);
|
|
29641
|
-
const label = document.createElement("div");
|
|
29642
|
-
label.className = "NextspaceWalkthroughBarRowLabel";
|
|
29643
|
-
label.innerText = "Speed";
|
|
29644
|
-
row.appendChild(label);
|
|
29645
|
-
const slider = document.createElement("input");
|
|
29646
|
-
moveRateInput = slider;
|
|
29647
|
-
slider.className = "NextspaceWalkthroughBarRowSlider";
|
|
29648
|
-
slider.type = "range";
|
|
29649
|
-
slider.min = "0.01";
|
|
29650
|
-
slider.max = "100";
|
|
29651
|
-
slider.step = "0.01";
|
|
29652
|
-
slider.value = "50";
|
|
29653
|
-
slider.addEventListener("input", () => {
|
|
29654
|
-
// Walk is between 0.01 and 0.5
|
|
29655
|
-
// Fly is between 0.01 and 10
|
|
29656
|
-
// We want to convert this slider's range into the respective values and apply based on active move type.
|
|
29657
|
-
const type = exports.Walkthrough.GetMoveType({
|
|
29658
|
-
viewer: this._viewer
|
|
29659
|
-
});
|
|
29660
|
-
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
29661
|
-
const value = parseFloat(slider.value);
|
|
29662
|
-
const speed = value / 50;
|
|
29663
|
-
exports.Walkthrough.SetFlyMoveRate({
|
|
29664
|
-
viewer: this._viewer,
|
|
29665
|
-
rate: speed
|
|
29666
|
-
});
|
|
29667
|
-
localStorage.setItem(KEY_WALKTHROUGH_SPEED_FLY, speed.toString());
|
|
29668
|
-
}
|
|
29669
|
-
else {
|
|
29670
|
-
const value = parseFloat(slider.value);
|
|
29671
|
-
const speed = value / 500;
|
|
29672
|
-
exports.Walkthrough.SetWalkMoveRate({
|
|
29673
|
-
viewer: this._viewer,
|
|
29674
|
-
rate: speed
|
|
29675
|
-
});
|
|
29676
|
-
localStorage.setItem(KEY_WALKTHROUGH_SPEED_WALK, speed.toString());
|
|
29677
|
-
}
|
|
29678
|
-
});
|
|
29679
|
-
// Set the initial value based on the move type.
|
|
29680
|
-
const type = exports.Walkthrough.GetMoveType({
|
|
29681
|
-
viewer: this._viewer
|
|
29682
|
-
});
|
|
29683
|
-
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
29684
|
-
const rate = exports.Walkthrough.GetFlyMoveRate({
|
|
29685
|
-
viewer: this._viewer
|
|
29686
|
-
});
|
|
29687
|
-
slider.value = (rate * 50).toFixed(2);
|
|
29688
|
-
}
|
|
29689
|
-
else {
|
|
29690
|
-
const rate = exports.Walkthrough.GetWalkMoveRate({
|
|
29691
|
-
viewer: this._viewer
|
|
29692
|
-
});
|
|
29693
|
-
slider.value = (rate * 500).toFixed(2);
|
|
29694
|
-
}
|
|
29695
|
-
row.appendChild(slider);
|
|
29696
|
-
}
|
|
29697
|
-
this._walkthroughBar = element;
|
|
29698
|
-
}
|
|
29699
|
-
_disposeWalkthroughBar() {
|
|
29700
|
-
var _a;
|
|
29701
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29702
|
-
this._walkthroughPinEventRemoval();
|
|
29703
|
-
this._walkthroughPinEventRemoval = null;
|
|
29704
|
-
}
|
|
29705
|
-
if ((_a = this._walkthroughBar) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
29706
|
-
this._walkthroughBar.parentElement.removeChild(this._walkthroughBar);
|
|
29707
|
-
this._walkthroughBar = null;
|
|
29708
|
-
}
|
|
29709
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
29710
|
-
}
|
|
29711
28996
|
_updateControls() {
|
|
29712
28997
|
const controls = this._primaryContent.querySelectorAll(".NextspaceCursorBarPrimControlInner");
|
|
29713
28998
|
controls.forEach((control) => {
|
|
@@ -29743,9 +29028,9 @@
|
|
|
29743
29028
|
_listenSelection() {
|
|
29744
29029
|
this._disposeCesiumEvent();
|
|
29745
29030
|
const events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
|
|
29031
|
+
const throttle = new CursorBarMouseEventThrottle(this._viewer);
|
|
29746
29032
|
let lastHoverPos = null;
|
|
29747
|
-
|
|
29748
|
-
//let unhighlightTimeout: any = null;
|
|
29033
|
+
let cursorSettleTimeout = null;
|
|
29749
29034
|
const process2dCursor = (pos2d, isHover) => {
|
|
29750
29035
|
try {
|
|
29751
29036
|
const { regos } = this._manager.VisualsRegister.GetRegosFromCursor({
|
|
@@ -29760,34 +29045,6 @@
|
|
|
29760
29045
|
else if (this._viewer.canvas.style.cursor) {
|
|
29761
29046
|
this._viewer.canvas.style.removeProperty("cursor");
|
|
29762
29047
|
}
|
|
29763
|
-
/*
|
|
29764
|
-
clearTimeout(unhighlightTimeout);
|
|
29765
|
-
if (lastHoveredEntityId && lastHoveredEntityId != firstId) {
|
|
29766
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29767
|
-
entityIds: [lastHoveredEntityId],
|
|
29768
|
-
highlighted: false
|
|
29769
|
-
});
|
|
29770
|
-
}
|
|
29771
|
-
if (firstId) {
|
|
29772
|
-
unhighlightTimeout = setTimeout(() => {
|
|
29773
|
-
if (lastHoveredEntityId == firstId) {
|
|
29774
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29775
|
-
entityIds: [firstId],
|
|
29776
|
-
highlighted: false
|
|
29777
|
-
});
|
|
29778
|
-
lastHoveredEntityId = null;
|
|
29779
|
-
}
|
|
29780
|
-
}, 5000);
|
|
29781
|
-
if (lastHoveredEntityId != firstId) {
|
|
29782
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29783
|
-
entityIds: [firstId],
|
|
29784
|
-
highlighted: true
|
|
29785
|
-
});
|
|
29786
|
-
}
|
|
29787
|
-
}
|
|
29788
|
-
|
|
29789
|
-
lastHoveredEntityId = firstId;
|
|
29790
|
-
*/
|
|
29791
29048
|
}
|
|
29792
29049
|
else {
|
|
29793
29050
|
this._manager.VisualsRegister.ClearSelected();
|
|
@@ -29804,8 +29061,27 @@
|
|
|
29804
29061
|
}
|
|
29805
29062
|
};
|
|
29806
29063
|
const hoverDelayQueue = new BModels.DelayQueue(() => {
|
|
29064
|
+
// Skip raycasting entirely while the camera is moving, or if nothing has changed
|
|
29065
|
+
// (render frame + cursor position) since the last raycast.
|
|
29066
|
+
if (throttle.IsCameraBusy()) {
|
|
29067
|
+
return;
|
|
29068
|
+
}
|
|
29069
|
+
if (document.elementFromPoint(lastHoverPos.x, lastHoverPos.y) !== this._viewer.scene.canvas) {
|
|
29070
|
+
return;
|
|
29071
|
+
}
|
|
29072
|
+
if (throttle.ShouldSkipRaycast(lastHoverPos.x, lastHoverPos.y)) {
|
|
29073
|
+
return;
|
|
29074
|
+
}
|
|
29075
|
+
throttle.RecordRaycast(lastHoverPos.x, lastHoverPos.y);
|
|
29807
29076
|
process2dCursor(lastHoverPos, true);
|
|
29808
|
-
},
|
|
29077
|
+
}, throttle.GetHoverDelayMs());
|
|
29078
|
+
// Once camera movement settles, force a fresh hover check rather than waiting on the
|
|
29079
|
+
// regular throttle (matches Navigator's post-move recheck).
|
|
29080
|
+
throttle.SetOnSettle(() => {
|
|
29081
|
+
if (lastHoverPos) {
|
|
29082
|
+
hoverDelayQueue.Call(true);
|
|
29083
|
+
}
|
|
29084
|
+
});
|
|
29809
29085
|
events.setInputAction((e) => {
|
|
29810
29086
|
var _a;
|
|
29811
29087
|
if (!((_a = e === null || e === void 0 ? void 0 : e.position) === null || _a === void 0 ? void 0 : _a.x)) {
|
|
@@ -29819,10 +29095,25 @@
|
|
|
29819
29095
|
return;
|
|
29820
29096
|
}
|
|
29821
29097
|
lastHoverPos = e.endPosition;
|
|
29822
|
-
hoverDelayQueue.
|
|
29098
|
+
hoverDelayQueue.delay = throttle.GetHoverDelayMs();
|
|
29099
|
+
// On a slow scene, debounce until the cursor has been still for a bit rather than
|
|
29100
|
+
// raycasting on every throttled tick.
|
|
29101
|
+
if (throttle.IsSlowScene()) {
|
|
29102
|
+
clearTimeout(cursorSettleTimeout);
|
|
29103
|
+
cursorSettleTimeout = setTimeout(() => {
|
|
29104
|
+
hoverDelayQueue.Call(true);
|
|
29105
|
+
}, CURSOR_SETTLE_MS);
|
|
29106
|
+
}
|
|
29107
|
+
else {
|
|
29108
|
+
hoverDelayQueue.Call();
|
|
29109
|
+
}
|
|
29823
29110
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
29824
29111
|
this._cesiumEventRemoval = () => {
|
|
29112
|
+
if (cursorSettleTimeout) {
|
|
29113
|
+
clearTimeout(cursorSettleTimeout);
|
|
29114
|
+
}
|
|
29825
29115
|
hoverDelayQueue.Dispose();
|
|
29116
|
+
throttle.Dispose();
|
|
29826
29117
|
if (!events || events.isDestroyed()) {
|
|
29827
29118
|
return;
|
|
29828
29119
|
}
|
|
@@ -30751,20 +30042,1350 @@
|
|
|
30751
30042
|
}
|
|
30752
30043
|
}
|
|
30753
30044
|
|
|
30045
|
+
var EAction;
|
|
30046
|
+
(function (EAction) {
|
|
30047
|
+
EAction["Forward"] = "f";
|
|
30048
|
+
EAction["Backward"] = "b";
|
|
30049
|
+
EAction["Left"] = "l";
|
|
30050
|
+
EAction["Right"] = "r";
|
|
30051
|
+
EAction["Up"] = "u";
|
|
30052
|
+
EAction["Down"] = "d";
|
|
30053
|
+
EAction["LookUp"] = "lu";
|
|
30054
|
+
EAction["LookDown"] = "ld";
|
|
30055
|
+
EAction["LookLeft"] = "ll";
|
|
30056
|
+
EAction["LookRight"] = "lr";
|
|
30057
|
+
EAction["Looking"] = "looking";
|
|
30058
|
+
})(EAction || (EAction = {}));
|
|
30059
|
+
const DEFAULT_WALK_MOVE_RATE = 0.2;
|
|
30060
|
+
const DEFAULT_FLY_MOVE_RATE = 0.2;
|
|
30061
|
+
const DEFAULT_MOVE_TYPE = null;
|
|
30062
|
+
const VIEWER_WALKTHROUGH_DATA_KEY = "_cesiumWalkthroughData";
|
|
30063
|
+
/**
|
|
30064
|
+
* Returns heading of camera towards where movement is happening.
|
|
30065
|
+
* @returns
|
|
30066
|
+
*/
|
|
30067
|
+
function getMovementHeading(viewer) {
|
|
30068
|
+
var _a;
|
|
30069
|
+
const actions = (_a = viewer[VIEWER_WALKTHROUGH_DATA_KEY]) === null || _a === void 0 ? void 0 : _a.actions;
|
|
30070
|
+
if (!actions) {
|
|
30071
|
+
return 0;
|
|
30072
|
+
}
|
|
30073
|
+
let heading = Cesium.Math.toDegrees(viewer.camera.heading);
|
|
30074
|
+
let count = 0;
|
|
30075
|
+
let totalHeading = 0;
|
|
30076
|
+
let left = actions.get(EAction.Left);
|
|
30077
|
+
if (left) {
|
|
30078
|
+
totalHeading += heading + 270;
|
|
30079
|
+
count += 1;
|
|
30080
|
+
}
|
|
30081
|
+
if (actions.get(EAction.Right)) {
|
|
30082
|
+
totalHeading += heading + 90;
|
|
30083
|
+
count += 1;
|
|
30084
|
+
}
|
|
30085
|
+
let forward = actions.get(EAction.Forward);
|
|
30086
|
+
if (forward) {
|
|
30087
|
+
totalHeading += heading;
|
|
30088
|
+
count += 1;
|
|
30089
|
+
}
|
|
30090
|
+
if (actions.get(EAction.Backward)) {
|
|
30091
|
+
totalHeading += heading + 180;
|
|
30092
|
+
count += 1;
|
|
30093
|
+
}
|
|
30094
|
+
if (left && forward) {
|
|
30095
|
+
totalHeading = heading - 45;
|
|
30096
|
+
}
|
|
30097
|
+
else {
|
|
30098
|
+
totalHeading /= count;
|
|
30099
|
+
}
|
|
30100
|
+
return totalHeading;
|
|
30101
|
+
}
|
|
30102
|
+
/**
|
|
30103
|
+
* Updates camera position and orientation based on current actions.
|
|
30104
|
+
*/
|
|
30105
|
+
function doMovementTick(viewer) {
|
|
30106
|
+
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30107
|
+
if (!data) {
|
|
30108
|
+
return;
|
|
30109
|
+
}
|
|
30110
|
+
const canvas = viewer.canvas;
|
|
30111
|
+
const camera = viewer.camera;
|
|
30112
|
+
const moveRate = data.moveType == exports.Walkthrough.EMoveType.Walk ? data.walkMoveRate : data.flyMoveRate;
|
|
30113
|
+
if (data.actions.get(EAction.Looking)) {
|
|
30114
|
+
let width = canvas.clientWidth;
|
|
30115
|
+
let height = canvas.clientHeight;
|
|
30116
|
+
// Coordinate (0.0, 0.0) will be where the mouse was clicked.
|
|
30117
|
+
let x = (data.mousePosCurrent.x - data.mousePosStart.x) / width;
|
|
30118
|
+
let y = -(data.mousePosCurrent.y - data.mousePosStart.y) / height;
|
|
30119
|
+
let lookFactor = 0.1;
|
|
30120
|
+
camera.lookRight(x * lookFactor);
|
|
30121
|
+
camera.lookUp(y * lookFactor);
|
|
30122
|
+
}
|
|
30123
|
+
let lookStep = 0.03;
|
|
30124
|
+
if (data.actions.get(EAction.LookLeft)) {
|
|
30125
|
+
camera.lookLeft(lookStep);
|
|
30126
|
+
}
|
|
30127
|
+
if (data.actions.get(EAction.LookRight)) {
|
|
30128
|
+
camera.lookRight(lookStep);
|
|
30129
|
+
}
|
|
30130
|
+
if (data.actions.get(EAction.LookUp)) {
|
|
30131
|
+
camera.lookUp(lookStep);
|
|
30132
|
+
}
|
|
30133
|
+
if (data.actions.get(EAction.LookDown)) {
|
|
30134
|
+
camera.lookDown(lookStep);
|
|
30135
|
+
}
|
|
30136
|
+
if (data.actions.get(EAction.Up)) {
|
|
30137
|
+
camera.moveUp(moveRate / 2);
|
|
30138
|
+
}
|
|
30139
|
+
if (data.actions.get(EAction.Down)) {
|
|
30140
|
+
camera.moveDown(moveRate / 2);
|
|
30141
|
+
}
|
|
30142
|
+
if (camera.roll > 0) {
|
|
30143
|
+
camera.twistLeft(camera.roll);
|
|
30144
|
+
}
|
|
30145
|
+
else if (camera.roll < 0) {
|
|
30146
|
+
camera.twistRight(camera.roll * -1);
|
|
30147
|
+
}
|
|
30148
|
+
// If movement type is fly use cesium movement methods
|
|
30149
|
+
if (data.moveType == exports.Walkthrough.EMoveType.Fly) {
|
|
30150
|
+
if (data.actions.get(EAction.Forward)) {
|
|
30151
|
+
camera.moveForward(moveRate);
|
|
30152
|
+
}
|
|
30153
|
+
if (data.actions.get(EAction.Backward)) {
|
|
30154
|
+
camera.moveBackward(moveRate);
|
|
30155
|
+
}
|
|
30156
|
+
if (data.actions.get(EAction.Left)) {
|
|
30157
|
+
camera.moveLeft(moveRate);
|
|
30158
|
+
}
|
|
30159
|
+
if (data.actions.get(EAction.Right)) {
|
|
30160
|
+
camera.moveRight(moveRate);
|
|
30161
|
+
}
|
|
30162
|
+
}
|
|
30163
|
+
// If movement type is walk, calculate new position without affecting altitude
|
|
30164
|
+
else {
|
|
30165
|
+
if (data.actions.get(EAction.Left) ||
|
|
30166
|
+
data.actions.get(EAction.Right) ||
|
|
30167
|
+
data.actions.get(EAction.Forward) ||
|
|
30168
|
+
data.actions.get(EAction.Backward)) {
|
|
30169
|
+
const heading = getMovementHeading(viewer);
|
|
30170
|
+
const pos = viewer.camera.positionCartographic;
|
|
30171
|
+
const newPos = _offsetPoint({
|
|
30172
|
+
altitude: pos.height,
|
|
30173
|
+
latitude: Cesium.Math.toDegrees(pos.latitude),
|
|
30174
|
+
longitude: Cesium.Math.toDegrees(pos.longitude)
|
|
30175
|
+
}, moveRate, heading);
|
|
30176
|
+
camera.position = Cesium.Cartesian3.fromDegrees(newPos.longitude, newPos.latitude, newPos.altitude);
|
|
30177
|
+
}
|
|
30178
|
+
}
|
|
30179
|
+
viewer.scene.requestRender();
|
|
30180
|
+
}
|
|
30181
|
+
/**
|
|
30182
|
+
* Moves a given point by a given distance towards a heading.
|
|
30183
|
+
* @param point in degrees.
|
|
30184
|
+
* @param distance in meters.
|
|
30185
|
+
* @param heading in degrees.
|
|
30186
|
+
* @returns
|
|
30187
|
+
*/
|
|
30188
|
+
function _offsetPoint(point, distance, heading) {
|
|
30189
|
+
// Radius of earth.
|
|
30190
|
+
const radius = 6371e3;
|
|
30191
|
+
const δ = distance / radius;
|
|
30192
|
+
const θ = Cesium.Math.toRadians(heading);
|
|
30193
|
+
const φ1 = Cesium.Math.toRadians(point.latitude);
|
|
30194
|
+
const λ1 = Cesium.Math.toRadians(point.longitude);
|
|
30195
|
+
const sinφ2 = Math.sin(φ1) * Math.cos(δ) + Math.cos(φ1) * Math.sin(δ) * Math.cos(θ);
|
|
30196
|
+
const φ2 = Math.asin(sinφ2);
|
|
30197
|
+
const y = Math.sin(θ) * Math.sin(δ) * Math.cos(φ1);
|
|
30198
|
+
const x = Math.cos(δ) - Math.sin(φ1) * sinφ2;
|
|
30199
|
+
const λ2 = λ1 + Math.atan2(y, x);
|
|
30200
|
+
return {
|
|
30201
|
+
altitude: point.altitude,
|
|
30202
|
+
latitude: Cesium.Math.toDegrees(φ2),
|
|
30203
|
+
longitude: Cesium.Math.toDegrees(λ2)
|
|
30204
|
+
};
|
|
30205
|
+
}
|
|
30206
|
+
/**
|
|
30207
|
+
* Checks given keyboard key against keybinds and sets action accordingly.
|
|
30208
|
+
* @param key
|
|
30209
|
+
* @param keyDown
|
|
30210
|
+
*/
|
|
30211
|
+
function checkKeybind(viewer, key, keyDown) {
|
|
30212
|
+
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30213
|
+
if (!data) {
|
|
30214
|
+
return;
|
|
30215
|
+
}
|
|
30216
|
+
key = key.toLowerCase();
|
|
30217
|
+
if (key == "w") {
|
|
30218
|
+
data.actions.set(EAction.Forward, keyDown);
|
|
30219
|
+
}
|
|
30220
|
+
else if (key == "s") {
|
|
30221
|
+
data.actions.set(EAction.Backward, keyDown);
|
|
30222
|
+
}
|
|
30223
|
+
else if (key == "a") {
|
|
30224
|
+
data.actions.set(EAction.Left, keyDown);
|
|
30225
|
+
}
|
|
30226
|
+
else if (key == "d") {
|
|
30227
|
+
data.actions.set(EAction.Right, keyDown);
|
|
30228
|
+
}
|
|
30229
|
+
else if (key == "q") {
|
|
30230
|
+
data.actions.set(EAction.Up, keyDown);
|
|
30231
|
+
}
|
|
30232
|
+
else if (key == "e") {
|
|
30233
|
+
data.actions.set(EAction.Down, keyDown);
|
|
30234
|
+
}
|
|
30235
|
+
else if (key == "arrowup") {
|
|
30236
|
+
data.actions.set(EAction.LookUp, keyDown);
|
|
30237
|
+
}
|
|
30238
|
+
else if (key == "arrowdown") {
|
|
30239
|
+
data.actions.set(EAction.LookDown, keyDown);
|
|
30240
|
+
}
|
|
30241
|
+
else if (key == "arrowleft") {
|
|
30242
|
+
data.actions.set(EAction.LookLeft, keyDown);
|
|
30243
|
+
}
|
|
30244
|
+
else if (key == "arrowright") {
|
|
30245
|
+
data.actions.set(EAction.LookRight, keyDown);
|
|
30246
|
+
}
|
|
30247
|
+
}
|
|
30248
|
+
(function (Walkthrough) {
|
|
30249
|
+
let EMoveType;
|
|
30250
|
+
(function (EMoveType) {
|
|
30251
|
+
EMoveType["Walk"] = "WALK";
|
|
30252
|
+
EMoveType["Fly"] = "FLY";
|
|
30253
|
+
})(EMoveType = Walkthrough.EMoveType || (Walkthrough.EMoveType = {}));
|
|
30254
|
+
function Start(params) {
|
|
30255
|
+
Stop(params);
|
|
30256
|
+
const viewer = params.viewer;
|
|
30257
|
+
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY] = {
|
|
30258
|
+
walkMoveRate: DEFAULT_WALK_MOVE_RATE,
|
|
30259
|
+
flyMoveRate: DEFAULT_FLY_MOVE_RATE,
|
|
30260
|
+
moveType: DEFAULT_MOVE_TYPE,
|
|
30261
|
+
actions: new Map(),
|
|
30262
|
+
...viewer[VIEWER_WALKTHROUGH_DATA_KEY]
|
|
30263
|
+
};
|
|
30264
|
+
data.handlerScreenSpace = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
|
|
30265
|
+
exports.ViewUtils.SetLockedCameraStatus({
|
|
30266
|
+
viewer: viewer,
|
|
30267
|
+
status: true
|
|
30268
|
+
});
|
|
30269
|
+
let lastCheck;
|
|
30270
|
+
let currentTime = new Date();
|
|
30271
|
+
const interval = setInterval(() => {
|
|
30272
|
+
lastCheck = new Date();
|
|
30273
|
+
if (lastCheck.getTime() - currentTime.getTime() >= (1000 / 60)) {
|
|
30274
|
+
doMovementTick(viewer);
|
|
30275
|
+
currentTime = new Date();
|
|
30276
|
+
}
|
|
30277
|
+
}, 1000 / 60);
|
|
30278
|
+
data.tickRemoval = () => {
|
|
30279
|
+
clearInterval(interval);
|
|
30280
|
+
};
|
|
30281
|
+
let keyDown = (e) => {
|
|
30282
|
+
checkKeybind(viewer, e.key, true);
|
|
30283
|
+
};
|
|
30284
|
+
document.addEventListener("keydown", keyDown, false);
|
|
30285
|
+
let keyUp = (e) => {
|
|
30286
|
+
checkKeybind(viewer, e.key, false);
|
|
30287
|
+
};
|
|
30288
|
+
document.addEventListener("keyup", keyUp, false);
|
|
30289
|
+
data.handlerKeysRemoval = () => {
|
|
30290
|
+
document.removeEventListener("keydown", keyDown);
|
|
30291
|
+
document.removeEventListener("keyup", keyUp);
|
|
30292
|
+
};
|
|
30293
|
+
data.handlerScreenSpace.setInputAction((e) => {
|
|
30294
|
+
data.actions.set(EAction.Looking, true);
|
|
30295
|
+
data.mousePosCurrent = data.mousePosStart = Cesium.Cartesian2.clone(e.position);
|
|
30296
|
+
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
30297
|
+
data.handlerScreenSpace.setInputAction(((e) => {
|
|
30298
|
+
data.mousePosCurrent = e.endPosition;
|
|
30299
|
+
}), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
30300
|
+
data.handlerScreenSpace.setInputAction(() => {
|
|
30301
|
+
data.actions.set(EAction.Looking, false);
|
|
30302
|
+
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
30303
|
+
}
|
|
30304
|
+
Walkthrough.Start = Start;
|
|
30305
|
+
function Stop(params) {
|
|
30306
|
+
var _a, _b;
|
|
30307
|
+
const viewer = params.viewer;
|
|
30308
|
+
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30309
|
+
exports.ViewUtils.SetLockedCameraStatus({
|
|
30310
|
+
viewer: viewer,
|
|
30311
|
+
status: false
|
|
30312
|
+
});
|
|
30313
|
+
if (data) {
|
|
30314
|
+
(_a = data.handlerScreenSpace) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
30315
|
+
data.handlerScreenSpace = null;
|
|
30316
|
+
(_b = data.tickRemoval) === null || _b === void 0 ? void 0 : _b.call(data);
|
|
30317
|
+
data.tickRemoval = null;
|
|
30318
|
+
if (data.handlerKeysRemoval) {
|
|
30319
|
+
data.handlerKeysRemoval();
|
|
30320
|
+
data.handlerKeysRemoval = null;
|
|
30321
|
+
}
|
|
30322
|
+
}
|
|
30323
|
+
}
|
|
30324
|
+
Walkthrough.Stop = Stop;
|
|
30325
|
+
function IsRunning(params) {
|
|
30326
|
+
const viewer = params.viewer;
|
|
30327
|
+
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30328
|
+
return (data === null || data === void 0 ? void 0 : data.handlerScreenSpace) != null;
|
|
30329
|
+
}
|
|
30330
|
+
Walkthrough.IsRunning = IsRunning;
|
|
30331
|
+
function SetWalkMoveRate(params) {
|
|
30332
|
+
var _a;
|
|
30333
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30334
|
+
if (data) {
|
|
30335
|
+
data.walkMoveRate = params.rate;
|
|
30336
|
+
}
|
|
30337
|
+
}
|
|
30338
|
+
Walkthrough.SetWalkMoveRate = SetWalkMoveRate;
|
|
30339
|
+
function SetMoveType(params) {
|
|
30340
|
+
var _a;
|
|
30341
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30342
|
+
if (data) {
|
|
30343
|
+
data.moveType = params.type;
|
|
30344
|
+
}
|
|
30345
|
+
}
|
|
30346
|
+
Walkthrough.SetMoveType = SetMoveType;
|
|
30347
|
+
function GetWalkMoveRate(params) {
|
|
30348
|
+
var _a;
|
|
30349
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30350
|
+
return data === null || data === void 0 ? void 0 : data.walkMoveRate;
|
|
30351
|
+
}
|
|
30352
|
+
Walkthrough.GetWalkMoveRate = GetWalkMoveRate;
|
|
30353
|
+
function GetFlyMoveRate(params) {
|
|
30354
|
+
var _a;
|
|
30355
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30356
|
+
return data === null || data === void 0 ? void 0 : data.flyMoveRate;
|
|
30357
|
+
}
|
|
30358
|
+
Walkthrough.GetFlyMoveRate = GetFlyMoveRate;
|
|
30359
|
+
function SetFlyMoveRate(params) {
|
|
30360
|
+
var _a;
|
|
30361
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30362
|
+
if (data) {
|
|
30363
|
+
data.flyMoveRate = params.rate;
|
|
30364
|
+
}
|
|
30365
|
+
}
|
|
30366
|
+
Walkthrough.SetFlyMoveRate = SetFlyMoveRate;
|
|
30367
|
+
function GetMoveType(params) {
|
|
30368
|
+
var _a;
|
|
30369
|
+
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
30370
|
+
return data === null || data === void 0 ? void 0 : data.moveType;
|
|
30371
|
+
}
|
|
30372
|
+
Walkthrough.GetMoveType = GetMoveType;
|
|
30373
|
+
/**
|
|
30374
|
+
* Simulates a keyboard key being pressed/released for movement purposes.
|
|
30375
|
+
* Lets UI (eg: an on-screen key diagram) drive movement the same way physical key presses do.
|
|
30376
|
+
*/
|
|
30377
|
+
function CheckKeybind(params) {
|
|
30378
|
+
checkKeybind(params.viewer, params.key, params.keyDown);
|
|
30379
|
+
}
|
|
30380
|
+
Walkthrough.CheckKeybind = CheckKeybind;
|
|
30381
|
+
})(exports.Walkthrough || (exports.Walkthrough = {}));
|
|
30382
|
+
|
|
30383
|
+
const KEY_WALKTHROUGH_MODE = "WidgetNavCompass.Walkthrough.Mode";
|
|
30384
|
+
const KEY_WALKTHROUGH_SPEED_FLY = "WidgetNavCompass.Walkthrough.SpeedFly";
|
|
30385
|
+
const KEY_WALKTHROUGH_SPEED_WALK = "WidgetNavCompass.Walkthrough.SpeedWalk";
|
|
30386
|
+
const KEY_WALKTHROUGH_COLLAPSED = "WidgetNavCompass.Walkthrough.Collapsed";
|
|
30387
|
+
// CSS var other widgets (eg: the left panel) read to avoid overlapping this bar.
|
|
30388
|
+
const VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM = "--viewer-walkthrough-panel-bottom";
|
|
30389
|
+
const STYLESHEET_ID = "nextspace-nav-compass-walkthrough-bar-stylesheet";
|
|
30390
|
+
const HEIGHT_COLLAPSED = "58px";
|
|
30391
|
+
const HEIGHT_EXPANDED = "165px";
|
|
30392
|
+
/**
|
|
30393
|
+
* The Walkthrough controls bar shown at the bottom of the screen while in Walkthrough mode
|
|
30394
|
+
* (entered via the nav compass's Walkthrough toggle). Mirrors the design of cesium-navigator-ui's
|
|
30395
|
+
* "CollapsedWalkthrough" component (the current/latest design for this control), reimplemented
|
|
30396
|
+
* here as vanilla DOM since this widget has no React dependency.
|
|
30397
|
+
*/
|
|
30398
|
+
class WidgetNavCompassWalkthroughBar {
|
|
30399
|
+
constructor(params) {
|
|
30400
|
+
this._keyRects = [];
|
|
30401
|
+
this._viewer = params.viewer;
|
|
30402
|
+
this._container = params.container;
|
|
30403
|
+
this._onClose = params.onClose;
|
|
30404
|
+
this._generateStyles();
|
|
30405
|
+
this._generateElement();
|
|
30406
|
+
this._listenPhysicalKeys();
|
|
30407
|
+
}
|
|
30408
|
+
Dispose() {
|
|
30409
|
+
var _a;
|
|
30410
|
+
if (this._keyDownHandler) {
|
|
30411
|
+
document.removeEventListener("keydown", this._keyDownHandler);
|
|
30412
|
+
document.removeEventListener("keyup", this._keyUpHandler);
|
|
30413
|
+
this._keyDownHandler = null;
|
|
30414
|
+
this._keyUpHandler = null;
|
|
30415
|
+
}
|
|
30416
|
+
if ((_a = this._element) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
30417
|
+
this._element.parentElement.removeChild(this._element);
|
|
30418
|
+
}
|
|
30419
|
+
this._element = null;
|
|
30420
|
+
this._keyRects = [];
|
|
30421
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
30422
|
+
}
|
|
30423
|
+
_generateStyles() {
|
|
30424
|
+
if (document.getElementById(STYLESHEET_ID)) {
|
|
30425
|
+
return;
|
|
30426
|
+
}
|
|
30427
|
+
const style = document.createElement("style");
|
|
30428
|
+
style.id = STYLESHEET_ID;
|
|
30429
|
+
style.innerHTML = `
|
|
30430
|
+
.NextspaceNavCompassWalkthroughBar {
|
|
30431
|
+
position: absolute;
|
|
30432
|
+
z-index: 1;
|
|
30433
|
+
bottom: 10px;
|
|
30434
|
+
left: calc(45px + var(${VIEWER_LEFT_PANEL_CSS_VAR_LEFT}));
|
|
30435
|
+
box-sizing: border-box;
|
|
30436
|
+
display: flex;
|
|
30437
|
+
flex-direction: column;
|
|
30438
|
+
background-color: #fafdff;
|
|
30439
|
+
color: #000;
|
|
30440
|
+
border-radius: 8px;
|
|
30441
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
30442
|
+
pointer-events: auto;
|
|
30443
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
30444
|
+
font-family: Arial;
|
|
30445
|
+
font-size: 12px;
|
|
30446
|
+
}
|
|
30447
|
+
|
|
30448
|
+
.NextspaceNavCompassWalkthroughBar * {
|
|
30449
|
+
box-sizing: border-box;
|
|
30450
|
+
}
|
|
30451
|
+
|
|
30452
|
+
.NextspaceNavCompassWalkthroughBar .row-primary {
|
|
30453
|
+
display: flex;
|
|
30454
|
+
flex-direction: row;
|
|
30455
|
+
align-items: center;
|
|
30456
|
+
height: 38px;
|
|
30457
|
+
padding: 0 10px;
|
|
30458
|
+
}
|
|
30459
|
+
|
|
30460
|
+
.NextspaceNavCompassWalkthroughBar .row-primary .icon-walkthrough {
|
|
30461
|
+
width: 24px;
|
|
30462
|
+
height: 24px;
|
|
30463
|
+
flex-shrink: 0;
|
|
30464
|
+
margin-right: 6px;
|
|
30465
|
+
display: flex;
|
|
30466
|
+
align-items: center;
|
|
30467
|
+
justify-content: center;
|
|
30468
|
+
}
|
|
30469
|
+
|
|
30470
|
+
.NextspaceNavCompassWalkthroughBar .row-primary select {
|
|
30471
|
+
height: 28px;
|
|
30472
|
+
padding: 0 8px;
|
|
30473
|
+
border-radius: 4px;
|
|
30474
|
+
border: 1px solid #ccc;
|
|
30475
|
+
background: #fff;
|
|
30476
|
+
color: #000;
|
|
30477
|
+
font-size: 12px;
|
|
30478
|
+
}
|
|
30479
|
+
|
|
30480
|
+
.NextspaceNavCompassWalkthroughBar .row-primary .mr-10 {
|
|
30481
|
+
width: 10px;
|
|
30482
|
+
flex-shrink: 0;
|
|
30483
|
+
}
|
|
30484
|
+
|
|
30485
|
+
.NextspaceNavCompassWalkthroughBar .row-primary .mr-auto {
|
|
30486
|
+
margin-left: auto;
|
|
30487
|
+
}
|
|
30488
|
+
|
|
30489
|
+
.NextspaceNavCompassWalkthroughBar .input-row {
|
|
30490
|
+
display: flex;
|
|
30491
|
+
flex-direction: row;
|
|
30492
|
+
align-items: center;
|
|
30493
|
+
}
|
|
30494
|
+
|
|
30495
|
+
.NextspaceNavCompassWalkthroughBar .input-row label {
|
|
30496
|
+
opacity: 0.7;
|
|
30497
|
+
margin-right: 12px;
|
|
30498
|
+
flex-shrink: 0;
|
|
30499
|
+
}
|
|
30500
|
+
|
|
30501
|
+
.NextspaceNavCompassWalkthroughBar .input-row input[type="range"] {
|
|
30502
|
+
flex-grow: 1;
|
|
30503
|
+
min-width: 60px;
|
|
30504
|
+
accent-color: #33b1ff;
|
|
30505
|
+
}
|
|
30506
|
+
|
|
30507
|
+
.NextspaceNavCompassWalkthroughBar .icon-btn {
|
|
30508
|
+
display: flex;
|
|
30509
|
+
align-items: center;
|
|
30510
|
+
justify-content: center;
|
|
30511
|
+
width: 28px;
|
|
30512
|
+
height: 28px;
|
|
30513
|
+
border-radius: 6px;
|
|
30514
|
+
cursor: pointer;
|
|
30515
|
+
transition: 0.3s ease;
|
|
30516
|
+
flex-shrink: 0;
|
|
30517
|
+
}
|
|
30518
|
+
|
|
30519
|
+
.NextspaceNavCompassWalkthroughBar .icon-btn:hover {
|
|
30520
|
+
background: rgba(0, 0, 0, 0.06);
|
|
30521
|
+
}
|
|
30522
|
+
|
|
30523
|
+
.NextspaceNavCompassWalkthroughBar .icon-btn.close-btn {
|
|
30524
|
+
margin-left: 4px;
|
|
30525
|
+
}
|
|
30526
|
+
|
|
30527
|
+
.NextspaceNavCompassWalkthroughBar .row-keys {
|
|
30528
|
+
display: flex;
|
|
30529
|
+
flex-direction: row;
|
|
30530
|
+
align-items: flex-start;
|
|
30531
|
+
justify-content: center;
|
|
30532
|
+
gap: 16px;
|
|
30533
|
+
padding: 10px 14px 12px;
|
|
30534
|
+
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
30535
|
+
}
|
|
30536
|
+
|
|
30537
|
+
.NextspaceNavCompassWalkthroughBar[collapsed="true"] .row-keys {
|
|
30538
|
+
display: none;
|
|
30539
|
+
}
|
|
30540
|
+
|
|
30541
|
+
.NextspaceNavCompassWalkthroughBar .key-group {
|
|
30542
|
+
display: flex;
|
|
30543
|
+
flex-direction: column;
|
|
30544
|
+
align-items: center;
|
|
30545
|
+
}
|
|
30546
|
+
|
|
30547
|
+
.NextspaceNavCompassWalkthroughBar .key-group svg {
|
|
30548
|
+
display: block;
|
|
30549
|
+
}
|
|
30550
|
+
|
|
30551
|
+
.NextspaceNavCompassWalkthroughBar .key-tip {
|
|
30552
|
+
opacity: 0.5;
|
|
30553
|
+
font-size: 11px;
|
|
30554
|
+
margin-top: 4px;
|
|
30555
|
+
text-align: center;
|
|
30556
|
+
}
|
|
30557
|
+
|
|
30558
|
+
.NextspaceNavCompassWalkthroughBar .key-rect {
|
|
30559
|
+
fill: #fff;
|
|
30560
|
+
transition: 0.3s ease;
|
|
30561
|
+
stroke: rgba(0, 0, 0, 0.2);
|
|
30562
|
+
stroke-width: 1.5;
|
|
30563
|
+
cursor: pointer;
|
|
30564
|
+
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
|
|
30565
|
+
}
|
|
30566
|
+
|
|
30567
|
+
.NextspaceNavCompassWalkthroughBar .key-rect-active {
|
|
30568
|
+
fill: #e8f4ff;
|
|
30569
|
+
stroke: #33b1ff;
|
|
30570
|
+
}
|
|
30571
|
+
`;
|
|
30572
|
+
document.head.appendChild(style);
|
|
30573
|
+
}
|
|
30574
|
+
_generateElement() {
|
|
30575
|
+
const collapsed = localStorage.getItem(KEY_WALKTHROUGH_COLLAPSED) == "true";
|
|
30576
|
+
const element = document.createElement("div");
|
|
30577
|
+
element.className = "NextspaceNavCompassWalkthroughBar";
|
|
30578
|
+
element.setAttribute("collapsed", collapsed ? "true" : "false");
|
|
30579
|
+
this._element = element;
|
|
30580
|
+
const rowPrimary = document.createElement("div");
|
|
30581
|
+
rowPrimary.className = "row-primary";
|
|
30582
|
+
element.appendChild(rowPrimary);
|
|
30583
|
+
const icon = document.createElement("div");
|
|
30584
|
+
icon.className = "icon-walkthrough";
|
|
30585
|
+
icon.innerHTML = `
|
|
30586
|
+
<svg width="20" height="20" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30587
|
+
<path d="M17.5033 4C16.8406 4 16.205 4.26339 15.7364 4.73223C15.2678 5.20107 15.0045 5.83696 15.0045 6.5C15.0045 7.16304 15.2678 7.79893 15.7364 8.26777C16.205 8.73661 16.8406 9 17.5033 9C18.166 9 18.8015 8.73661 19.2701 8.26777C19.7388 7.79893 20.002 7.16304 20.002 6.5C20.002 5.83696 19.7388 5.20107 19.2701 4.73223C18.8015 4.26339 18.166 4 17.5033 4ZM15.5023 10C15.1066 10 14.7378 10.1015 14.4052 10.2656C14.3549 10.2813 14.306 10.3009 14.2588 10.3242L10.3448 12.1992C10.1322 12.3003 9.96216 12.4733 9.86453 12.6875L8.09784 16.5859C8.0405 16.7059 8.00764 16.836 8.00118 16.9688C7.99472 17.1016 8.01479 17.2344 8.06021 17.3593C8.10563 17.4843 8.1755 17.5989 8.26572 17.6965C8.35594 17.7941 8.46471 17.8727 8.58567 17.9278C8.70662 17.9828 8.83733 18.0132 8.97016 18.0171C9.10299 18.0211 9.23526 17.9984 9.35924 17.9506C9.48323 17.9028 9.59644 17.8307 9.69225 17.7386C9.78806 17.6464 9.86454 17.5361 9.91724 17.4141L11.3638 14.2246L12.658 13.8359C12.3918 15.2411 12.0603 16.9816 12.0587 16.9902C12.0583 16.9923 12.0572 16.994 12.0568 16.9961C12.0568 16.9961 12.0568 17 12.0568 17C12.024 17.1615 12.006 17.3288 12.006 17.5C12.006 18.271 12.3631 18.9514 12.9118 19.4102L12.9196 19.4336L16.8103 22.5L17.923 26.6953L18.0225 27.1953C18.0677 27.4221 18.19 27.6263 18.3687 27.773C18.5474 27.9197 18.7714 27.9999 19.0025 28C19.2676 28 19.5218 27.8946 19.7093 27.7071C19.8967 27.5196 20.002 27.2652 20.002 27C20.0019 26.9344 19.9954 26.869 19.9825 26.8047V26.8008C19.9812 26.7969 19.9799 26.793 19.9786 26.7891L18.983 21.8047C18.9562 21.6693 18.9017 21.541 18.8229 21.4277L16.9528 18.0039C16.9546 17.9951 16.953 17.9854 16.9547 17.9766L17.9366 13.0625L17.9347 13.0605C17.9762 12.8798 18.003 12.6933 18.003 12.5C18.003 11.1207 16.8837 10.0011 15.5023 10ZM19.3871 13.7422L18.9186 16.0078L19.3344 16.3809C19.4093 16.4489 19.4962 16.5059 19.5882 16.5469L22.5866 17.9102V17.9082C22.7165 17.9681 22.8576 17.9994 23.0005 18C23.2656 18 23.5198 17.8946 23.7073 17.7071C23.8947 17.5196 24 17.2652 24 17C23.9996 16.8084 23.9442 16.6209 23.8404 16.4599C23.7366 16.2989 23.5887 16.1711 23.4144 16.0918V16.0898L20.5545 14.7891L19.3871 13.7422ZM11.9631 20.7246L11.4497 22.4219L9.22228 26.3613L9.1481 26.4863L9.15005 26.4883C9.13825 26.5087 9.12718 26.5296 9.11686 26.5508L9.10905 26.5625C9.0425 26.6987 9.00778 26.8484 9.00754 27C9.00754 27.2652 9.11285 27.5196 9.30029 27.7071C9.48773 27.8946 9.74195 28 10.007 28C10.1647 27.9999 10.3201 27.9626 10.4606 27.891C10.601 27.8193 10.7225 27.7155 10.8152 27.5879H10.8172L10.8328 27.5645C10.8334 27.5632 10.8341 27.5618 10.8347 27.5605L14.1592 22.5117L11.9631 20.7246Z" fill="#000"/>
|
|
30588
|
+
</svg>
|
|
30589
|
+
`;
|
|
30590
|
+
rowPrimary.appendChild(icon);
|
|
30591
|
+
const select = document.createElement("select");
|
|
30592
|
+
const moveOptions = [
|
|
30593
|
+
{ type: exports.Walkthrough.EMoveType.Fly, label: "Free move" },
|
|
30594
|
+
{ type: exports.Walkthrough.EMoveType.Walk, label: "Maintain height" }
|
|
30595
|
+
];
|
|
30596
|
+
moveOptions.forEach(o => {
|
|
30597
|
+
const option = document.createElement("option");
|
|
30598
|
+
option.value = o.type;
|
|
30599
|
+
option.innerText = o.label;
|
|
30600
|
+
select.appendChild(option);
|
|
30601
|
+
});
|
|
30602
|
+
select.value = exports.Walkthrough.GetMoveType({ viewer: this._viewer }) || exports.Walkthrough.EMoveType.Walk;
|
|
30603
|
+
rowPrimary.appendChild(select);
|
|
30604
|
+
const spacer1 = document.createElement("div");
|
|
30605
|
+
spacer1.className = "mr-10";
|
|
30606
|
+
rowPrimary.appendChild(spacer1);
|
|
30607
|
+
const inputRow = document.createElement("div");
|
|
30608
|
+
inputRow.className = "input-row";
|
|
30609
|
+
rowPrimary.appendChild(inputRow);
|
|
30610
|
+
const speedLabel = document.createElement("label");
|
|
30611
|
+
speedLabel.innerText = "Speed";
|
|
30612
|
+
inputRow.appendChild(speedLabel);
|
|
30613
|
+
const slider = document.createElement("input");
|
|
30614
|
+
slider.type = "range";
|
|
30615
|
+
slider.min = "0.01";
|
|
30616
|
+
slider.max = "100";
|
|
30617
|
+
slider.step = "0.01";
|
|
30618
|
+
inputRow.appendChild(slider);
|
|
30619
|
+
const syncSliderToMoveType = (type) => {
|
|
30620
|
+
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
30621
|
+
const rate = exports.Walkthrough.GetFlyMoveRate({ viewer: this._viewer });
|
|
30622
|
+
slider.value = ((rate !== null && rate !== void 0 ? rate : 0.2) * 50).toFixed(2);
|
|
30623
|
+
}
|
|
30624
|
+
else {
|
|
30625
|
+
const rate = exports.Walkthrough.GetWalkMoveRate({ viewer: this._viewer });
|
|
30626
|
+
slider.value = ((rate !== null && rate !== void 0 ? rate : 0.2) * 500).toFixed(2);
|
|
30627
|
+
}
|
|
30628
|
+
};
|
|
30629
|
+
syncSliderToMoveType(select.value);
|
|
30630
|
+
select.addEventListener("change", () => {
|
|
30631
|
+
const newType = select.value;
|
|
30632
|
+
exports.Walkthrough.SetMoveType({
|
|
30633
|
+
viewer: this._viewer,
|
|
30634
|
+
type: newType
|
|
30635
|
+
});
|
|
30636
|
+
syncSliderToMoveType(newType);
|
|
30637
|
+
localStorage.setItem(KEY_WALKTHROUGH_MODE, newType);
|
|
30638
|
+
});
|
|
30639
|
+
slider.addEventListener("input", () => {
|
|
30640
|
+
const type = exports.Walkthrough.GetMoveType({ viewer: this._viewer });
|
|
30641
|
+
const value = parseFloat(slider.value);
|
|
30642
|
+
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
30643
|
+
const speed = value / 50;
|
|
30644
|
+
exports.Walkthrough.SetFlyMoveRate({ viewer: this._viewer, rate: speed });
|
|
30645
|
+
localStorage.setItem(KEY_WALKTHROUGH_SPEED_FLY, speed.toString());
|
|
30646
|
+
}
|
|
30647
|
+
else {
|
|
30648
|
+
const speed = value / 500;
|
|
30649
|
+
exports.Walkthrough.SetWalkMoveRate({ viewer: this._viewer, rate: speed });
|
|
30650
|
+
localStorage.setItem(KEY_WALKTHROUGH_SPEED_WALK, speed.toString());
|
|
30651
|
+
}
|
|
30652
|
+
});
|
|
30653
|
+
const spacerAuto = document.createElement("div");
|
|
30654
|
+
spacerAuto.className = "mr-auto";
|
|
30655
|
+
rowPrimary.appendChild(spacerAuto);
|
|
30656
|
+
const svgExpand = `
|
|
30657
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30658
|
+
<path d="M6 14C5.45 14 5 14.45 5 15V18C5 18.55 5.45 19 6 19H9C9.55 19 10 18.55 10 18C10 17.45 9.55 17 9 17H7V15C7 14.45 6.55 14 6 14ZM6 10C6.55 10 7 9.55 7 9V7H9C9.55 7 10 6.55 10 6C10 5.45 9.55 5 9 5H6C5.45 5 5 5.45 5 6V9C5 9.55 5.45 10 6 10ZM17 17H15C14.45 17 14 17.45 14 18C14 18.55 14.45 19 15 19H18C18.55 19 19 18.55 19 18V15C19 14.45 18.55 14 18 14C17.45 14 17 14.45 17 15V17ZM14 6C14 6.55 14.45 7 15 7H17V9C17 9.55 17.45 10 18 10C18.55 10 19 9.55 19 9V6C19 5.45 18.55 5 18 5H15C14.45 5 14 5.45 14 6Z" fill="#000"/>
|
|
30659
|
+
</svg>
|
|
30660
|
+
`;
|
|
30661
|
+
const svgMinimize = `
|
|
30662
|
+
<svg width="14" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30663
|
+
<path d="M15 1L1 0.999999" stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
30664
|
+
</svg>
|
|
30665
|
+
`;
|
|
30666
|
+
const toggleBtn = document.createElement("div");
|
|
30667
|
+
toggleBtn.className = "icon-btn toggle-btn";
|
|
30668
|
+
toggleBtn.setAttribute("title", collapsed ? "Show controls" : "Hide controls");
|
|
30669
|
+
toggleBtn.innerHTML = collapsed ? svgExpand : svgMinimize;
|
|
30670
|
+
toggleBtn.onclick = () => {
|
|
30671
|
+
const nowCollapsed = element.getAttribute("collapsed") != "true";
|
|
30672
|
+
element.setAttribute("collapsed", nowCollapsed ? "true" : "false");
|
|
30673
|
+
toggleBtn.innerHTML = nowCollapsed ? svgExpand : svgMinimize;
|
|
30674
|
+
toggleBtn.setAttribute("title", nowCollapsed ? "Show controls" : "Hide controls");
|
|
30675
|
+
localStorage.setItem(KEY_WALKTHROUGH_COLLAPSED, nowCollapsed ? "true" : "false");
|
|
30676
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, nowCollapsed ? HEIGHT_COLLAPSED : HEIGHT_EXPANDED);
|
|
30677
|
+
};
|
|
30678
|
+
rowPrimary.appendChild(toggleBtn);
|
|
30679
|
+
const closeBtn = document.createElement("div");
|
|
30680
|
+
closeBtn.className = "icon-btn close-btn";
|
|
30681
|
+
closeBtn.setAttribute("title", "Close");
|
|
30682
|
+
closeBtn.innerHTML = `
|
|
30683
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30684
|
+
<path d="M18.3002 5.70973C17.9102 5.31973 17.2802 5.31973 16.8902 5.70973L12.0002 10.5897L7.11022 5.69973C6.72022 5.30973 6.09021 5.30973 5.70021 5.69973C5.31021 6.08973 5.31021 6.71973 5.70021 7.10973L10.5902 11.9997L5.70021 16.8897C5.31021 17.2797 5.31021 17.9097 5.70021 18.2997C6.09021 18.6897 6.72022 18.6897 7.11022 18.2997L12.0002 13.4097L16.8902 18.2997C17.2802 18.6897 17.9102 18.6897 18.3002 18.2997C18.6902 17.9097 18.6902 17.2797 18.3002 16.8897L13.4102 11.9997L18.3002 7.10973C18.6802 6.72973 18.6802 6.08973 18.3002 5.70973Z" fill="#000"/>
|
|
30685
|
+
</svg>
|
|
30686
|
+
`;
|
|
30687
|
+
closeBtn.onclick = () => this._onClose();
|
|
30688
|
+
rowPrimary.appendChild(closeBtn);
|
|
30689
|
+
const rowKeys = document.createElement("div");
|
|
30690
|
+
rowKeys.className = "row-keys";
|
|
30691
|
+
element.appendChild(rowKeys);
|
|
30692
|
+
rowKeys.appendChild(this._buildKeyGroup({
|
|
30693
|
+
widthViewBox: 148,
|
|
30694
|
+
heightViewBox: 110,
|
|
30695
|
+
svgWidth: 111,
|
|
30696
|
+
svgHeight: 83,
|
|
30697
|
+
tip: "Move",
|
|
30698
|
+
keys: [
|
|
30699
|
+
{ key: "W", x: 54, y: 10, label: "W" },
|
|
30700
|
+
{ key: "A", x: 6, y: 58, label: "A" },
|
|
30701
|
+
{ key: "S", x: 54, y: 58, label: "S" },
|
|
30702
|
+
{ key: "D", x: 102, y: 58, label: "D" }
|
|
30703
|
+
]
|
|
30704
|
+
}));
|
|
30705
|
+
rowKeys.appendChild(this._buildKeyGroup({
|
|
30706
|
+
widthViewBox: 148,
|
|
30707
|
+
heightViewBox: 110,
|
|
30708
|
+
svgWidth: 111,
|
|
30709
|
+
svgHeight: 83,
|
|
30710
|
+
tip: "Look",
|
|
30711
|
+
keys: [
|
|
30712
|
+
{ key: "ARROWUP", x: 54, y: 10, label: "↑" },
|
|
30713
|
+
{ key: "ARROWLEFT", x: 6, y: 58, label: "←" },
|
|
30714
|
+
{ key: "ARROWDOWN", x: 54, y: 58, label: "↓" },
|
|
30715
|
+
{ key: "ARROWRIGHT", x: 102, y: 58, label: "→" }
|
|
30716
|
+
]
|
|
30717
|
+
}));
|
|
30718
|
+
rowKeys.appendChild(this._buildKeyGroup({
|
|
30719
|
+
widthViewBox: 98,
|
|
30720
|
+
heightViewBox: 60,
|
|
30721
|
+
svgWidth: 74,
|
|
30722
|
+
svgHeight: 45,
|
|
30723
|
+
tip: "Up / Down",
|
|
30724
|
+
keys: [
|
|
30725
|
+
{ key: "Q", x: 6, y: 10, label: "Q" },
|
|
30726
|
+
{ key: "E", x: 52, y: 10, label: "E" }
|
|
30727
|
+
]
|
|
30728
|
+
}));
|
|
30729
|
+
this._container.appendChild(element);
|
|
30730
|
+
}
|
|
30731
|
+
_buildKeyGroup(params) {
|
|
30732
|
+
const NS = "http://www.w3.org/2000/svg";
|
|
30733
|
+
const group = document.createElement("div");
|
|
30734
|
+
group.className = "key-group";
|
|
30735
|
+
const svg = document.createElementNS(NS, "svg");
|
|
30736
|
+
svg.setAttribute("width", params.svgWidth.toString());
|
|
30737
|
+
svg.setAttribute("height", params.svgHeight.toString());
|
|
30738
|
+
svg.setAttribute("viewBox", `0 0 ${params.widthViewBox} ${params.heightViewBox}`);
|
|
30739
|
+
group.appendChild(svg);
|
|
30740
|
+
params.keys.forEach(k => {
|
|
30741
|
+
const rect = document.createElementNS(NS, "rect");
|
|
30742
|
+
rect.setAttribute("x", k.x.toString());
|
|
30743
|
+
rect.setAttribute("y", k.y.toString());
|
|
30744
|
+
rect.setAttribute("width", "40");
|
|
30745
|
+
rect.setAttribute("height", "40");
|
|
30746
|
+
rect.setAttribute("rx", "6");
|
|
30747
|
+
rect.setAttribute("class", "key-rect");
|
|
30748
|
+
svg.appendChild(rect);
|
|
30749
|
+
const text = document.createElementNS(NS, "text");
|
|
30750
|
+
text.setAttribute("x", (k.x + 20).toString());
|
|
30751
|
+
text.setAttribute("y", (k.y + 22).toString());
|
|
30752
|
+
text.setAttribute("text-anchor", "middle");
|
|
30753
|
+
text.setAttribute("dominant-baseline", "middle");
|
|
30754
|
+
text.setAttribute("pointer-events", "none");
|
|
30755
|
+
text.setAttribute("fill", "#000");
|
|
30756
|
+
text.setAttribute("font-size", "20");
|
|
30757
|
+
text.textContent = k.label;
|
|
30758
|
+
svg.appendChild(text);
|
|
30759
|
+
const setActive = (active) => {
|
|
30760
|
+
rect.setAttribute("class", active ? "key-rect key-rect-active" : "key-rect");
|
|
30761
|
+
};
|
|
30762
|
+
rect.addEventListener("mousedown", () => {
|
|
30763
|
+
setActive(true);
|
|
30764
|
+
exports.Walkthrough.CheckKeybind({ viewer: this._viewer, key: k.key, keyDown: true });
|
|
30765
|
+
});
|
|
30766
|
+
const release = () => {
|
|
30767
|
+
setActive(false);
|
|
30768
|
+
exports.Walkthrough.CheckKeybind({ viewer: this._viewer, key: k.key, keyDown: false });
|
|
30769
|
+
};
|
|
30770
|
+
rect.addEventListener("mouseup", release);
|
|
30771
|
+
rect.addEventListener("mouseleave", release);
|
|
30772
|
+
this._keyRects.push({ key: k.key, rect, text });
|
|
30773
|
+
});
|
|
30774
|
+
const tip = document.createElement("div");
|
|
30775
|
+
tip.className = "key-tip";
|
|
30776
|
+
tip.innerText = params.tip;
|
|
30777
|
+
group.appendChild(tip);
|
|
30778
|
+
return group;
|
|
30779
|
+
}
|
|
30780
|
+
_listenPhysicalKeys() {
|
|
30781
|
+
this._keyDownHandler = (e) => this._setKeyRectActive(e.key, true);
|
|
30782
|
+
this._keyUpHandler = (e) => this._setKeyRectActive(e.key, false);
|
|
30783
|
+
document.addEventListener("keydown", this._keyDownHandler);
|
|
30784
|
+
document.addEventListener("keyup", this._keyUpHandler);
|
|
30785
|
+
}
|
|
30786
|
+
_setKeyRectActive(key, active) {
|
|
30787
|
+
const upper = key.toUpperCase();
|
|
30788
|
+
this._keyRects.forEach(kr => {
|
|
30789
|
+
if (kr.key == upper) {
|
|
30790
|
+
kr.rect.setAttribute("class", active ? "key-rect key-rect-active" : "key-rect");
|
|
30791
|
+
}
|
|
30792
|
+
});
|
|
30793
|
+
}
|
|
30794
|
+
}
|
|
30795
|
+
|
|
30796
|
+
const STYLESHEET_ID$1 = "nextspace-nav-compass-hold-loader-stylesheet";
|
|
30797
|
+
function generateStyles() {
|
|
30798
|
+
if (document.getElementById(STYLESHEET_ID$1)) {
|
|
30799
|
+
return;
|
|
30800
|
+
}
|
|
30801
|
+
const style = document.createElement("style");
|
|
30802
|
+
style.id = STYLESHEET_ID$1;
|
|
30803
|
+
style.innerHTML = `
|
|
30804
|
+
.NextspaceHoldLoader {
|
|
30805
|
+
position: fixed;
|
|
30806
|
+
pointer-events: none;
|
|
30807
|
+
z-index: 10000;
|
|
30808
|
+
transform: translate(-50%, -50%);
|
|
30809
|
+
opacity: 0;
|
|
30810
|
+
animation: nextspaceHoldLoaderFadeIn 0.1s ease forwards;
|
|
30811
|
+
}
|
|
30812
|
+
|
|
30813
|
+
.NextspaceHoldLoader svg {
|
|
30814
|
+
filter: drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.4));
|
|
30815
|
+
}
|
|
30816
|
+
|
|
30817
|
+
.NextspaceHoldLoader .progress {
|
|
30818
|
+
transition: stroke-dashoffset 0.05s linear;
|
|
30819
|
+
}
|
|
30820
|
+
|
|
30821
|
+
@keyframes nextspaceHoldLoaderFadeIn {
|
|
30822
|
+
to {
|
|
30823
|
+
opacity: 1;
|
|
30824
|
+
}
|
|
30825
|
+
}
|
|
30826
|
+
`;
|
|
30827
|
+
document.head.appendChild(style);
|
|
30828
|
+
}
|
|
30829
|
+
/**
|
|
30830
|
+
* A press-and-hold radial progress indicator, shown near the cursor while a compass button's interaction is held.
|
|
30831
|
+
*/
|
|
30832
|
+
class WidgetNavCompassHoldLoader {
|
|
30833
|
+
constructor(params) {
|
|
30834
|
+
generateStyles();
|
|
30835
|
+
const size = params.isTouch ? 40 : 30;
|
|
30836
|
+
this._radius = (size / 2) - 3;
|
|
30837
|
+
const element = document.createElement("div");
|
|
30838
|
+
element.className = "NextspaceHoldLoader";
|
|
30839
|
+
element.style.left = `${params.x}px`;
|
|
30840
|
+
element.style.top = `${params.y}px`;
|
|
30841
|
+
const circumference = 2 * Math.PI * this._radius;
|
|
30842
|
+
element.innerHTML = `
|
|
30843
|
+
<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
|
|
30844
|
+
<circle class="background" cx="${size / 2}" cy="${size / 2}" r="${this._radius}" fill="none" stroke="rgba(255, 255, 255, 0.2)" stroke-width="3"/>
|
|
30845
|
+
<circle class="progress" cx="${size / 2}" cy="${size / 2}" r="${this._radius}" fill="none" stroke="white" stroke-width="3" stroke-linecap="round"
|
|
30846
|
+
stroke-dasharray="${circumference}" stroke-dashoffset="${circumference}"
|
|
30847
|
+
transform="rotate(-90 ${size / 2} ${size / 2})"/>
|
|
30848
|
+
</svg>
|
|
30849
|
+
`;
|
|
30850
|
+
this._progressCircle = element.querySelector(".progress");
|
|
30851
|
+
document.body.appendChild(element);
|
|
30852
|
+
this._element = element;
|
|
30853
|
+
const circ = circumference;
|
|
30854
|
+
const startTime = performance.now();
|
|
30855
|
+
const animate = () => {
|
|
30856
|
+
const elapsed = performance.now() - startTime;
|
|
30857
|
+
const progress = Math.min(elapsed / params.durationMs, 1);
|
|
30858
|
+
this._progressCircle.setAttribute("stroke-dashoffset", (circ * (1 - progress)).toString());
|
|
30859
|
+
if (progress < 1) {
|
|
30860
|
+
this._animationFrame = requestAnimationFrame(animate);
|
|
30861
|
+
}
|
|
30862
|
+
};
|
|
30863
|
+
this._animationFrame = requestAnimationFrame(animate);
|
|
30864
|
+
}
|
|
30865
|
+
Dispose() {
|
|
30866
|
+
var _a;
|
|
30867
|
+
if (this._animationFrame) {
|
|
30868
|
+
cancelAnimationFrame(this._animationFrame);
|
|
30869
|
+
this._animationFrame = null;
|
|
30870
|
+
}
|
|
30871
|
+
if ((_a = this._element) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
30872
|
+
this._element.parentElement.removeChild(this._element);
|
|
30873
|
+
}
|
|
30874
|
+
this._element = null;
|
|
30875
|
+
}
|
|
30876
|
+
}
|
|
30877
|
+
|
|
30878
|
+
// Animation constants. All compass animations use 150ms at 60fps for consistency.
|
|
30879
|
+
const ANIMATION_DURATION_MS = 150;
|
|
30880
|
+
// Hold-to-activate constants.
|
|
30881
|
+
const HOLD_ACTIVATION_TIME_MS = 350;
|
|
30882
|
+
const HOLD_LOADER_DELAY_MS = 150;
|
|
30883
|
+
const CONTINUOUS_ANIMATION_SPEED = 0.02 / 3;
|
|
30884
|
+
const ZOOM_DISTANCE = 0.85;
|
|
30885
|
+
const MIN_ZOOM_DISTANCE = 0.3;
|
|
30886
|
+
const NEAR_NADIR_PITCH = -Math.PI / 2 + 0.05;
|
|
30887
|
+
const MIN_ORBIT_OFFSET_METERS = 5;
|
|
30888
|
+
// Caps how far a pivot may be from the camera relative to the camera's own altitude.
|
|
30889
|
+
const MAX_PIVOT_DISTANCE_TO_HEIGHT_RATIO = 200;
|
|
30890
|
+
// Caps how much a single rotate step may change the camera's altitude before we treat it as a
|
|
30891
|
+
// runaway and skip it instead of applying it.
|
|
30892
|
+
const MAX_SINGLE_STEP_HEIGHT_CHANGE_RATIO = 1.15;
|
|
30893
|
+
function GetIs2d(viewer) {
|
|
30894
|
+
var _a;
|
|
30895
|
+
return ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.camera) === null || _a === void 0 ? void 0 : _a.frustum) instanceof Cesium.OrthographicFrustum;
|
|
30896
|
+
}
|
|
30897
|
+
/**
|
|
30898
|
+
* Validates a candidate rotate/look/zoom pivot against the camera's own altitude.
|
|
30899
|
+
*/
|
|
30900
|
+
function IsPivotPlausible(viewer, pivot) {
|
|
30901
|
+
if (!pivot || !isFinite(pivot.x) || !isFinite(pivot.y) || !isFinite(pivot.z)) {
|
|
30902
|
+
return false;
|
|
30903
|
+
}
|
|
30904
|
+
const cameraPos = viewer.camera.positionWC;
|
|
30905
|
+
const distance = Cesium.Cartesian3.distance(cameraPos, pivot);
|
|
30906
|
+
if (!isFinite(distance)) {
|
|
30907
|
+
return false;
|
|
30908
|
+
}
|
|
30909
|
+
const cameraCarto = Cesium.Cartographic.fromCartesian(cameraPos);
|
|
30910
|
+
if (!cameraCarto || !isFinite(cameraCarto.height)) {
|
|
30911
|
+
return true;
|
|
30912
|
+
}
|
|
30913
|
+
const cameraHeight = Math.max(cameraCarto.height, 1);
|
|
30914
|
+
return distance <= cameraHeight * MAX_PIVOT_DISTANCE_TO_HEIGHT_RATIO;
|
|
30915
|
+
}
|
|
30916
|
+
function snapshotCamera(camera) {
|
|
30917
|
+
return {
|
|
30918
|
+
position: camera.position.clone(),
|
|
30919
|
+
direction: camera.direction.clone(),
|
|
30920
|
+
up: camera.up.clone()
|
|
30921
|
+
};
|
|
30922
|
+
}
|
|
30923
|
+
function restoreCamera(camera, snapshot) {
|
|
30924
|
+
camera.position = snapshot.position;
|
|
30925
|
+
camera.direction = snapshot.direction;
|
|
30926
|
+
camera.up = snapshot.up;
|
|
30927
|
+
}
|
|
30928
|
+
function getHeightAboveEllipsoid(position) {
|
|
30929
|
+
const carto = Cesium.Cartographic.fromCartesian(position);
|
|
30930
|
+
return carto && isFinite(carto.height) ? carto.height : null;
|
|
30931
|
+
}
|
|
30932
|
+
/**
|
|
30933
|
+
* Probes the final camera pose an orbit step would produce, and rejects it if the camera's
|
|
30934
|
+
* altitude would change implausibly for what should be a fixed-range orbit.
|
|
30935
|
+
*/
|
|
30936
|
+
function isOrbitStepSafe(viewer, target, heading, pitch, range) {
|
|
30937
|
+
const camera = viewer.camera;
|
|
30938
|
+
const before = snapshotCamera(camera);
|
|
30939
|
+
const preHeight = getHeightAboveEllipsoid(before.position);
|
|
30940
|
+
camera.lookAt(target, new Cesium.HeadingPitchRange(heading, pitch, range));
|
|
30941
|
+
const postHeight = getHeightAboveEllipsoid(camera.positionWC);
|
|
30942
|
+
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
30943
|
+
restoreCamera(camera, before);
|
|
30944
|
+
if (preHeight == null || postHeight == null || preHeight <= 0) {
|
|
30945
|
+
return true;
|
|
30946
|
+
}
|
|
30947
|
+
const ratio = postHeight / preHeight;
|
|
30948
|
+
return ratio <= MAX_SINGLE_STEP_HEIGHT_CHANGE_RATIO && ratio >= 1 / MAX_SINGLE_STEP_HEIGHT_CHANGE_RATIO;
|
|
30949
|
+
}
|
|
30950
|
+
/**
|
|
30951
|
+
* Resolves the center point compass rotate/zoom/look operations should orbit around,
|
|
30952
|
+
* preferring the currently-selected entities' location over a raw screen-center raycast.
|
|
30953
|
+
*/
|
|
30954
|
+
async function CalculateEntityCenter(viewer, manager, selectedIds) {
|
|
30955
|
+
var _a, _b;
|
|
30956
|
+
if (!selectedIds || selectedIds.length === 0) {
|
|
30957
|
+
return undefined;
|
|
30958
|
+
}
|
|
30959
|
+
const is2d = GetIs2d(viewer);
|
|
30960
|
+
const location = await exports.EntityUtils.GetLocation({
|
|
30961
|
+
samples: selectedIds.map((id) => ({
|
|
30962
|
+
entityId: id,
|
|
30963
|
+
returnHeightRef: Cesium.HeightReference.NONE,
|
|
30964
|
+
heightRef: Cesium.HeightReference.RELATIVE_TO_GROUND
|
|
30965
|
+
})),
|
|
30966
|
+
viewer: viewer,
|
|
30967
|
+
visualRegister: manager.VisualsRegister,
|
|
30968
|
+
api: manager.Getters.GetBruceApi(),
|
|
30969
|
+
minimumAlt: is2d ? 5 : null,
|
|
30970
|
+
paddingAlt: is2d ? 5 : null
|
|
30971
|
+
});
|
|
30972
|
+
if ((_a = location === null || location === void 0 ? void 0 : location.sphere) === null || _a === void 0 ? void 0 : _a.radius) {
|
|
30973
|
+
if (location.sphere.radius < 1) {
|
|
30974
|
+
location.sphere.radius = 1;
|
|
30975
|
+
}
|
|
30976
|
+
return location.sphere.center;
|
|
30977
|
+
}
|
|
30978
|
+
else if (location === null || location === void 0 ? void 0 : location.rectangle) {
|
|
30979
|
+
if (is2d) {
|
|
30980
|
+
return undefined;
|
|
30981
|
+
}
|
|
30982
|
+
const destinationCarto = Cesium.Rectangle.center(location.rectangle);
|
|
30983
|
+
return Cesium.Cartesian3.fromRadians(destinationCarto.longitude, destinationCarto.latitude, 0);
|
|
30984
|
+
}
|
|
30985
|
+
else if ((_b = location === null || location === void 0 ? void 0 : location.pos3d) === null || _b === void 0 ? void 0 : _b.x) {
|
|
30986
|
+
return location.pos3d;
|
|
30987
|
+
}
|
|
30988
|
+
return undefined;
|
|
30989
|
+
}
|
|
30990
|
+
function easeInOutQuad(progress) {
|
|
30991
|
+
return progress < 0.5
|
|
30992
|
+
? 2 * progress * progress
|
|
30993
|
+
: 1 - Math.pow(-2 * progress + 2, 2) / 2;
|
|
30994
|
+
}
|
|
30995
|
+
async function resolvePivot(viewer, manager, selectedIds, stablePivot) {
|
|
30996
|
+
if (stablePivot && IsPivotPlausible(viewer, stablePivot)) {
|
|
30997
|
+
return stablePivot;
|
|
30998
|
+
}
|
|
30999
|
+
if (selectedIds === null || selectedIds === void 0 ? void 0 : selectedIds.length) {
|
|
31000
|
+
const entityCenter = await CalculateEntityCenter(viewer, manager, selectedIds);
|
|
31001
|
+
if (entityCenter && IsPivotPlausible(viewer, entityCenter)) {
|
|
31002
|
+
return entityCenter;
|
|
31003
|
+
}
|
|
31004
|
+
}
|
|
31005
|
+
const c = viewer.canvas;
|
|
31006
|
+
const center = new Cesium.Cartesian2(c.width / 2, c.height / 2);
|
|
31007
|
+
const ground = exports.DrawingUtils.GetAccuratePosition(viewer, center);
|
|
31008
|
+
if (ground && IsPivotPlausible(viewer, ground)) {
|
|
31009
|
+
return ground;
|
|
31010
|
+
}
|
|
31011
|
+
return undefined;
|
|
31012
|
+
}
|
|
31013
|
+
/**
|
|
31014
|
+
* Rotates the camera around a pivot point by the given radians (single tap action).
|
|
31015
|
+
*/
|
|
31016
|
+
async function DoRotate(params) {
|
|
31017
|
+
const { viewer, manager, selectedIds, stablePivot, onPivotUpdate } = params;
|
|
31018
|
+
const left = params.radians < 0;
|
|
31019
|
+
const radians = Math.abs(params.radians);
|
|
31020
|
+
const camera = viewer.camera;
|
|
31021
|
+
const is2d = GetIs2d(viewer);
|
|
31022
|
+
const isLookingStraightDown = camera.pitch <= NEAR_NADIR_PITCH;
|
|
31023
|
+
if (is2d || isLookingStraightDown) {
|
|
31024
|
+
camera.flyTo({
|
|
31025
|
+
destination: camera.position,
|
|
31026
|
+
orientation: {
|
|
31027
|
+
heading: camera.heading + (left ? radians : -radians),
|
|
31028
|
+
pitch: camera.pitch,
|
|
31029
|
+
roll: camera.roll
|
|
31030
|
+
},
|
|
31031
|
+
duration: ANIMATION_DURATION_MS / 1000
|
|
31032
|
+
});
|
|
31033
|
+
return null;
|
|
31034
|
+
}
|
|
31035
|
+
const ground = await resolvePivot(viewer, manager, selectedIds, stablePivot);
|
|
31036
|
+
if (!(ground === null || ground === void 0 ? void 0 : ground.x)) {
|
|
31037
|
+
return null;
|
|
31038
|
+
}
|
|
31039
|
+
const offset = Math.max(Cesium.Cartesian3.distance(camera.position, ground), MIN_ORBIT_OFFSET_METERS);
|
|
31040
|
+
const startHeading = camera.heading;
|
|
31041
|
+
const fixedPitch = camera.pitch;
|
|
31042
|
+
const totalRotation = left ? radians : -radians;
|
|
31043
|
+
// Distance-to-target stays fixed by construction, but altitude can still drift if `ground`
|
|
31044
|
+
// isn't exactly at the camera's sub-nadir point. Skip the action rather than apply it.
|
|
31045
|
+
if (!isOrbitStepSafe(viewer, ground, startHeading + totalRotation, fixedPitch, offset)) {
|
|
31046
|
+
return null;
|
|
31047
|
+
}
|
|
31048
|
+
const startTime = performance.now();
|
|
31049
|
+
return new Promise((resolve) => {
|
|
31050
|
+
const animate = () => {
|
|
31051
|
+
const elapsed = performance.now() - startTime;
|
|
31052
|
+
const progress = Math.min(elapsed / ANIMATION_DURATION_MS, 1);
|
|
31053
|
+
const eased = easeInOutQuad(progress);
|
|
31054
|
+
const newHeading = startHeading + totalRotation * eased;
|
|
31055
|
+
camera.lookAt(ground, new Cesium.HeadingPitchRange(newHeading, fixedPitch, offset));
|
|
31056
|
+
if (progress < 1) {
|
|
31057
|
+
requestAnimationFrame(animate);
|
|
31058
|
+
}
|
|
31059
|
+
else {
|
|
31060
|
+
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31061
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(ground);
|
|
31062
|
+
resolve(ground);
|
|
31063
|
+
}
|
|
31064
|
+
};
|
|
31065
|
+
requestAnimationFrame(animate);
|
|
31066
|
+
});
|
|
31067
|
+
}
|
|
31068
|
+
/**
|
|
31069
|
+
* Zooms the camera in or out by a fixed amount (single tap action).
|
|
31070
|
+
*/
|
|
31071
|
+
function DoZoom(params) {
|
|
31072
|
+
const { viewer, zoomIn, stablePivot, onPivotUpdate } = params;
|
|
31073
|
+
const camera = viewer.camera;
|
|
31074
|
+
const p = camera.position;
|
|
31075
|
+
let ground;
|
|
31076
|
+
if (stablePivot && IsPivotPlausible(viewer, stablePivot)) {
|
|
31077
|
+
ground = stablePivot;
|
|
31078
|
+
}
|
|
31079
|
+
else {
|
|
31080
|
+
const c = viewer.canvas;
|
|
31081
|
+
const center = new Cesium.Cartesian2(c.width / 2, c.height / 2);
|
|
31082
|
+
ground = exports.DrawingUtils.GetAccuratePosition(viewer, center);
|
|
31083
|
+
}
|
|
31084
|
+
if (!(ground === null || ground === void 0 ? void 0 : ground.x) || !IsPivotPlausible(viewer, ground)) {
|
|
31085
|
+
return Promise.resolve(null);
|
|
31086
|
+
}
|
|
31087
|
+
const height = Cesium.Cartesian3.distance(p, ground);
|
|
31088
|
+
const mag = (ZOOM_DISTANCE * 0.5) / Math.max(1, 4 - Math.log10(height));
|
|
31089
|
+
const zoom = zoomIn ? 1 - mag : 1 + mag;
|
|
31090
|
+
const offset = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(p, ground, new Cesium.Cartesian3()), zoom, new Cesium.Cartesian3());
|
|
31091
|
+
if (zoomIn && Cesium.Cartesian3.magnitude(offset) <= MIN_ZOOM_DISTANCE) {
|
|
31092
|
+
return Promise.resolve(null);
|
|
31093
|
+
}
|
|
31094
|
+
const to = Cesium.Cartesian3.add(ground, offset, new Cesium.Cartesian3());
|
|
31095
|
+
return new Promise((resolve) => {
|
|
31096
|
+
camera.flyTo({
|
|
31097
|
+
destination: to,
|
|
31098
|
+
orientation: { heading: camera.heading, pitch: camera.pitch, roll: camera.roll },
|
|
31099
|
+
duration: ANIMATION_DURATION_MS / 1000,
|
|
31100
|
+
easingFunction: Cesium.EasingFunction.QUADRATIC_IN_OUT,
|
|
31101
|
+
complete: () => {
|
|
31102
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(ground);
|
|
31103
|
+
resolve(ground);
|
|
31104
|
+
}
|
|
31105
|
+
});
|
|
31106
|
+
});
|
|
31107
|
+
}
|
|
31108
|
+
/**
|
|
31109
|
+
* Tilts the camera up or down by arcing around a pivot point (single tap action).
|
|
31110
|
+
*/
|
|
31111
|
+
async function DoLook(params) {
|
|
31112
|
+
const { viewer, manager, tiltUp, selectedIds, stablePivot, onPivotUpdate } = params;
|
|
31113
|
+
// ~11.25 degrees per click.
|
|
31114
|
+
const pitchIncrement = (Math.PI / 32) * 2;
|
|
31115
|
+
const camera = viewer.camera;
|
|
31116
|
+
const MIN_PITCH = -Math.PI / 2 + 0.1;
|
|
31117
|
+
const MAX_PITCH = Math.PI / 8;
|
|
31118
|
+
const currentPitch = camera.pitch;
|
|
31119
|
+
const targetPitch = currentPitch + (tiltUp ? -pitchIncrement : pitchIncrement);
|
|
31120
|
+
const clampedPitch = Math.max(MIN_PITCH, Math.min(MAX_PITCH, targetPitch));
|
|
31121
|
+
if (Math.abs(clampedPitch - currentPitch) < 0.001) {
|
|
31122
|
+
return null;
|
|
31123
|
+
}
|
|
31124
|
+
const center = await resolvePivot(viewer, manager, selectedIds, stablePivot);
|
|
31125
|
+
if (!(center === null || center === void 0 ? void 0 : center.x)) {
|
|
31126
|
+
camera.flyTo({
|
|
31127
|
+
destination: camera.position,
|
|
31128
|
+
orientation: {
|
|
31129
|
+
heading: camera.heading,
|
|
31130
|
+
pitch: clampedPitch,
|
|
31131
|
+
roll: camera.roll
|
|
31132
|
+
},
|
|
31133
|
+
duration: ANIMATION_DURATION_MS / 1000
|
|
31134
|
+
});
|
|
31135
|
+
return null;
|
|
31136
|
+
}
|
|
31137
|
+
const offset = Math.max(Cesium.Cartesian3.distance(camera.position, center), MIN_ORBIT_OFFSET_METERS);
|
|
31138
|
+
const startPitch = currentPitch;
|
|
31139
|
+
const fixedHeading = camera.heading;
|
|
31140
|
+
const totalPitchChange = clampedPitch - currentPitch;
|
|
31141
|
+
const startTime = performance.now();
|
|
31142
|
+
return new Promise((resolve) => {
|
|
31143
|
+
const animate = () => {
|
|
31144
|
+
const elapsed = performance.now() - startTime;
|
|
31145
|
+
const progress = Math.min(elapsed / ANIMATION_DURATION_MS, 1);
|
|
31146
|
+
const eased = easeInOutQuad(progress);
|
|
31147
|
+
const newPitch = startPitch + totalPitchChange * eased;
|
|
31148
|
+
camera.lookAt(center, new Cesium.HeadingPitchRange(fixedHeading, newPitch, offset));
|
|
31149
|
+
if (progress < 1) {
|
|
31150
|
+
requestAnimationFrame(animate);
|
|
31151
|
+
}
|
|
31152
|
+
else {
|
|
31153
|
+
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31154
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(center);
|
|
31155
|
+
resolve(center);
|
|
31156
|
+
}
|
|
31157
|
+
};
|
|
31158
|
+
requestAnimationFrame(animate);
|
|
31159
|
+
});
|
|
31160
|
+
}
|
|
31161
|
+
/**
|
|
31162
|
+
* Continuously rotates the camera while active (press-and-hold). Returns a stop function.
|
|
31163
|
+
*/
|
|
31164
|
+
function StartContinuousRotate(params) {
|
|
31165
|
+
const { viewer, manager, rotateLeft, selectedIds, stablePivot, onPivotUpdate } = params;
|
|
31166
|
+
let active = true;
|
|
31167
|
+
let center;
|
|
31168
|
+
const camera = viewer.camera;
|
|
31169
|
+
const is2d = GetIs2d(viewer);
|
|
31170
|
+
const isLookingStraightDown = camera.pitch <= NEAR_NADIR_PITCH;
|
|
31171
|
+
if (is2d || isLookingStraightDown) {
|
|
31172
|
+
const animate = () => {
|
|
31173
|
+
if (!active) {
|
|
31174
|
+
return;
|
|
31175
|
+
}
|
|
31176
|
+
const inc = Math.PI * CONTINUOUS_ANIMATION_SPEED;
|
|
31177
|
+
const newHeading = camera.heading + (rotateLeft ? inc : -inc);
|
|
31178
|
+
camera.setView({
|
|
31179
|
+
destination: camera.position,
|
|
31180
|
+
orientation: { heading: newHeading, pitch: camera.pitch, roll: camera.roll }
|
|
31181
|
+
});
|
|
31182
|
+
if (active) {
|
|
31183
|
+
requestAnimationFrame(animate);
|
|
31184
|
+
}
|
|
31185
|
+
};
|
|
31186
|
+
requestAnimationFrame(animate);
|
|
31187
|
+
return () => { active = false; };
|
|
31188
|
+
}
|
|
31189
|
+
const fixedPitch = camera.pitch;
|
|
31190
|
+
// Fixed for the whole hold, not recomputed every frame. Recomputing it from the camera's
|
|
31191
|
+
// current position each frame cements any per-frame drift as the new normal distance, then
|
|
31192
|
+
// rotates further from there, compounding into a runaway over many frames.
|
|
31193
|
+
let fixedOffset = null;
|
|
31194
|
+
let holdStartHeight = null;
|
|
31195
|
+
let holdStartSnapshot = null;
|
|
31196
|
+
resolvePivot(viewer, manager, selectedIds, stablePivot).then(p => {
|
|
31197
|
+
center = p;
|
|
31198
|
+
if (center) {
|
|
31199
|
+
fixedOffset = Math.max(Cesium.Cartesian3.distance(camera.position, center), MIN_ORBIT_OFFSET_METERS);
|
|
31200
|
+
holdStartHeight = getHeightAboveEllipsoid(camera.positionWC);
|
|
31201
|
+
holdStartSnapshot = snapshotCamera(camera);
|
|
31202
|
+
}
|
|
31203
|
+
});
|
|
31204
|
+
const animate = () => {
|
|
31205
|
+
if (!active || !center || fixedOffset == null) {
|
|
31206
|
+
if (active) {
|
|
31207
|
+
requestAnimationFrame(animate);
|
|
31208
|
+
}
|
|
31209
|
+
return;
|
|
31210
|
+
}
|
|
31211
|
+
const inc = Math.PI * CONTINUOUS_ANIMATION_SPEED;
|
|
31212
|
+
camera.lookAt(center, new Cesium.HeadingPitchRange(camera.heading, fixedPitch, fixedOffset));
|
|
31213
|
+
rotateLeft ? camera.rotateLeft(inc) : camera.rotateRight(inc);
|
|
31214
|
+
// Backstop against the hold's starting altitude, so slow compounding across many frames
|
|
31215
|
+
// still gets caught, not just a single big jump.
|
|
31216
|
+
const postHeight = getHeightAboveEllipsoid(camera.positionWC);
|
|
31217
|
+
if (holdStartHeight != null && postHeight != null && holdStartHeight > 0) {
|
|
31218
|
+
const ratio = postHeight / holdStartHeight;
|
|
31219
|
+
if (ratio > MAX_SINGLE_STEP_HEIGHT_CHANGE_RATIO || ratio < 1 / MAX_SINGLE_STEP_HEIGHT_CHANGE_RATIO) {
|
|
31220
|
+
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31221
|
+
if (holdStartSnapshot) {
|
|
31222
|
+
restoreCamera(camera, holdStartSnapshot);
|
|
31223
|
+
}
|
|
31224
|
+
active = false;
|
|
31225
|
+
return;
|
|
31226
|
+
}
|
|
31227
|
+
}
|
|
31228
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(center);
|
|
31229
|
+
if (active) {
|
|
31230
|
+
requestAnimationFrame(animate);
|
|
31231
|
+
}
|
|
31232
|
+
};
|
|
31233
|
+
requestAnimationFrame(animate);
|
|
31234
|
+
return () => {
|
|
31235
|
+
active = false;
|
|
31236
|
+
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31237
|
+
};
|
|
31238
|
+
}
|
|
31239
|
+
/**
|
|
31240
|
+
* Continuously tilts the camera up or down while active (press-and-hold). Returns a stop function.
|
|
31241
|
+
*/
|
|
31242
|
+
function StartContinuousLook(params) {
|
|
31243
|
+
const { viewer, manager, lookUp, selectedIds, stablePivot, onPivotUpdate } = params;
|
|
31244
|
+
let active = true;
|
|
31245
|
+
let center;
|
|
31246
|
+
const fixedHeading = viewer.camera.heading;
|
|
31247
|
+
const MIN_PITCH = -Math.PI / 2 + 0.1;
|
|
31248
|
+
const MAX_PITCH = Math.PI / 8;
|
|
31249
|
+
// Fixed for the whole hold, not recomputed every frame. See StartContinuousRotate.
|
|
31250
|
+
let fixedOffset = null;
|
|
31251
|
+
resolvePivot(viewer, manager, selectedIds, stablePivot).then(p => {
|
|
31252
|
+
center = p;
|
|
31253
|
+
if (center) {
|
|
31254
|
+
fixedOffset = Math.max(Cesium.Cartesian3.distance(viewer.camera.position, center), MIN_ORBIT_OFFSET_METERS);
|
|
31255
|
+
}
|
|
31256
|
+
});
|
|
31257
|
+
const animate = () => {
|
|
31258
|
+
if (!active) {
|
|
31259
|
+
return;
|
|
31260
|
+
}
|
|
31261
|
+
if (!center || fixedOffset == null) {
|
|
31262
|
+
requestAnimationFrame(animate);
|
|
31263
|
+
return;
|
|
31264
|
+
}
|
|
31265
|
+
const camera = viewer.camera;
|
|
31266
|
+
const currentPitch = camera.pitch;
|
|
31267
|
+
const inc = Math.PI * CONTINUOUS_ANIMATION_SPEED * (lookUp ? -1 : 1);
|
|
31268
|
+
const newPitch = Math.max(MIN_PITCH, Math.min(MAX_PITCH, currentPitch + inc));
|
|
31269
|
+
if (Math.abs(newPitch - currentPitch) < 0.001) {
|
|
31270
|
+
active = false;
|
|
31271
|
+
return;
|
|
31272
|
+
}
|
|
31273
|
+
camera.lookAt(center, new Cesium.HeadingPitchRange(fixedHeading, newPitch, fixedOffset));
|
|
31274
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(center);
|
|
31275
|
+
if (active) {
|
|
31276
|
+
requestAnimationFrame(animate);
|
|
31277
|
+
}
|
|
31278
|
+
};
|
|
31279
|
+
requestAnimationFrame(animate);
|
|
31280
|
+
return () => {
|
|
31281
|
+
active = false;
|
|
31282
|
+
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31283
|
+
};
|
|
31284
|
+
}
|
|
31285
|
+
/**
|
|
31286
|
+
* Continuously zooms the camera while active (press-and-hold). Returns a stop function.
|
|
31287
|
+
*/
|
|
31288
|
+
function StartContinuousZoom(params) {
|
|
31289
|
+
const { viewer, zoomIn, stablePivot, onPivotUpdate } = params;
|
|
31290
|
+
let active = true;
|
|
31291
|
+
let center = (stablePivot && IsPivotPlausible(viewer, stablePivot)) ? stablePivot : undefined;
|
|
31292
|
+
const animate = () => {
|
|
31293
|
+
if (!active) {
|
|
31294
|
+
return;
|
|
31295
|
+
}
|
|
31296
|
+
const camera = viewer.camera;
|
|
31297
|
+
let ground;
|
|
31298
|
+
if (center) {
|
|
31299
|
+
ground = center;
|
|
31300
|
+
}
|
|
31301
|
+
else {
|
|
31302
|
+
const c = viewer.canvas;
|
|
31303
|
+
const screenCenter = new Cesium.Cartesian2(c.width / 2, c.height / 2);
|
|
31304
|
+
ground = exports.DrawingUtils.GetAccuratePosition(viewer, screenCenter);
|
|
31305
|
+
if (!ground || !IsPivotPlausible(viewer, ground)) {
|
|
31306
|
+
active = false;
|
|
31307
|
+
return;
|
|
31308
|
+
}
|
|
31309
|
+
}
|
|
31310
|
+
const p = camera.position;
|
|
31311
|
+
const height = Cesium.Cartesian3.distance(p, ground);
|
|
31312
|
+
const mag = (ZOOM_DISTANCE * 0.5) / Math.max(1, 4 - Math.log10(height));
|
|
31313
|
+
const zoom = zoomIn ? 1 - mag * 0.03 : 1 + mag * 0.03;
|
|
31314
|
+
const offset = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(p, ground, new Cesium.Cartesian3()), zoom, new Cesium.Cartesian3());
|
|
31315
|
+
if (zoomIn && Cesium.Cartesian3.magnitude(offset) <= MIN_ZOOM_DISTANCE) {
|
|
31316
|
+
active = false;
|
|
31317
|
+
return;
|
|
31318
|
+
}
|
|
31319
|
+
const to = Cesium.Cartesian3.add(ground, offset, new Cesium.Cartesian3());
|
|
31320
|
+
camera.setView({
|
|
31321
|
+
destination: to,
|
|
31322
|
+
orientation: { heading: camera.heading, pitch: camera.pitch, roll: camera.roll }
|
|
31323
|
+
});
|
|
31324
|
+
onPivotUpdate === null || onPivotUpdate === void 0 ? void 0 : onPivotUpdate(ground);
|
|
31325
|
+
if (active) {
|
|
31326
|
+
requestAnimationFrame(animate);
|
|
31327
|
+
}
|
|
31328
|
+
};
|
|
31329
|
+
requestAnimationFrame(animate);
|
|
31330
|
+
return () => { active = false; };
|
|
31331
|
+
}
|
|
31332
|
+
|
|
30754
31333
|
class WidgetNavCompass$$1 extends exports.Widget.AWidget {
|
|
30755
31334
|
constructor(params) {
|
|
30756
31335
|
super(params);
|
|
30757
|
-
this.ZOOM_DISTANCE = 0.85;
|
|
30758
|
-
this.ZOOM_TIME = 0.2;
|
|
30759
|
-
this.TURN_SPEED = 0.04;
|
|
30760
|
-
this.MIN_ZOOM_DISTANCE = 0.3;
|
|
30761
31336
|
this.STYLESHEET_ID = "nextspace-nav-compass-stylesheet";
|
|
31337
|
+
this._stablePivot = null;
|
|
31338
|
+
this.PIVOT_DISTANCE_TOLERANCE_METERS = 50;
|
|
31339
|
+
// Press-and-hold state.
|
|
31340
|
+
this._holdTimer = null;
|
|
31341
|
+
this._loaderTimer = null;
|
|
31342
|
+
this._stopContinuous = null;
|
|
31343
|
+
this._didActivateContinuous = false;
|
|
31344
|
+
this._pendingSingleAction = null;
|
|
31345
|
+
this._holdLoader = null;
|
|
31346
|
+
// Serializes single-tap rotate/look/zoom actions so a rapid click can't overlap an in-flight animation.
|
|
31347
|
+
this._orbitActionChain = Promise.resolve();
|
|
31348
|
+
this._isWalkthroughActive = false;
|
|
31349
|
+
this._walkthroughBar = null;
|
|
31350
|
+
this._isVR = false;
|
|
30762
31351
|
this._generateStyles();
|
|
30763
31352
|
this._generateElement();
|
|
30764
31353
|
this._listenToRenders();
|
|
31354
|
+
this._listenGlobalRelease();
|
|
30765
31355
|
}
|
|
30766
|
-
|
|
30767
|
-
|
|
31356
|
+
_getSelectedIds() {
|
|
31357
|
+
var _a, _b;
|
|
31358
|
+
return ((_b = (_a = this._manager) === null || _a === void 0 ? void 0 : _a.VisualsRegister) === null || _b === void 0 ? void 0 : _b.GetSelected()) || [];
|
|
31359
|
+
}
|
|
31360
|
+
_getStablePivot() {
|
|
31361
|
+
const camera = this._viewer.camera;
|
|
31362
|
+
// Re-validate a cached pivot too, since it may have been established from a bad raycast.
|
|
31363
|
+
if (this._stablePivot && IsPivotPlausible(this._viewer, this._stablePivot)) {
|
|
31364
|
+
const distance = Cesium.Cartesian3.distance(camera.position, this._stablePivot);
|
|
31365
|
+
if (distance <= this.PIVOT_DISTANCE_TOLERANCE_METERS) {
|
|
31366
|
+
return this._stablePivot;
|
|
31367
|
+
}
|
|
31368
|
+
}
|
|
31369
|
+
const c = this._viewer.canvas;
|
|
31370
|
+
const center = new Cesium.Cartesian2(c.width / 2, c.height / 2);
|
|
31371
|
+
const ground = exports.DrawingUtils.GetAccuratePosition(this._viewer, center);
|
|
31372
|
+
if ((ground === null || ground === void 0 ? void 0 : ground.x) && IsPivotPlausible(this._viewer, ground)) {
|
|
31373
|
+
this._stablePivot = ground.clone();
|
|
31374
|
+
return this._stablePivot;
|
|
31375
|
+
}
|
|
31376
|
+
this._stablePivot = null;
|
|
31377
|
+
return null;
|
|
31378
|
+
}
|
|
31379
|
+
_updateStablePivot(pivot) {
|
|
31380
|
+
if (pivot && IsPivotPlausible(this._viewer, pivot)) {
|
|
31381
|
+
this._stablePivot = pivot.clone ? pivot.clone() : pivot;
|
|
31382
|
+
}
|
|
31383
|
+
}
|
|
31384
|
+
_listenGlobalRelease() {
|
|
31385
|
+
this._globalMouseUp = () => this._handlePointerUp();
|
|
31386
|
+
this._globalTouchEnd = () => this._handlePointerUp();
|
|
31387
|
+
window.addEventListener("mouseup", this._globalMouseUp);
|
|
31388
|
+
window.addEventListener("touchend", this._globalTouchEnd);
|
|
30768
31389
|
}
|
|
30769
31390
|
_listenToRenders() {
|
|
30770
31391
|
if (this._renderRemoval) {
|
|
@@ -30776,10 +31397,30 @@
|
|
|
30776
31397
|
});
|
|
30777
31398
|
}
|
|
30778
31399
|
Dispose() {
|
|
31400
|
+
var _a, _b, _c;
|
|
30779
31401
|
if (this._renderRemoval) {
|
|
30780
31402
|
this._renderRemoval();
|
|
30781
31403
|
this._renderRemoval = null;
|
|
30782
31404
|
}
|
|
31405
|
+
if (this._globalMouseUp) {
|
|
31406
|
+
window.removeEventListener("mouseup", this._globalMouseUp);
|
|
31407
|
+
}
|
|
31408
|
+
if (this._globalTouchEnd) {
|
|
31409
|
+
window.removeEventListener("touchend", this._globalTouchEnd);
|
|
31410
|
+
}
|
|
31411
|
+
if (this._fullscreenChange) {
|
|
31412
|
+
document.removeEventListener("fullscreenchange", this._fullscreenChange);
|
|
31413
|
+
document.removeEventListener("webkitfullscreenchange", this._fullscreenChange);
|
|
31414
|
+
}
|
|
31415
|
+
if (this._loaderTimer) {
|
|
31416
|
+
window.clearTimeout(this._loaderTimer);
|
|
31417
|
+
}
|
|
31418
|
+
if (this._holdTimer) {
|
|
31419
|
+
window.clearTimeout(this._holdTimer);
|
|
31420
|
+
}
|
|
31421
|
+
(_a = this._stopContinuous) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
31422
|
+
(_b = this._holdLoader) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
31423
|
+
(_c = this._walkthroughBar) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
30783
31424
|
super.Dispose();
|
|
30784
31425
|
}
|
|
30785
31426
|
_generateStyles() {
|
|
@@ -30793,15 +31434,14 @@
|
|
|
30793
31434
|
display: flex;
|
|
30794
31435
|
flex-direction: column;
|
|
30795
31436
|
align-items: center;
|
|
30796
|
-
width:
|
|
30797
|
-
min-height:
|
|
31437
|
+
width: 65px;
|
|
31438
|
+
min-height: 100px;
|
|
30798
31439
|
background: rgba(33, 39, 42, 0.75);
|
|
30799
|
-
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.18), 0px
|
|
31440
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.18), 0px 12px 22px -2px rgba(18, 22, 25, 0.26);
|
|
30800
31441
|
backdrop-filter: blur(20px);
|
|
30801
|
-
border-radius: 102px 102px
|
|
31442
|
+
border-radius: 102px 102px 30px 30px;
|
|
30802
31443
|
overflow: hidden;
|
|
30803
|
-
padding-top:
|
|
30804
|
-
padding-bottom: 5px;
|
|
31444
|
+
padding-top: 60px;
|
|
30805
31445
|
position: absolute;
|
|
30806
31446
|
bottom: 10px;
|
|
30807
31447
|
right: 10px;
|
|
@@ -30814,27 +31454,27 @@
|
|
|
30814
31454
|
|
|
30815
31455
|
.NextspaceNavCompassTop {
|
|
30816
31456
|
position: absolute;
|
|
30817
|
-
height:
|
|
30818
|
-
width:
|
|
30819
|
-
top:
|
|
31457
|
+
height: 65px;
|
|
31458
|
+
width: 100%;
|
|
31459
|
+
top: 0;
|
|
30820
31460
|
border-radius: 50%;
|
|
30821
|
-
border: 1px solid #4D5358;
|
|
30822
31461
|
display: flex;
|
|
30823
31462
|
justify-content: center;
|
|
30824
31463
|
align-items: center;
|
|
30825
31464
|
}
|
|
30826
31465
|
|
|
30827
31466
|
.NextspaceNavCompassAxis {
|
|
30828
|
-
background: #
|
|
30829
|
-
border: 1px solid
|
|
30830
|
-
width:
|
|
30831
|
-
height:
|
|
31467
|
+
background: #121619;
|
|
31468
|
+
border: 1px solid #ffffff1f;
|
|
31469
|
+
width: 50px;
|
|
31470
|
+
height: 50px;
|
|
30832
31471
|
border-radius: 50%;
|
|
30833
31472
|
position: relative;
|
|
30834
31473
|
display: flex;
|
|
30835
31474
|
align-items: center;
|
|
30836
31475
|
justify-content: center;
|
|
30837
31476
|
cursor: pointer;
|
|
31477
|
+
z-index: 2;
|
|
30838
31478
|
}
|
|
30839
31479
|
|
|
30840
31480
|
.NextspaceNavCompassAxis >svg {
|
|
@@ -30845,6 +31485,7 @@
|
|
|
30845
31485
|
|
|
30846
31486
|
.NextspaceNavCompassArrow {
|
|
30847
31487
|
margin-bottom: 6px;
|
|
31488
|
+
z-index: 1;
|
|
30848
31489
|
}
|
|
30849
31490
|
|
|
30850
31491
|
.NextspaceNavCompassAxis:hover .NextspaceNavCompassArrow {
|
|
@@ -30855,6 +31496,8 @@
|
|
|
30855
31496
|
.NextspaceNavCompassRow {
|
|
30856
31497
|
display: flex;
|
|
30857
31498
|
align-items: center;
|
|
31499
|
+
padding-top: 4px;
|
|
31500
|
+
padding-bottom: 4px;
|
|
30858
31501
|
}
|
|
30859
31502
|
|
|
30860
31503
|
.NextspaceNavCompassCol {
|
|
@@ -30863,8 +31506,8 @@
|
|
|
30863
31506
|
}
|
|
30864
31507
|
|
|
30865
31508
|
.NextspaceNavCompassButt {
|
|
30866
|
-
width:
|
|
30867
|
-
height:
|
|
31509
|
+
width: 28px;
|
|
31510
|
+
height: 28px;
|
|
30868
31511
|
flex-shrink: 1;
|
|
30869
31512
|
flex-grow: 0;
|
|
30870
31513
|
display: flex;
|
|
@@ -30874,24 +31517,56 @@
|
|
|
30874
31517
|
transition: 0.3s ease;
|
|
30875
31518
|
}
|
|
30876
31519
|
|
|
31520
|
+
.NextspaceNavCompassButt:hover {
|
|
31521
|
+
transform: translateY(-2px);
|
|
31522
|
+
}
|
|
31523
|
+
|
|
30877
31524
|
.NextspaceNavCompassButt[is-disabled="true"] {
|
|
30878
31525
|
opacity: 0.4;
|
|
30879
31526
|
cursor: default;
|
|
30880
31527
|
pointer-events: none;
|
|
30881
31528
|
}
|
|
30882
31529
|
|
|
30883
|
-
.
|
|
30884
|
-
|
|
31530
|
+
.NextspaceNavCompassLookButt {
|
|
31531
|
+
position: absolute;
|
|
31532
|
+
z-index: 3;
|
|
31533
|
+
margin-top: -6px;
|
|
31534
|
+
opacity: 0.7;
|
|
30885
31535
|
}
|
|
30886
31536
|
|
|
30887
|
-
.
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
|
|
30894
|
-
|
|
31537
|
+
.NextspaceNavCompassLookButt:hover {
|
|
31538
|
+
opacity: 1;
|
|
31539
|
+
}
|
|
31540
|
+
|
|
31541
|
+
.NextspaceNavCompassLookButt.look-up {
|
|
31542
|
+
top: 0;
|
|
31543
|
+
}
|
|
31544
|
+
|
|
31545
|
+
.NextspaceNavCompassLookButt.look-down {
|
|
31546
|
+
bottom: -6px;
|
|
31547
|
+
}
|
|
31548
|
+
|
|
31549
|
+
.NextspaceNavCompassRotateButt {
|
|
31550
|
+
position: absolute;
|
|
31551
|
+
z-index: 3;
|
|
31552
|
+
margin-top: 14px;
|
|
31553
|
+
width: 32px;
|
|
31554
|
+
height: 28px;
|
|
31555
|
+
transform: scale(0.8);
|
|
31556
|
+
opacity: 0.7;
|
|
31557
|
+
}
|
|
31558
|
+
|
|
31559
|
+
.NextspaceNavCompassRotateButt:hover {
|
|
31560
|
+
transform: scale(0.85) translateY(-2px);
|
|
31561
|
+
opacity: 1;
|
|
31562
|
+
}
|
|
31563
|
+
|
|
31564
|
+
.NextspaceNavCompassRotateButt.rotate-left {
|
|
31565
|
+
left: -6px;
|
|
31566
|
+
}
|
|
31567
|
+
|
|
31568
|
+
.NextspaceNavCompassRotateButt.rotate-right {
|
|
31569
|
+
right: -6px;
|
|
30895
31570
|
}
|
|
30896
31571
|
|
|
30897
31572
|
.NextspaceNavCompassVerDash {
|
|
@@ -30908,13 +31583,22 @@
|
|
|
30908
31583
|
|
|
30909
31584
|
.NextspaceNavCompassDimToggle {
|
|
30910
31585
|
background: #121619;
|
|
30911
|
-
|
|
30912
|
-
|
|
31586
|
+
width: 100%;
|
|
31587
|
+
margin-left: auto;
|
|
31588
|
+
margin-right: auto;
|
|
30913
31589
|
height: 24px;
|
|
30914
31590
|
flex-grow: 0;
|
|
30915
31591
|
flex-shrink: 1;
|
|
30916
|
-
padding: 2px;
|
|
31592
|
+
padding: 2px 0;
|
|
30917
31593
|
display: flex;
|
|
31594
|
+
align-items: center;
|
|
31595
|
+
justify-content: center;
|
|
31596
|
+
color: white;
|
|
31597
|
+
transition: 0.3s ease;
|
|
31598
|
+
font-size: 12px;
|
|
31599
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
31600
|
+
border: 1px solid #ffffff1f;
|
|
31601
|
+
border-radius: 0 0 9px 9px;
|
|
30918
31602
|
}
|
|
30919
31603
|
|
|
30920
31604
|
.NextspaceNavCompassDimToggleButt {
|
|
@@ -30925,12 +31609,21 @@
|
|
|
30925
31609
|
flex-grow: 1;
|
|
30926
31610
|
flex-shrink: 1;
|
|
30927
31611
|
width: 100%;
|
|
31612
|
+
height: 100%;
|
|
30928
31613
|
transition: 0.3s ease;
|
|
30929
31614
|
cursor: pointer;
|
|
30930
31615
|
opacity: 0.4;
|
|
30931
31616
|
color: white;
|
|
30932
|
-
|
|
30933
|
-
|
|
31617
|
+
}
|
|
31618
|
+
|
|
31619
|
+
.NextspaceNavCompassDimToggleButt:first-child {
|
|
31620
|
+
margin-left: 2px;
|
|
31621
|
+
border-radius: 2px 2px 1px 6px;
|
|
31622
|
+
}
|
|
31623
|
+
|
|
31624
|
+
.NextspaceNavCompassDimToggleButt:last-child {
|
|
31625
|
+
margin-right: 2px;
|
|
31626
|
+
border-radius: 2px 2px 6px 1px;
|
|
30934
31627
|
}
|
|
30935
31628
|
|
|
30936
31629
|
.NextspaceNavCompassDimToggleButt[is-selected="true"] {
|
|
@@ -30938,6 +31631,12 @@
|
|
|
30938
31631
|
background-color: #4D5358;
|
|
30939
31632
|
box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.12);
|
|
30940
31633
|
}
|
|
31634
|
+
|
|
31635
|
+
.NextspaceNavCompassDimToggle[is-disabled="true"] {
|
|
31636
|
+
opacity: 0.7;
|
|
31637
|
+
cursor: default;
|
|
31638
|
+
pointer-events: none;
|
|
31639
|
+
}
|
|
30941
31640
|
`;
|
|
30942
31641
|
document.head.appendChild(style);
|
|
30943
31642
|
}
|
|
@@ -30947,34 +31646,24 @@
|
|
|
30947
31646
|
const top = document.createElement("div");
|
|
30948
31647
|
top.className = "NextspaceNavCompassTop";
|
|
30949
31648
|
element.appendChild(top);
|
|
31649
|
+
this._generateLookButtons(top);
|
|
31650
|
+
this._generateRotateButtons(top);
|
|
31651
|
+
this._generateAxis(top);
|
|
31652
|
+
this._generateZoomRow(element);
|
|
31653
|
+
this._generateExtraTools(element);
|
|
31654
|
+
this._generateDimensionToggle(element);
|
|
31655
|
+
this.Container.appendChild(element);
|
|
31656
|
+
this._element = element;
|
|
31657
|
+
this._update2d3d();
|
|
31658
|
+
}
|
|
31659
|
+
_generateAxis(top) {
|
|
30950
31660
|
const axis = document.createElement("div");
|
|
30951
31661
|
axis.className = "NextspaceNavCompassAxis";
|
|
30952
31662
|
axis.setAttribute("title", "Click to reset north");
|
|
30953
31663
|
top.appendChild(axis);
|
|
30954
|
-
axis.addEventListener("click", () =>
|
|
30955
|
-
this._clickResetNorth();
|
|
30956
|
-
});
|
|
31664
|
+
axis.addEventListener("click", () => this._clickResetNorth());
|
|
30957
31665
|
axis.innerHTML = `
|
|
30958
|
-
<svg width="
|
|
30959
|
-
<rect x="46" width="2" height="8" rx="1" fill="#FF3D00"/>
|
|
30960
|
-
<rect x="46" y="86" width="2" height="8" rx="1" fill="#4D5254"/>
|
|
30961
|
-
<rect x="94" y="46" width="2" height="8" rx="1" transform="rotate(90 94 46)" fill="#4D5254"/>
|
|
30962
|
-
<rect x="8" y="46" width="2" height="8" rx="1" transform="rotate(90 8 46)" fill="#4D5254"/>
|
|
30963
|
-
<rect x="79.5269" y="13.0589" width="2" height="8" rx="1" transform="rotate(45 79.5269 13.0589)" fill="#4D5254"/>
|
|
30964
|
-
<rect x="18.7157" y="73.8701" width="2" height="8" rx="1" transform="rotate(45 18.7157 73.8701)" fill="#4D5254"/>
|
|
30965
|
-
<rect x="80.9412" y="79.5269" width="2" height="8" rx="1" transform="rotate(135 80.9412 79.5269)" fill="#4D5254"/>
|
|
30966
|
-
<rect x="20.1299" y="18.7157" width="2" height="8" rx="1" transform="rotate(135 20.1299 18.7157)" fill="#4D5254"/>
|
|
30967
|
-
<rect x="28.8555" y="5.80811" width="2" height="4" rx="1" transform="rotate(-22.5 28.8555 5.80811)" fill="#505456"/>
|
|
30968
|
-
<rect x="61.7662" y="85.2617" width="2" height="4" rx="1" transform="rotate(-22.5 61.7662 85.2617)" fill="#505456"/>
|
|
30969
|
-
<rect x="88.1919" y="28.8553" width="2" height="4" rx="1" transform="rotate(67.5 88.1919 28.8553)" fill="#505456"/>
|
|
30970
|
-
<rect x="8.73828" y="61.7661" width="2" height="4" rx="1" transform="rotate(67.5 8.73828 61.7661)" fill="#505456"/>
|
|
30971
|
-
<rect x="63.2969" y="5.04272" width="2" height="4" rx="1" transform="rotate(22.5 63.2969 5.04272)" fill="#505456"/>
|
|
30972
|
-
<rect x="30.386" y="84.4963" width="2" height="4" rx="1" transform="rotate(22.5 30.386 84.4963)" fill="#505456"/>
|
|
30973
|
-
<rect x="88.9572" y="63.2969" width="2" height="4" rx="1" transform="rotate(112.5 88.9572 63.2969)" fill="#505456"/>
|
|
30974
|
-
<rect x="9.50354" y="30.3861" width="2" height="4" rx="1" transform="rotate(112.5 9.50354 30.3861)" fill="#505456"/>
|
|
30975
|
-
</svg>
|
|
30976
|
-
|
|
30977
|
-
<svg class="NextspaceNavCompassArrow" width="28" height="35" viewBox="0 0 32 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31666
|
+
<svg class="NextspaceNavCompassArrow" width="21" height="26.25" viewBox="0 0 32 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30978
31667
|
<path d="M31.544 39.666C31.969 39.29 32.114 38.682 31.905 38.15L17.229 0.845C17.028 0.334 16.542 0 16.001 0C15.46 0 14.974 0.335 14.773 0.846L0.0950303 38.155C-0.11397 38.687 0.0310303 39.295 0.45603 39.67C0.88103 40.046 1.49303 40.106 1.98203 39.821L14.699 32.401C15.515 31.925 16.518 31.925 17.333 32.401L30.019 39.816C30.507 40.101 31.12 40.041 31.545 39.665L31.544 39.666Z" fill="url(#paint0_linear_363_9865)"/>
|
|
30979
31668
|
<path d="M16.001 0C15.46 0 14.974 0.335 14.773 0.846L0.0950303 38.155C-0.11397 38.687 0.0310303 39.295 0.45603 39.67C0.88103 40.046 1.49303 40.106 1.98203 39.821L14.699 32.401C15.103 32.165 15.552 32.047 16.002 32.045V0H16.001Z" fill="#1192E8"/>
|
|
30980
31669
|
<path d="M0.454956 39.67C0.879956 40.046 1.49196 40.106 1.98096 39.821L14.698 32.401C15.102 32.165 15.551 32.047 16.001 32.045V24.844L0.454956 39.67Z" fill="url(#paint1_linear_363_9865)"/>
|
|
@@ -30996,214 +31685,370 @@
|
|
|
30996
31685
|
</svg>
|
|
30997
31686
|
`;
|
|
30998
31687
|
this._axis = axis;
|
|
30999
|
-
|
|
31000
|
-
|
|
31001
|
-
|
|
31002
|
-
|
|
31003
|
-
|
|
31004
|
-
|
|
31005
|
-
|
|
31006
|
-
</
|
|
31007
|
-
|
|
31008
|
-
<div class="NextspaceNavCompassButt">
|
|
31009
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31010
|
-
<path d="M16 12.5C16 16.743 13.4795 20.389 9.85547 22.043C9.31247 22.291 8.67142 22.0152 8.48242 21.4492C8.32242 20.9702 8.54781 20.4473 9.00781 20.2383C11.9518 18.9023 14 15.943 14 12.5C14 10.3219 13.1703 8.34307 11.8223 6.83983L8.85352 9.80858C8.65852 10.0036 8.34149 10.0036 8.14648 9.80858C8.04948 9.71058 8 9.58306 8 9.45506L8 2.95506C8 2.68985 8.10536 2.43549 8.29289 2.24795C8.48043 2.06042 8.73478 1.95506 9 1.95506L15.5 1.95506C15.628 1.95506 15.7565 2.00355 15.8535 2.10155C16.0485 2.29655 16.0485 2.61358 15.8535 2.80858L13.2305 5.43163C14.943 7.29483 16 9.76796 16 12.5Z" fill="#A2A9B0"/>
|
|
31011
|
-
</svg>
|
|
31012
|
-
</div>
|
|
31688
|
+
}
|
|
31689
|
+
_generateLookButtons(top) {
|
|
31690
|
+
const lookUp = document.createElement("div");
|
|
31691
|
+
lookUp.className = "NextspaceNavCompassButt NextspaceNavCompassLookButt look-up";
|
|
31692
|
+
lookUp.innerHTML = `
|
|
31693
|
+
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31694
|
+
<path d="M1 8L8 1L15 8" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31695
|
+
</svg>
|
|
31013
31696
|
`;
|
|
31014
|
-
|
|
31015
|
-
|
|
31016
|
-
|
|
31017
|
-
|
|
31018
|
-
|
|
31697
|
+
top.appendChild(lookUp);
|
|
31698
|
+
this._attachHold(lookUp, {
|
|
31699
|
+
action: () => this._clickLookUp(),
|
|
31700
|
+
continuousAction: () => StartContinuousLook({
|
|
31701
|
+
viewer: this._viewer,
|
|
31702
|
+
manager: this._manager,
|
|
31703
|
+
lookUp: true,
|
|
31704
|
+
selectedIds: this._getSelectedIds(),
|
|
31705
|
+
stablePivot: this._getStablePivot(),
|
|
31706
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31707
|
+
})
|
|
31019
31708
|
});
|
|
31020
|
-
|
|
31021
|
-
|
|
31709
|
+
this._lookUp = lookUp;
|
|
31710
|
+
const lookDown = document.createElement("div");
|
|
31711
|
+
lookDown.className = "NextspaceNavCompassButt NextspaceNavCompassLookButt look-down";
|
|
31712
|
+
lookDown.innerHTML = `
|
|
31713
|
+
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31714
|
+
<path d="M15 1L8 8L1 1" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31715
|
+
</svg>
|
|
31716
|
+
`;
|
|
31717
|
+
top.appendChild(lookDown);
|
|
31718
|
+
this._attachHold(lookDown, {
|
|
31719
|
+
action: () => this._clickLookDown(),
|
|
31720
|
+
continuousAction: () => StartContinuousLook({
|
|
31721
|
+
viewer: this._viewer,
|
|
31722
|
+
manager: this._manager,
|
|
31723
|
+
lookUp: false,
|
|
31724
|
+
selectedIds: this._getSelectedIds(),
|
|
31725
|
+
stablePivot: this._getStablePivot(),
|
|
31726
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31727
|
+
})
|
|
31022
31728
|
});
|
|
31023
|
-
|
|
31024
|
-
|
|
31025
|
-
|
|
31026
|
-
const
|
|
31027
|
-
|
|
31028
|
-
|
|
31029
|
-
|
|
31030
|
-
|
|
31031
|
-
<
|
|
31032
|
-
|
|
31033
|
-
|
|
31034
|
-
</div>
|
|
31035
|
-
|
|
31036
|
-
<div class="NextspaceNavCompassButt">
|
|
31037
|
-
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31038
|
-
<path d="M15 1L8 8L1 1" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31039
|
-
</svg>
|
|
31040
|
-
</div>
|
|
31041
|
-
</div>
|
|
31042
|
-
<div class="NextspaceNavCompassVerDash"></div>
|
|
31043
|
-
<div class="NextspaceNavCompassCol">
|
|
31044
|
-
<div class="NextspaceNavCompassButt">
|
|
31045
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31046
|
-
<path d="M8 1V15" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31047
|
-
<path d="M15 8L1 8" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31048
|
-
</svg>
|
|
31049
|
-
</div>
|
|
31050
|
-
|
|
31051
|
-
<div class="NextspaceNavCompassButt">
|
|
31052
|
-
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31053
|
-
<path d="M15 1L1 0.999999" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31054
|
-
</svg>
|
|
31055
|
-
</div>
|
|
31056
|
-
</div>
|
|
31729
|
+
this._lookDown = lookDown;
|
|
31730
|
+
}
|
|
31731
|
+
_rotateIconSvg(flip) {
|
|
31732
|
+
const transform = flip ? "scaleX(-1) rotate(145deg)" : "rotate(145deg)";
|
|
31733
|
+
return `
|
|
31734
|
+
<svg style="transform: ${transform}" width="22" height="22" viewBox="0 0 565.3 533.667" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31735
|
+
<g transform="translate(33.5 33.5)">
|
|
31736
|
+
<path d="M0 0L97.1 97.0987C97.1 97.0987 97.1 97.0987 97.1 97.0987C98.7 98.701 98.7 101.3 97.1 102.9C97.1 102.9 97.1 102.9 97.1 102.9L0 200" fill="none" stroke-width="67" stroke="#A2A9B0" stroke-linecap="round" stroke-linejoin="round" transform="translate(400 0)"/>
|
|
31737
|
+
<path d="M466.667 0C466.667 0 350 0 350 0C156.7 0 0 156.7 0 350C0 350 0 366.667 0 366.667" fill="none" stroke-width="67" stroke="#A2A9B0" stroke-linecap="round" stroke-linejoin="round" transform="translate(0 100)"/>
|
|
31738
|
+
</g>
|
|
31739
|
+
</svg>
|
|
31057
31740
|
`;
|
|
31058
|
-
|
|
31059
|
-
|
|
31060
|
-
|
|
31061
|
-
|
|
31062
|
-
|
|
31063
|
-
|
|
31741
|
+
}
|
|
31742
|
+
_generateRotateButtons(top) {
|
|
31743
|
+
const rotateLeft = document.createElement("div");
|
|
31744
|
+
rotateLeft.className = "NextspaceNavCompassButt NextspaceNavCompassRotateButt rotate-left";
|
|
31745
|
+
rotateLeft.innerHTML = this._rotateIconSvg(true);
|
|
31746
|
+
top.appendChild(rotateLeft);
|
|
31747
|
+
this._attachHold(rotateLeft, {
|
|
31748
|
+
action: () => this._clickRotate(-Math.PI * 0.25),
|
|
31749
|
+
continuousAction: () => StartContinuousRotate({
|
|
31750
|
+
viewer: this._viewer,
|
|
31751
|
+
manager: this._manager,
|
|
31752
|
+
rotateLeft: true,
|
|
31753
|
+
selectedIds: this._getSelectedIds(),
|
|
31754
|
+
stablePivot: this._getStablePivot(),
|
|
31755
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31756
|
+
})
|
|
31064
31757
|
});
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31758
|
+
const rotateRight = document.createElement("div");
|
|
31759
|
+
rotateRight.className = "NextspaceNavCompassButt NextspaceNavCompassRotateButt rotate-right";
|
|
31760
|
+
rotateRight.innerHTML = this._rotateIconSvg(false);
|
|
31761
|
+
top.appendChild(rotateRight);
|
|
31762
|
+
this._attachHold(rotateRight, {
|
|
31763
|
+
action: () => this._clickRotate(Math.PI * 0.25),
|
|
31764
|
+
continuousAction: () => StartContinuousRotate({
|
|
31765
|
+
viewer: this._viewer,
|
|
31766
|
+
manager: this._manager,
|
|
31767
|
+
rotateLeft: false,
|
|
31768
|
+
selectedIds: this._getSelectedIds(),
|
|
31769
|
+
stablePivot: this._getStablePivot(),
|
|
31770
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31771
|
+
})
|
|
31068
31772
|
});
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
|
|
31072
|
-
|
|
31773
|
+
}
|
|
31774
|
+
_generateZoomRow(element) {
|
|
31775
|
+
const row = document.createElement("div");
|
|
31776
|
+
row.className = "NextspaceNavCompassRow";
|
|
31777
|
+
element.appendChild(row);
|
|
31778
|
+
const zoomIn = document.createElement("div");
|
|
31779
|
+
zoomIn.className = "NextspaceNavCompassButt";
|
|
31780
|
+
zoomIn.innerHTML = `
|
|
31781
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31782
|
+
<path d="M8 1V15" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31783
|
+
<path d="M15 8L1 8" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31784
|
+
</svg>
|
|
31785
|
+
`;
|
|
31786
|
+
row.appendChild(zoomIn);
|
|
31787
|
+
this._attachHold(zoomIn, {
|
|
31788
|
+
action: () => this._clickZoom(true),
|
|
31789
|
+
continuousAction: () => StartContinuousZoom({
|
|
31790
|
+
viewer: this._viewer,
|
|
31791
|
+
zoomIn: true,
|
|
31792
|
+
stablePivot: this._getStablePivot(),
|
|
31793
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31794
|
+
})
|
|
31073
31795
|
});
|
|
31074
|
-
zoomOut.
|
|
31075
|
-
|
|
31796
|
+
const zoomOut = document.createElement("div");
|
|
31797
|
+
zoomOut.className = "NextspaceNavCompassButt";
|
|
31798
|
+
zoomOut.innerHTML = `
|
|
31799
|
+
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31800
|
+
<path d="M15 1L1 0.999999" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31801
|
+
</svg>
|
|
31802
|
+
`;
|
|
31803
|
+
row.appendChild(zoomOut);
|
|
31804
|
+
this._attachHold(zoomOut, {
|
|
31805
|
+
action: () => this._clickZoom(false),
|
|
31806
|
+
continuousAction: () => StartContinuousZoom({
|
|
31807
|
+
viewer: this._viewer,
|
|
31808
|
+
zoomIn: false,
|
|
31809
|
+
stablePivot: this._getStablePivot(),
|
|
31810
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31811
|
+
})
|
|
31076
31812
|
});
|
|
31813
|
+
}
|
|
31814
|
+
_generateExtraTools(element) {
|
|
31815
|
+
const row = document.createElement("div");
|
|
31816
|
+
row.className = "NextspaceNavCompassRow";
|
|
31817
|
+
row.style.paddingTop = "0";
|
|
31818
|
+
row.style.paddingBottom = "8px";
|
|
31819
|
+
element.appendChild(row);
|
|
31820
|
+
const walkthroughButt = document.createElement("div");
|
|
31821
|
+
walkthroughButt.className = "NextspaceNavCompassButt";
|
|
31822
|
+
walkthroughButt.setAttribute("title", "Toggle Walkthrough mode");
|
|
31823
|
+
walkthroughButt.innerHTML = this._walkthroughIconSvg(false);
|
|
31824
|
+
walkthroughButt.addEventListener("click", () => this._toggleWalkthrough());
|
|
31825
|
+
row.appendChild(walkthroughButt);
|
|
31826
|
+
this._walkthroughButt = walkthroughButt;
|
|
31827
|
+
const vrButt = document.createElement("div");
|
|
31828
|
+
vrButt.className = "NextspaceNavCompassButt";
|
|
31829
|
+
vrButt.setAttribute("title", "Toggle VR mode");
|
|
31830
|
+
vrButt.innerHTML = this._vrIconSvg(false);
|
|
31831
|
+
vrButt.addEventListener("click", () => this._toggleVR());
|
|
31832
|
+
row.appendChild(vrButt);
|
|
31833
|
+
this._vrButt = vrButt;
|
|
31834
|
+
this._fullscreenChange = () => {
|
|
31835
|
+
if (Cesium.Fullscreen.fullscreen || !this._isVR) {
|
|
31836
|
+
return;
|
|
31837
|
+
}
|
|
31838
|
+
this._setVR(false);
|
|
31839
|
+
};
|
|
31840
|
+
document.addEventListener("fullscreenchange", this._fullscreenChange);
|
|
31841
|
+
document.addEventListener("webkitfullscreenchange", this._fullscreenChange);
|
|
31842
|
+
}
|
|
31843
|
+
_walkthroughIconSvg(active) {
|
|
31844
|
+
const color = active ? "#4D9CF8" : "#A2A9B0";
|
|
31845
|
+
return `
|
|
31846
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31847
|
+
<path d="M17.5033 4C16.8406 4 16.205 4.26339 15.7364 4.73223C15.2678 5.20107 15.0045 5.83696 15.0045 6.5C15.0045 7.16304 15.2678 7.79893 15.7364 8.26777C16.205 8.73661 16.8406 9 17.5033 9C18.166 9 18.8015 8.73661 19.2701 8.26777C19.7388 7.79893 20.002 7.16304 20.002 6.5C20.002 5.83696 19.7388 5.20107 19.2701 4.73223C18.8015 4.26339 18.166 4 17.5033 4ZM15.5023 10C15.1066 10 14.7378 10.1015 14.4052 10.2656C14.3549 10.2813 14.306 10.3009 14.2588 10.3242L10.3448 12.1992C10.1322 12.3003 9.96216 12.4733 9.86453 12.6875L8.09784 16.5859C8.0405 16.7059 8.00764 16.836 8.00118 16.9688C7.99472 17.1016 8.01479 17.2344 8.06021 17.3593C8.10563 17.4843 8.1755 17.5989 8.26572 17.6965C8.35594 17.7941 8.46471 17.8727 8.58567 17.9278C8.70662 17.9828 8.83733 18.0132 8.97016 18.0171C9.10299 18.0211 9.23526 17.9984 9.35924 17.9506C9.48323 17.9028 9.59644 17.8307 9.69225 17.7386C9.78806 17.6464 9.86454 17.5361 9.91724 17.4141L11.3638 14.2246L12.658 13.8359C12.3918 15.2411 12.0603 16.9816 12.0587 16.9902C12.0583 16.9923 12.0572 16.994 12.0568 16.9961C12.0568 16.9961 12.0568 17 12.0568 17C12.024 17.1615 12.006 17.3288 12.006 17.5C12.006 18.271 12.3631 18.9514 12.9118 19.4102L12.9196 19.4336L16.8103 22.5L17.923 26.6953L18.0225 27.1953C18.0677 27.4221 18.19 27.6263 18.3687 27.773C18.5474 27.9197 18.7714 27.9999 19.0025 28C19.2676 28 19.5218 27.8946 19.7093 27.7071C19.8967 27.5196 20.002 27.2652 20.002 27C20.0019 26.9344 19.9954 26.869 19.9825 26.8047V26.8008C19.9812 26.7969 19.9799 26.793 19.9786 26.7891L18.983 21.8047C18.9562 21.6693 18.9017 21.541 18.8229 21.4277L16.9528 18.0039C16.9546 17.9951 16.953 17.9854 16.9547 17.9766L17.9366 13.0625L17.9347 13.0605C17.9762 12.8798 18.003 12.6933 18.003 12.5C18.003 11.1207 16.8837 10.0011 15.5023 10ZM19.3871 13.7422L18.9186 16.0078L19.3344 16.3809C19.4093 16.4489 19.4962 16.5059 19.5882 16.5469L22.5866 17.9102V17.9082C22.7165 17.9681 22.8576 17.9994 23.0005 18C23.2656 18 23.5198 17.8946 23.7073 17.7071C23.8947 17.5196 24 17.2652 24 17C23.9996 16.8084 23.9442 16.6209 23.8404 16.4599C23.7366 16.2989 23.5887 16.1711 23.4144 16.0918V16.0898L20.5545 14.7891L19.3871 13.7422ZM11.9631 20.7246L11.4497 22.4219L9.22228 26.3613L9.1481 26.4863L9.15005 26.4883C9.13825 26.5087 9.12718 26.5296 9.11686 26.5508L9.10905 26.5625C9.0425 26.6987 9.00778 26.8484 9.00754 27C9.00754 27.2652 9.11285 27.5196 9.30029 27.7071C9.48773 27.8946 9.74195 28 10.007 28C10.1647 27.9999 10.3201 27.9626 10.4606 27.891C10.601 27.8193 10.7225 27.7155 10.8152 27.5879H10.8172L10.8328 27.5645C10.8334 27.5632 10.8341 27.5618 10.8347 27.5605L14.1592 22.5117L11.9631 20.7246Z" fill="${color}"/>
|
|
31848
|
+
</svg>
|
|
31849
|
+
`;
|
|
31850
|
+
}
|
|
31851
|
+
_vrIconSvg(active) {
|
|
31852
|
+
const color = active ? "#4D9CF8" : "#A2A9B0";
|
|
31853
|
+
return `
|
|
31854
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
31855
|
+
<path d="M20 6a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-4a2 2 0 0 1-1.6-.8l-1.6-2.13a1 1 0 0 0-1.6 0L9.6 17.2A2 2 0 0 1 8 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/>
|
|
31856
|
+
</svg>
|
|
31857
|
+
`;
|
|
31858
|
+
}
|
|
31859
|
+
_generateDimensionToggle(element) {
|
|
31077
31860
|
const dimToggle = document.createElement("div");
|
|
31078
31861
|
dimToggle.className = "NextspaceNavCompassDimToggle";
|
|
31079
31862
|
dimToggle.innerHTML = `
|
|
31080
|
-
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">
|
|
31081
|
-
|
|
31082
|
-
</div>
|
|
31083
|
-
|
|
31084
|
-
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">
|
|
31085
|
-
2D
|
|
31086
|
-
</div>
|
|
31863
|
+
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">3D</div>
|
|
31864
|
+
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">2D</div>
|
|
31087
31865
|
`;
|
|
31088
31866
|
element.appendChild(dimToggle);
|
|
31089
|
-
|
|
31090
|
-
this._2d = butt2d;
|
|
31091
|
-
butt2d.addEventListener("click", () => {
|
|
31092
|
-
this._toggle2d3d();
|
|
31093
|
-
});
|
|
31867
|
+
this._dimensionToggle = dimToggle;
|
|
31094
31868
|
const butt3d = dimToggle.children[0];
|
|
31869
|
+
const butt2d = dimToggle.children[1];
|
|
31095
31870
|
this._3d = butt3d;
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31871
|
+
this._2d = butt2d;
|
|
31872
|
+
butt3d.addEventListener("click", () => this._toggle2d3d());
|
|
31873
|
+
butt2d.addEventListener("click", () => this._toggle2d3d());
|
|
31874
|
+
}
|
|
31875
|
+
_attachHold(el, params) {
|
|
31876
|
+
const start = (e) => {
|
|
31877
|
+
e.stopPropagation();
|
|
31878
|
+
this._handlePointerDown(params.action, params.continuousAction, e);
|
|
31879
|
+
};
|
|
31880
|
+
el.addEventListener("mousedown", start);
|
|
31881
|
+
el.addEventListener("touchstart", start, { passive: true });
|
|
31882
|
+
}
|
|
31883
|
+
_handlePointerDown(action, continuousAction, e) {
|
|
31884
|
+
const x = "clientX" in e ? e.clientX : e.touches[0].clientX;
|
|
31885
|
+
const y = "clientY" in e ? e.clientY : e.touches[0].clientY;
|
|
31886
|
+
const isTouch = "touches" in e;
|
|
31887
|
+
this._didActivateContinuous = false;
|
|
31888
|
+
this._pendingSingleAction = action;
|
|
31889
|
+
this._loaderTimer = window.setTimeout(() => {
|
|
31890
|
+
this._holdLoader = new WidgetNavCompassHoldLoader({ x, y, durationMs: 200, isTouch });
|
|
31891
|
+
this._loaderTimer = null;
|
|
31892
|
+
}, HOLD_LOADER_DELAY_MS);
|
|
31893
|
+
this._holdTimer = window.setTimeout(() => {
|
|
31894
|
+
this._didActivateContinuous = true;
|
|
31895
|
+
this._pendingSingleAction = null;
|
|
31896
|
+
this._stopContinuous = continuousAction();
|
|
31897
|
+
this._holdTimer = null;
|
|
31898
|
+
}, HOLD_ACTIVATION_TIME_MS);
|
|
31899
|
+
}
|
|
31900
|
+
_handlePointerUp() {
|
|
31901
|
+
var _a;
|
|
31902
|
+
if (!this._holdLoader && !this._holdTimer && !this._stopContinuous && !this._loaderTimer) {
|
|
31903
|
+
return;
|
|
31904
|
+
}
|
|
31905
|
+
if (this._loaderTimer) {
|
|
31906
|
+
window.clearTimeout(this._loaderTimer);
|
|
31907
|
+
this._loaderTimer = null;
|
|
31908
|
+
}
|
|
31909
|
+
if (this._holdTimer) {
|
|
31910
|
+
window.clearTimeout(this._holdTimer);
|
|
31911
|
+
this._holdTimer = null;
|
|
31912
|
+
}
|
|
31913
|
+
if (this._stopContinuous) {
|
|
31914
|
+
this._stopContinuous();
|
|
31915
|
+
this._stopContinuous = null;
|
|
31916
|
+
}
|
|
31917
|
+
if (this._pendingSingleAction && !this._didActivateContinuous) {
|
|
31918
|
+
const action = this._pendingSingleAction;
|
|
31919
|
+
this._pendingSingleAction = null;
|
|
31920
|
+
setTimeout(() => action(), 0);
|
|
31921
|
+
}
|
|
31922
|
+
(_a = this._holdLoader) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
31923
|
+
this._holdLoader = null;
|
|
31924
|
+
this._didActivateContinuous = false;
|
|
31102
31925
|
}
|
|
31103
31926
|
_updateAxis() {
|
|
31104
|
-
const heading = this._viewer.camera.heading;
|
|
31105
|
-
const
|
|
31106
|
-
|
|
31927
|
+
const heading = Number(this._viewer.camera.heading);
|
|
31928
|
+
const headingDegrees = 360 - Cesium.Math.toDegrees(heading);
|
|
31929
|
+
this._axis.style.transform = `rotate(${headingDegrees}deg)`;
|
|
31107
31930
|
}
|
|
31108
31931
|
_clickResetNorth() {
|
|
31109
31932
|
const viewer = this._viewer;
|
|
31110
31933
|
const h = viewer.camera.heading;
|
|
31111
31934
|
const north = h < Math.PI ? h : h - Math.PI * 2;
|
|
31112
|
-
this.
|
|
31935
|
+
this._clickRotate(north);
|
|
31936
|
+
}
|
|
31937
|
+
// Chains a single-tap action onto any in-flight one so animations never overlap.
|
|
31938
|
+
_runOrbitAction(fn) {
|
|
31939
|
+
const run = this._orbitActionChain.then(fn, fn);
|
|
31940
|
+
this._orbitActionChain = run.catch(() => { });
|
|
31941
|
+
return run;
|
|
31942
|
+
}
|
|
31943
|
+
_clickRotate(radians) {
|
|
31944
|
+
this._runOrbitAction(async () => {
|
|
31945
|
+
const pivot = await DoRotate({
|
|
31946
|
+
viewer: this._viewer,
|
|
31947
|
+
manager: this._manager,
|
|
31948
|
+
radians,
|
|
31949
|
+
selectedIds: this._getSelectedIds(),
|
|
31950
|
+
stablePivot: this._getStablePivot(),
|
|
31951
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31952
|
+
});
|
|
31953
|
+
this._updateStablePivot(pivot);
|
|
31954
|
+
});
|
|
31113
31955
|
}
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
|
|
31117
|
-
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31956
|
+
_clickZoom(zoomIn) {
|
|
31957
|
+
this._runOrbitAction(async () => {
|
|
31958
|
+
const pivot = await DoZoom({
|
|
31959
|
+
viewer: this._viewer,
|
|
31960
|
+
zoomIn,
|
|
31961
|
+
stablePivot: this._getStablePivot(),
|
|
31962
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31963
|
+
});
|
|
31964
|
+
this._updateStablePivot(pivot);
|
|
31965
|
+
});
|
|
31966
|
+
}
|
|
31967
|
+
_clickLookUp() {
|
|
31968
|
+
if (GetIs2d(this._viewer)) {
|
|
31969
|
+
return;
|
|
31970
|
+
}
|
|
31971
|
+
this._runOrbitAction(async () => {
|
|
31972
|
+
const pivot = await DoLook({
|
|
31973
|
+
viewer: this._viewer,
|
|
31974
|
+
manager: this._manager,
|
|
31975
|
+
tiltUp: true,
|
|
31976
|
+
selectedIds: this._getSelectedIds(),
|
|
31977
|
+
stablePivot: this._getStablePivot(),
|
|
31978
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31979
|
+
});
|
|
31980
|
+
this._updateStablePivot(pivot);
|
|
31981
|
+
});
|
|
31982
|
+
}
|
|
31983
|
+
_clickLookDown() {
|
|
31984
|
+
if (GetIs2d(this._viewer)) {
|
|
31985
|
+
return;
|
|
31986
|
+
}
|
|
31987
|
+
this._runOrbitAction(async () => {
|
|
31988
|
+
const pivot = await DoLook({
|
|
31989
|
+
viewer: this._viewer,
|
|
31990
|
+
manager: this._manager,
|
|
31991
|
+
tiltUp: false,
|
|
31992
|
+
selectedIds: this._getSelectedIds(),
|
|
31993
|
+
stablePivot: this._getStablePivot(),
|
|
31994
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31995
|
+
});
|
|
31996
|
+
this._updateStablePivot(pivot);
|
|
31997
|
+
});
|
|
31998
|
+
}
|
|
31999
|
+
_toggleWalkthrough() {
|
|
32000
|
+
this._setWalkthrough(!this._isWalkthroughActive);
|
|
32001
|
+
}
|
|
32002
|
+
_setWalkthrough(active) {
|
|
32003
|
+
var _a, _b, _c;
|
|
32004
|
+
this._isWalkthroughActive = active;
|
|
32005
|
+
this._walkthroughButt.innerHTML = this._walkthroughIconSvg(active);
|
|
32006
|
+
this._dimensionToggle.setAttribute("is-disabled", active ? "true" : "false");
|
|
32007
|
+
if (active) {
|
|
32008
|
+
exports.Walkthrough.Start({ viewer: this._viewer });
|
|
32009
|
+
(_a = this._walkthroughBar) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
32010
|
+
this._walkthroughBar = new WidgetNavCompassWalkthroughBar({
|
|
32011
|
+
viewer: this._viewer,
|
|
32012
|
+
container: this.Container,
|
|
32013
|
+
onClose: () => this._setWalkthrough(false)
|
|
31131
32014
|
});
|
|
31132
32015
|
}
|
|
31133
32016
|
else {
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
const ground = exports.DrawingUtils.GetAccuratePosition(viewer, center);
|
|
31137
|
-
if (!(ground === null || ground === void 0 ? void 0 : ground.x)) {
|
|
31138
|
-
return;
|
|
32017
|
+
if (((_b = this._viewer) === null || _b === void 0 ? void 0 : _b.scene) && !this._viewer.isDestroyed()) {
|
|
32018
|
+
exports.Walkthrough.Stop({ viewer: this._viewer });
|
|
31139
32019
|
}
|
|
31140
|
-
|
|
31141
|
-
|
|
31142
|
-
const unsub = viewer.clock.onTick.addEventListener(function () {
|
|
31143
|
-
let inc = Math.PI * TURN_SPEED;
|
|
31144
|
-
if (r + inc >= radians) {
|
|
31145
|
-
unsub();
|
|
31146
|
-
inc = radians - r;
|
|
31147
|
-
}
|
|
31148
|
-
camera.lookAt(ground, new Cesium.HeadingPitchRange(camera.heading, camera.pitch, offset));
|
|
31149
|
-
left ? camera.rotateLeft(inc) : camera.rotateRight(inc);
|
|
31150
|
-
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31151
|
-
r += inc;
|
|
31152
|
-
});
|
|
32020
|
+
(_c = this._walkthroughBar) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
32021
|
+
this._walkthroughBar = null;
|
|
31153
32022
|
}
|
|
31154
32023
|
}
|
|
31155
|
-
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31160
|
-
const
|
|
31161
|
-
if (!
|
|
32024
|
+
_toggleVR() {
|
|
32025
|
+
this._setVR(!this._isVR);
|
|
32026
|
+
}
|
|
32027
|
+
_setVR(active) {
|
|
32028
|
+
var _a, _b;
|
|
32029
|
+
const scene = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene;
|
|
32030
|
+
if (!scene) {
|
|
31162
32031
|
return;
|
|
31163
32032
|
}
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
|
|
31170
|
-
|
|
32033
|
+
try {
|
|
32034
|
+
scene.useWebVR = active;
|
|
32035
|
+
(_b = scene.requestRender) === null || _b === void 0 ? void 0 : _b.call(scene);
|
|
32036
|
+
this._isVR = active;
|
|
32037
|
+
this._vrButt.innerHTML = this._vrIconSvg(active);
|
|
32038
|
+
}
|
|
32039
|
+
catch (e) {
|
|
32040
|
+
console.warn("[VR] Failed to toggle VR mode.", e);
|
|
31171
32041
|
}
|
|
31172
|
-
const to = Cesium.Cartesian3.add(ground, offset, new Cesium.Cartesian3);
|
|
31173
|
-
camera.flyTo({
|
|
31174
|
-
destination: to,
|
|
31175
|
-
orientation: { heading: camera.heading, pitch: camera.pitch, roll: camera.roll },
|
|
31176
|
-
duration: this.ZOOM_TIME,
|
|
31177
|
-
easingFunction: Cesium.EasingFunction.QUADRATIC_IN_OUT
|
|
31178
|
-
});
|
|
31179
|
-
}
|
|
31180
|
-
_doLook(tiltUp) {
|
|
31181
|
-
const viewer = this._viewer;
|
|
31182
|
-
let diff = 6.26 / 32;
|
|
31183
|
-
if (!tiltUp) {
|
|
31184
|
-
diff *= -1;
|
|
31185
|
-
}
|
|
31186
|
-
let current = viewer.camera.pitch;
|
|
31187
|
-
current += diff;
|
|
31188
|
-
viewer.camera.flyTo({
|
|
31189
|
-
destination: viewer.camera.position,
|
|
31190
|
-
orientation: {
|
|
31191
|
-
heading: viewer.camera.heading,
|
|
31192
|
-
pitch: current,
|
|
31193
|
-
roll: viewer.camera.roll
|
|
31194
|
-
},
|
|
31195
|
-
duration: 0.2
|
|
31196
|
-
});
|
|
31197
32042
|
}
|
|
31198
32043
|
_update2d3d() {
|
|
31199
|
-
const is2d = this.
|
|
32044
|
+
const is2d = GetIs2d(this._viewer);
|
|
31200
32045
|
this._2d.setAttribute("is-selected", is2d ? "true" : "false");
|
|
31201
32046
|
this._3d.setAttribute("is-selected", is2d ? "false" : "true");
|
|
31202
|
-
this.
|
|
31203
|
-
this.
|
|
32047
|
+
this._lookUp.style.display = is2d ? "none" : "flex";
|
|
32048
|
+
this._lookDown.style.display = is2d ? "none" : "flex";
|
|
31204
32049
|
}
|
|
31205
32050
|
_toggle2d3d() {
|
|
31206
|
-
const shouldBe2d = !this.
|
|
32051
|
+
const shouldBe2d = !GetIs2d(this._viewer);
|
|
31207
32052
|
exports.ViewUtils.Set2dStatus({
|
|
31208
32053
|
status: shouldBe2d,
|
|
31209
32054
|
viewer: this._viewer,
|
|
@@ -37446,7 +38291,7 @@
|
|
|
37446
38291
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
37447
38292
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
37448
38293
|
|
|
37449
|
-
const VERSION = "6.
|
|
38294
|
+
const VERSION = "6.9.0";
|
|
37450
38295
|
/**
|
|
37451
38296
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
37452
38297
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|