bruce-cesium 6.8.9 → 6.9.1
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 +2058 -1273
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +2055 -1270
- 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/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 +506 -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/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 +48 -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
|
}
|
|
@@ -14261,6 +14280,9 @@
|
|
|
14261
14280
|
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
14262
14281
|
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
14263
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;
|
|
14264
14286
|
this.somethingIsolatedDateTime = null;
|
|
14265
14287
|
// Entity ID -> rego.
|
|
14266
14288
|
// We retain this information as a quick look-up on what has been registered.
|
|
@@ -14911,9 +14933,12 @@
|
|
|
14911
14933
|
// 5s cache.
|
|
14912
14934
|
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
14913
14935
|
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
14936
|
+
this.somethingIsolatedOpacity = this.visualsManager.GetIsolationOpacity();
|
|
14914
14937
|
this.somethingIsolatedDateTime = new Date();
|
|
14915
14938
|
}
|
|
14916
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.
|
|
14917
14942
|
let hide = false;
|
|
14918
14943
|
if (state) {
|
|
14919
14944
|
if (state.hidden) {
|
|
@@ -14923,7 +14948,12 @@
|
|
|
14923
14948
|
hide = true;
|
|
14924
14949
|
}
|
|
14925
14950
|
else if (!state.isolated && this.somethingIsolated) {
|
|
14926
|
-
|
|
14951
|
+
if (this.somethingIsolatedOpacity != null) {
|
|
14952
|
+
feature.color = Cesium.Color.WHITE.clone().withAlpha(this.somethingIsolatedOpacity);
|
|
14953
|
+
}
|
|
14954
|
+
else {
|
|
14955
|
+
hide = true;
|
|
14956
|
+
}
|
|
14927
14957
|
}
|
|
14928
14958
|
}
|
|
14929
14959
|
feature.show = !hide;
|
|
@@ -28417,342 +28447,179 @@
|
|
|
28417
28447
|
MeasureCreator.Polygon = Polygon;
|
|
28418
28448
|
})(exports.MeasureCreator || (exports.MeasureCreator = {}));
|
|
28419
28449
|
|
|
28420
|
-
|
|
28421
|
-
|
|
28422
|
-
|
|
28423
|
-
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28428
|
-
|
|
28429
|
-
|
|
28430
|
-
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
|
|
28434
|
-
|
|
28435
|
-
const
|
|
28436
|
-
|
|
28437
|
-
|
|
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;
|
|
28438
28472
|
/**
|
|
28439
|
-
*
|
|
28440
|
-
*
|
|
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.
|
|
28441
28476
|
*/
|
|
28442
|
-
|
|
28443
|
-
|
|
28444
|
-
|
|
28445
|
-
|
|
28446
|
-
|
|
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);
|
|
28447
28502
|
}
|
|
28448
|
-
|
|
28449
|
-
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
|
|
28458
|
-
count += 1;
|
|
28459
|
-
}
|
|
28460
|
-
let forward = actions.get(EAction.Forward);
|
|
28461
|
-
if (forward) {
|
|
28462
|
-
totalHeading += heading;
|
|
28463
|
-
count += 1;
|
|
28464
|
-
}
|
|
28465
|
-
if (actions.get(EAction.Backward)) {
|
|
28466
|
-
totalHeading += heading + 180;
|
|
28467
|
-
count += 1;
|
|
28468
|
-
}
|
|
28469
|
-
if (left && forward) {
|
|
28470
|
-
totalHeading = heading - 45;
|
|
28471
|
-
}
|
|
28472
|
-
else {
|
|
28473
|
-
totalHeading /= count;
|
|
28474
|
-
}
|
|
28475
|
-
return totalHeading;
|
|
28476
|
-
}
|
|
28477
|
-
/**
|
|
28478
|
-
* Updates camera position and orientation based on current actions.
|
|
28479
|
-
*/
|
|
28480
|
-
function doMovementTick(viewer) {
|
|
28481
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28482
|
-
if (!data) {
|
|
28483
|
-
return;
|
|
28484
|
-
}
|
|
28485
|
-
const canvas = viewer.canvas;
|
|
28486
|
-
const camera = viewer.camera;
|
|
28487
|
-
const moveRate = data.moveType == exports.Walkthrough.EMoveType.Walk ? data.walkMoveRate : data.flyMoveRate;
|
|
28488
|
-
if (data.actions.get(EAction.Looking)) {
|
|
28489
|
-
let width = canvas.clientWidth;
|
|
28490
|
-
let height = canvas.clientHeight;
|
|
28491
|
-
// Coordinate (0.0, 0.0) will be where the mouse was clicked.
|
|
28492
|
-
let x = (data.mousePosCurrent.x - data.mousePosStart.x) / width;
|
|
28493
|
-
let y = -(data.mousePosCurrent.y - data.mousePosStart.y) / height;
|
|
28494
|
-
let lookFactor = 0.1;
|
|
28495
|
-
camera.lookRight(x * lookFactor);
|
|
28496
|
-
camera.lookUp(y * lookFactor);
|
|
28497
|
-
}
|
|
28498
|
-
let lookStep = 0.03;
|
|
28499
|
-
if (data.actions.get(EAction.LookLeft)) {
|
|
28500
|
-
camera.lookLeft(lookStep);
|
|
28501
|
-
}
|
|
28502
|
-
if (data.actions.get(EAction.LookRight)) {
|
|
28503
|
-
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;
|
|
28504
28513
|
}
|
|
28505
|
-
|
|
28506
|
-
|
|
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;
|
|
28507
28520
|
}
|
|
28508
|
-
|
|
28509
|
-
|
|
28521
|
+
GetHoverDelayMs() {
|
|
28522
|
+
return this._hoverDelayMs;
|
|
28510
28523
|
}
|
|
28511
|
-
|
|
28512
|
-
|
|
28524
|
+
IsSlowScene() {
|
|
28525
|
+
return this._isSlowScene;
|
|
28513
28526
|
}
|
|
28514
|
-
|
|
28515
|
-
|
|
28527
|
+
IsCameraBusy() {
|
|
28528
|
+
return this._isCameraMoving;
|
|
28516
28529
|
}
|
|
28517
|
-
|
|
28518
|
-
|
|
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;
|
|
28519
28543
|
}
|
|
28520
|
-
|
|
28521
|
-
|
|
28544
|
+
RecordRaycast(x, y) {
|
|
28545
|
+
this._lastRaycast = { frame: this._renderFrameCount, x, y };
|
|
28522
28546
|
}
|
|
28523
|
-
|
|
28524
|
-
|
|
28525
|
-
|
|
28526
|
-
|
|
28527
|
-
|
|
28528
|
-
|
|
28529
|
-
camera.moveBackward(moveRate);
|
|
28530
|
-
}
|
|
28531
|
-
if (data.actions.get(EAction.Left)) {
|
|
28532
|
-
camera.moveLeft(moveRate);
|
|
28533
|
-
}
|
|
28534
|
-
if (data.actions.get(EAction.Right)) {
|
|
28535
|
-
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;
|
|
28536
28553
|
}
|
|
28537
28554
|
}
|
|
28538
|
-
|
|
28539
|
-
|
|
28540
|
-
if (
|
|
28541
|
-
|
|
28542
|
-
data.actions.get(EAction.Forward) ||
|
|
28543
|
-
data.actions.get(EAction.Backward)) {
|
|
28544
|
-
const heading = getMovementHeading(viewer);
|
|
28545
|
-
const pos = viewer.camera.positionCartographic;
|
|
28546
|
-
const newPos = _offsetPoint({
|
|
28547
|
-
altitude: pos.height,
|
|
28548
|
-
latitude: Cesium.Math.toDegrees(pos.latitude),
|
|
28549
|
-
longitude: Cesium.Math.toDegrees(pos.longitude)
|
|
28550
|
-
}, moveRate, heading);
|
|
28551
|
-
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);
|
|
28552
28559
|
}
|
|
28553
|
-
|
|
28554
|
-
|
|
28555
|
-
|
|
28556
|
-
|
|
28557
|
-
|
|
28558
|
-
|
|
28559
|
-
|
|
28560
|
-
|
|
28561
|
-
|
|
28562
|
-
|
|
28563
|
-
|
|
28564
|
-
|
|
28565
|
-
|
|
28566
|
-
|
|
28567
|
-
|
|
28568
|
-
|
|
28569
|
-
|
|
28570
|
-
|
|
28571
|
-
|
|
28572
|
-
|
|
28573
|
-
|
|
28574
|
-
|
|
28575
|
-
|
|
28576
|
-
|
|
28577
|
-
|
|
28578
|
-
|
|
28579
|
-
|
|
28580
|
-
|
|
28581
|
-
|
|
28582
|
-
|
|
28583
|
-
|
|
28584
|
-
|
|
28585
|
-
|
|
28586
|
-
|
|
28587
|
-
|
|
28588
|
-
|
|
28589
|
-
|
|
28590
|
-
|
|
28591
|
-
|
|
28592
|
-
|
|
28593
|
-
data.actions.set(EAction.Forward, keyDown);
|
|
28594
|
-
}
|
|
28595
|
-
else if (key == "s") {
|
|
28596
|
-
data.actions.set(EAction.Backward, keyDown);
|
|
28597
|
-
}
|
|
28598
|
-
else if (key == "a") {
|
|
28599
|
-
data.actions.set(EAction.Left, keyDown);
|
|
28600
|
-
}
|
|
28601
|
-
else if (key == "d") {
|
|
28602
|
-
data.actions.set(EAction.Right, keyDown);
|
|
28603
|
-
}
|
|
28604
|
-
else if (key == "q") {
|
|
28605
|
-
data.actions.set(EAction.Up, keyDown);
|
|
28606
|
-
}
|
|
28607
|
-
else if (key == "e") {
|
|
28608
|
-
data.actions.set(EAction.Down, keyDown);
|
|
28609
|
-
}
|
|
28610
|
-
else if (key == "arrowup") {
|
|
28611
|
-
data.actions.set(EAction.LookUp, keyDown);
|
|
28612
|
-
}
|
|
28613
|
-
else if (key == "arrowdown") {
|
|
28614
|
-
data.actions.set(EAction.LookDown, keyDown);
|
|
28615
|
-
}
|
|
28616
|
-
else if (key == "arrowleft") {
|
|
28617
|
-
data.actions.set(EAction.LookLeft, keyDown);
|
|
28618
|
-
}
|
|
28619
|
-
else if (key == "arrowright") {
|
|
28620
|
-
data.actions.set(EAction.LookRight, keyDown);
|
|
28621
|
-
}
|
|
28622
|
-
}
|
|
28623
|
-
(function (Walkthrough) {
|
|
28624
|
-
let EMoveType;
|
|
28625
|
-
(function (EMoveType) {
|
|
28626
|
-
EMoveType["Walk"] = "WALK";
|
|
28627
|
-
EMoveType["Fly"] = "FLY";
|
|
28628
|
-
})(EMoveType = Walkthrough.EMoveType || (Walkthrough.EMoveType = {}));
|
|
28629
|
-
function Start(params) {
|
|
28630
|
-
Stop(params);
|
|
28631
|
-
const viewer = params.viewer;
|
|
28632
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY] = {
|
|
28633
|
-
walkMoveRate: DEFAULT_WALK_MOVE_RATE,
|
|
28634
|
-
flyMoveRate: DEFAULT_FLY_MOVE_RATE,
|
|
28635
|
-
moveType: DEFAULT_MOVE_TYPE,
|
|
28636
|
-
actions: new Map(),
|
|
28637
|
-
...viewer[VIEWER_WALKTHROUGH_DATA_KEY]
|
|
28638
|
-
};
|
|
28639
|
-
data.handlerScreenSpace = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
|
|
28640
|
-
exports.ViewUtils.SetLockedCameraStatus({
|
|
28641
|
-
viewer: viewer,
|
|
28642
|
-
status: true
|
|
28643
|
-
});
|
|
28644
|
-
let lastCheck;
|
|
28645
|
-
let currentTime = new Date();
|
|
28646
|
-
const interval = setInterval(() => {
|
|
28647
|
-
lastCheck = new Date();
|
|
28648
|
-
if (lastCheck.getTime() - currentTime.getTime() >= (1000 / 60)) {
|
|
28649
|
-
doMovementTick(viewer);
|
|
28650
|
-
currentTime = new Date();
|
|
28651
|
-
}
|
|
28652
|
-
}, 1000 / 60);
|
|
28653
|
-
data.tickRemoval = () => {
|
|
28654
|
-
clearInterval(interval);
|
|
28655
|
-
};
|
|
28656
|
-
let keyDown = (e) => {
|
|
28657
|
-
checkKeybind(viewer, e.key, true);
|
|
28658
|
-
};
|
|
28659
|
-
document.addEventListener("keydown", keyDown, false);
|
|
28660
|
-
let keyUp = (e) => {
|
|
28661
|
-
checkKeybind(viewer, e.key, false);
|
|
28662
|
-
};
|
|
28663
|
-
document.addEventListener("keyup", keyUp, false);
|
|
28664
|
-
data.handlerKeysRemoval = () => {
|
|
28665
|
-
document.removeEventListener("keydown", keyDown);
|
|
28666
|
-
document.removeEventListener("keyup", keyUp);
|
|
28667
|
-
};
|
|
28668
|
-
data.handlerScreenSpace.setInputAction((e) => {
|
|
28669
|
-
data.actions.set(EAction.Looking, true);
|
|
28670
|
-
data.mousePosCurrent = data.mousePosStart = Cesium.Cartesian2.clone(e.position);
|
|
28671
|
-
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
|
28672
|
-
data.handlerScreenSpace.setInputAction(((e) => {
|
|
28673
|
-
data.mousePosCurrent = e.endPosition;
|
|
28674
|
-
}), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
28675
|
-
data.handlerScreenSpace.setInputAction(() => {
|
|
28676
|
-
data.actions.set(EAction.Looking, false);
|
|
28677
|
-
}, Cesium.ScreenSpaceEventType.LEFT_UP);
|
|
28678
|
-
}
|
|
28679
|
-
Walkthrough.Start = Start;
|
|
28680
|
-
function Stop(params) {
|
|
28681
|
-
var _a, _b;
|
|
28682
|
-
const viewer = params.viewer;
|
|
28683
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28684
|
-
exports.ViewUtils.SetLockedCameraStatus({
|
|
28685
|
-
viewer: viewer,
|
|
28686
|
-
status: false
|
|
28687
|
-
});
|
|
28688
|
-
if (data) {
|
|
28689
|
-
(_a = data.handlerScreenSpace) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
28690
|
-
data.handlerScreenSpace = null;
|
|
28691
|
-
(_b = data.tickRemoval) === null || _b === void 0 ? void 0 : _b.call(data);
|
|
28692
|
-
data.tickRemoval = null;
|
|
28693
|
-
if (data.handlerKeysRemoval) {
|
|
28694
|
-
data.handlerKeysRemoval();
|
|
28695
|
-
data.handlerKeysRemoval = null;
|
|
28696
|
-
}
|
|
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;
|
|
28697
28600
|
}
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
const viewer = params.viewer;
|
|
28702
|
-
const data = viewer[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28703
|
-
return (data === null || data === void 0 ? void 0 : data.handlerScreenSpace) != null;
|
|
28704
|
-
}
|
|
28705
|
-
Walkthrough.IsRunning = IsRunning;
|
|
28706
|
-
function SetWalkMoveRate(params) {
|
|
28707
|
-
var _a;
|
|
28708
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28709
|
-
if (data) {
|
|
28710
|
-
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;
|
|
28711
28604
|
}
|
|
28712
|
-
|
|
28713
|
-
|
|
28714
|
-
function SetMoveType(params) {
|
|
28715
|
-
var _a;
|
|
28716
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28717
|
-
if (data) {
|
|
28718
|
-
data.moveType = params.type;
|
|
28605
|
+
else if (this._isSlowScene && this._avgFps > SLOW_SCENE_EXIT_FPS) {
|
|
28606
|
+
this._isSlowScene = false;
|
|
28719
28607
|
}
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
}
|
|
28727
|
-
Walkthrough.GetWalkMoveRate = GetWalkMoveRate;
|
|
28728
|
-
function GetFlyMoveRate(params) {
|
|
28729
|
-
var _a;
|
|
28730
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28731
|
-
return data === null || data === void 0 ? void 0 : data.flyMoveRate;
|
|
28732
|
-
}
|
|
28733
|
-
Walkthrough.GetFlyMoveRate = GetFlyMoveRate;
|
|
28734
|
-
function SetFlyMoveRate(params) {
|
|
28735
|
-
var _a;
|
|
28736
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28737
|
-
if (data) {
|
|
28738
|
-
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;
|
|
28739
28614
|
}
|
|
28740
28615
|
}
|
|
28741
|
-
|
|
28742
|
-
function GetMoveType(params) {
|
|
28743
|
-
var _a;
|
|
28744
|
-
const data = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_WALKTHROUGH_DATA_KEY];
|
|
28745
|
-
return data === null || data === void 0 ? void 0 : data.moveType;
|
|
28746
|
-
}
|
|
28747
|
-
Walkthrough.GetMoveType = GetMoveType;
|
|
28748
|
-
})(exports.Walkthrough || (exports.Walkthrough = {}));
|
|
28616
|
+
}
|
|
28749
28617
|
|
|
28750
28618
|
var ECursor;
|
|
28751
28619
|
(function (ECursor) {
|
|
28752
28620
|
ECursor["Select"] = "select";
|
|
28753
28621
|
ECursor["Pan"] = "pan";
|
|
28754
28622
|
ECursor["Measure"] = "measure";
|
|
28755
|
-
ECursor["Walkthrough"] = "walkthrough";
|
|
28756
28623
|
})(ECursor || (ECursor = {}));
|
|
28757
28624
|
var ESecondaryCursor;
|
|
28758
28625
|
(function (ESecondaryCursor) {
|
|
@@ -28762,13 +28629,7 @@
|
|
|
28762
28629
|
ESecondaryCursor["MeasurePoint"] = "measure-point";
|
|
28763
28630
|
ESecondaryCursor["MeasurePolyline"] = "measure-polyline";
|
|
28764
28631
|
ESecondaryCursor["MeasurePolygon"] = "measure-polygon";
|
|
28765
|
-
ESecondaryCursor["WalkthroughPin"] = "walkthrough-pin";
|
|
28766
28632
|
})(ESecondaryCursor || (ESecondaryCursor = {}));
|
|
28767
|
-
const KEY_WALKTHROUGH_MODE = "WidgetCursorBar.Walkthrough.Mode";
|
|
28768
|
-
const KEY_WALKTHROUGH_SPEED_FLY = "WidgetCursorBar.Walkthrough.SpeedFly";
|
|
28769
|
-
const KEY_WALKTHROUGH_SPEED_WALK = "WidgetCursorBar.Walkthrough.SpeedWalk";
|
|
28770
|
-
const KEY_WALKTHROUGH_EXPANDED = "WidgetCursorBar.Walkthrough.Expanded";
|
|
28771
|
-
const VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM = "--viewer-walkthrough-panel-bottom";
|
|
28772
28633
|
class WidgetCursorBar extends exports.Widget.AWidget {
|
|
28773
28634
|
constructor(params) {
|
|
28774
28635
|
super(params);
|
|
@@ -28781,22 +28642,15 @@
|
|
|
28781
28642
|
if (this._selectedCursor == ECursor.Select || this._selectedSecondaryCursor == ESecondaryCursor.Select) {
|
|
28782
28643
|
this._listenSelection();
|
|
28783
28644
|
}
|
|
28784
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
28785
28645
|
}
|
|
28786
28646
|
Dispose() {
|
|
28787
|
-
var _a, _b
|
|
28647
|
+
var _a, _b;
|
|
28788
28648
|
super.Dispose();
|
|
28789
28649
|
this._disposeMeasureTool();
|
|
28790
28650
|
this._disposeCesiumEvent();
|
|
28791
|
-
this._disposeWalkthroughBar();
|
|
28792
28651
|
if ((_b = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.canvas) === null || _b === void 0 ? void 0 : _b.style.cursor) {
|
|
28793
28652
|
this._viewer.canvas.style.removeProperty("cursor");
|
|
28794
28653
|
}
|
|
28795
|
-
if (((_c = this._viewer) === null || _c === void 0 ? void 0 : _c.scene) && !this._viewer.isDestroyed()) {
|
|
28796
|
-
exports.Walkthrough.Stop({
|
|
28797
|
-
viewer: this._viewer
|
|
28798
|
-
});
|
|
28799
|
-
}
|
|
28800
28654
|
}
|
|
28801
28655
|
_generateStyles() {
|
|
28802
28656
|
if (document.getElementById(this.STYLESHEET_ID)) {
|
|
@@ -28819,7 +28673,6 @@
|
|
|
28819
28673
|
box-sizing: border-box;
|
|
28820
28674
|
display: flex;
|
|
28821
28675
|
flex-direction: column;
|
|
28822
|
-
overflow: hidden;
|
|
28823
28676
|
pointer-events: none;
|
|
28824
28677
|
color: black;
|
|
28825
28678
|
}
|
|
@@ -28837,9 +28690,13 @@
|
|
|
28837
28690
|
|
|
28838
28691
|
.NextspaceCursorBarPrimContent {
|
|
28839
28692
|
align-items: center;
|
|
28840
|
-
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);
|
|
28841
28697
|
border-radius: 9px;
|
|
28842
28698
|
display: flex;
|
|
28699
|
+
height: 44px;
|
|
28843
28700
|
pointer-events: auto;
|
|
28844
28701
|
width: -webkit-max-content;
|
|
28845
28702
|
width: max-content;
|
|
@@ -28855,21 +28712,18 @@
|
|
|
28855
28712
|
border-radius: 0;
|
|
28856
28713
|
display: flex;
|
|
28857
28714
|
height: 100%;
|
|
28858
|
-
height: -webkit-max-content;
|
|
28859
|
-
height: max-content;
|
|
28860
28715
|
justify-content: center;
|
|
28861
|
-
padding:
|
|
28862
|
-
padding-left: 8px;
|
|
28716
|
+
padding: 6px 4px;
|
|
28863
28717
|
}
|
|
28864
28718
|
|
|
28865
28719
|
.NextspaceCursorBarPrimControl:first-of-type .NextspaceCursorBarPrimControlInner {
|
|
28866
28720
|
border-radius: 9px 0 0 9px;
|
|
28867
|
-
padding-left:
|
|
28721
|
+
padding-left: 4px;
|
|
28868
28722
|
}
|
|
28869
28723
|
|
|
28870
28724
|
.NextspaceCursorBarPrimControl:last-of-type .NextspaceCursorBarPrimControlInner {
|
|
28871
28725
|
border-radius: 0 9px 9px 0;
|
|
28872
|
-
padding-right:
|
|
28726
|
+
padding-right: 4px;
|
|
28873
28727
|
}
|
|
28874
28728
|
|
|
28875
28729
|
.NextspaceCursorBarPrimControl:first-of-type:last-of-type .NextspaceCursorBarPrimControlInner {
|
|
@@ -28895,6 +28749,7 @@
|
|
|
28895
28749
|
|
|
28896
28750
|
.NextspaceCursorBarPrimControlInner[is-selected="true"] {
|
|
28897
28751
|
background: #33b1ff;
|
|
28752
|
+
box-shadow: inset 0 2px 0 0 #64c4ff;
|
|
28898
28753
|
}
|
|
28899
28754
|
|
|
28900
28755
|
.NextspaceCursorBarSec {
|
|
@@ -28925,8 +28780,7 @@
|
|
|
28925
28780
|
height: -webkit-max-content;
|
|
28926
28781
|
height: max-content;
|
|
28927
28782
|
justify-content: center;
|
|
28928
|
-
padding:
|
|
28929
|
-
padding-left: 8px;
|
|
28783
|
+
padding: 6px;
|
|
28930
28784
|
border: 2px solid transparent;
|
|
28931
28785
|
flex-shrink: 0;
|
|
28932
28786
|
margin: 6px 0 6px 6px;
|
|
@@ -28944,7 +28798,7 @@
|
|
|
28944
28798
|
}
|
|
28945
28799
|
|
|
28946
28800
|
.NextspaceCursorBarSecControl:first-of-type {
|
|
28947
|
-
padding-left:
|
|
28801
|
+
padding-left: 6px;
|
|
28948
28802
|
}
|
|
28949
28803
|
|
|
28950
28804
|
.NextspaceCursorBarSecControlIcon {
|
|
@@ -28965,165 +28819,6 @@
|
|
|
28965
28819
|
transform: scale(1.2);
|
|
28966
28820
|
}
|
|
28967
28821
|
|
|
28968
|
-
.NextspaceWalkthroughBar {
|
|
28969
|
-
position: absolute;
|
|
28970
|
-
z-index: 1;
|
|
28971
|
-
bottom: 10px;
|
|
28972
|
-
left: calc(45px + var(${VIEWER_LEFT_PANEL_CSS_VAR_LEFT}));
|
|
28973
|
-
width: min(1100px, calc(100vw - 205px));
|
|
28974
|
-
box-sizing: border-box;
|
|
28975
|
-
display: flex;
|
|
28976
|
-
flex-direction: column;
|
|
28977
|
-
pointer-events: auto;
|
|
28978
|
-
font-size: 12px;
|
|
28979
|
-
font-family: Arial;
|
|
28980
|
-
transition: 0.3s ease;
|
|
28981
|
-
}
|
|
28982
|
-
|
|
28983
|
-
.NextspaceWalkthroughBar * {
|
|
28984
|
-
box-sizing: border-box;
|
|
28985
|
-
}
|
|
28986
|
-
|
|
28987
|
-
.NextspaceWalkthroughBar[expanded="false"] {
|
|
28988
|
-
width: 395px;
|
|
28989
|
-
}
|
|
28990
|
-
|
|
28991
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarInputs {
|
|
28992
|
-
flex-direction: row;
|
|
28993
|
-
margin-right: 0;
|
|
28994
|
-
}
|
|
28995
|
-
|
|
28996
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarRow {
|
|
28997
|
-
margin-right: 25px;
|
|
28998
|
-
margin-bottom: 0;
|
|
28999
|
-
}
|
|
29000
|
-
|
|
29001
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarRowTip,
|
|
29002
|
-
.NextspaceWalkthroughBar[expanded="false"] .NextspaceWalkthroughBarTips {
|
|
29003
|
-
display: none;
|
|
29004
|
-
}
|
|
29005
|
-
|
|
29006
|
-
.NextspaceWalkthroughBarContent {
|
|
29007
|
-
background-color: white;
|
|
29008
|
-
border-radius: 8px;
|
|
29009
|
-
display: flex;
|
|
29010
|
-
flex-direction: row;
|
|
29011
|
-
padding: 14px 18px;
|
|
29012
|
-
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
29013
|
-
}
|
|
29014
|
-
|
|
29015
|
-
.NextspaceWalkthroughBarTitle {
|
|
29016
|
-
opacity: 0.7;
|
|
29017
|
-
color: white;
|
|
29018
|
-
font-size: 12px;
|
|
29019
|
-
font-family: Arial;
|
|
29020
|
-
font-style: normal;
|
|
29021
|
-
letter-spacing: 0.15em;
|
|
29022
|
-
margin-bottom: 15px;
|
|
29023
|
-
position: absolute;
|
|
29024
|
-
top: -15px;
|
|
29025
|
-
left: 5px;
|
|
29026
|
-
}
|
|
29027
|
-
|
|
29028
|
-
.NextspaceWalkthroughBarInputs {
|
|
29029
|
-
display: flex;
|
|
29030
|
-
flex-direction: column;
|
|
29031
|
-
margin-right: 40px;
|
|
29032
|
-
}
|
|
29033
|
-
|
|
29034
|
-
.NextspaceWalkthroughBarRowTip {
|
|
29035
|
-
color: #000;
|
|
29036
|
-
font-family: Arial;
|
|
29037
|
-
font-size: 12px;
|
|
29038
|
-
font-style: normal;
|
|
29039
|
-
font-weight: 300;
|
|
29040
|
-
letter-spacing: .01em;
|
|
29041
|
-
background: #efefefbf;
|
|
29042
|
-
padding: 8px;
|
|
29043
|
-
gap: 6px;
|
|
29044
|
-
border-radius: 5px;
|
|
29045
|
-
}
|
|
29046
|
-
|
|
29047
|
-
.NextspaceWalkthroughBarRow {
|
|
29048
|
-
align-items: center;
|
|
29049
|
-
display: flex;
|
|
29050
|
-
margin-bottom: 5px;
|
|
29051
|
-
}
|
|
29052
|
-
|
|
29053
|
-
.NextspaceWalkthroughBarInputs .NextspaceWalkthroughBarRow {
|
|
29054
|
-
margin-right: 20px;
|
|
29055
|
-
}
|
|
29056
|
-
|
|
29057
|
-
.NextspaceWalkthroughBarRowLabel {
|
|
29058
|
-
margin-right: 8px;
|
|
29059
|
-
flex-shrink: 0;
|
|
29060
|
-
}
|
|
29061
|
-
|
|
29062
|
-
.NextspaceWalkthroughBarRowValue {
|
|
29063
|
-
flex-grow: 1;
|
|
29064
|
-
max-width: 120px;
|
|
29065
|
-
}
|
|
29066
|
-
|
|
29067
|
-
.NextspaceWalkthroughBarRowValue input {
|
|
29068
|
-
width: 100%;
|
|
29069
|
-
padding: 4px;
|
|
29070
|
-
border: 1px solid #ccc;
|
|
29071
|
-
border-radius: 4px;
|
|
29072
|
-
}
|
|
29073
|
-
|
|
29074
|
-
.NextspaceWalkthroughBarIcon {
|
|
29075
|
-
margin-right: 20px;
|
|
29076
|
-
flex-shrink: 0;
|
|
29077
|
-
}
|
|
29078
|
-
|
|
29079
|
-
.NextspaceWalkthroughButtonClose {
|
|
29080
|
-
position: absolute;
|
|
29081
|
-
top: 6px;
|
|
29082
|
-
right: 8px;
|
|
29083
|
-
z-index: 1;
|
|
29084
|
-
font-size: 25px;
|
|
29085
|
-
color: black;
|
|
29086
|
-
cursor: pointer;
|
|
29087
|
-
transition: 0.3s ease;
|
|
29088
|
-
}
|
|
29089
|
-
|
|
29090
|
-
.NextspaceWalkthroughButtonExpand {
|
|
29091
|
-
position: absolute;
|
|
29092
|
-
top: 6px;
|
|
29093
|
-
right: 40px;
|
|
29094
|
-
z-index: 1;
|
|
29095
|
-
font-size: 25px;
|
|
29096
|
-
color: black;
|
|
29097
|
-
cursor: pointer;
|
|
29098
|
-
transition: 0.3s ease;
|
|
29099
|
-
display: flex;
|
|
29100
|
-
align-items: center;
|
|
29101
|
-
justify-content: center;
|
|
29102
|
-
height: 24px;
|
|
29103
|
-
width: 24px;
|
|
29104
|
-
}
|
|
29105
|
-
|
|
29106
|
-
.NextspaceWalkthroughButtonClose:hover,
|
|
29107
|
-
.NextspaceWalkthroughButtonExpand:hover {
|
|
29108
|
-
transform: scale(1.2);
|
|
29109
|
-
}
|
|
29110
|
-
|
|
29111
|
-
.NextspaceWalkthroughBarTips {
|
|
29112
|
-
flex-grow: 1;
|
|
29113
|
-
flex-shrink: 1;
|
|
29114
|
-
display: flex;
|
|
29115
|
-
color: black;
|
|
29116
|
-
font-size: 12px;
|
|
29117
|
-
font-family: Arial;
|
|
29118
|
-
}
|
|
29119
|
-
|
|
29120
|
-
.NextspaceWalkthroughBarTips >* {
|
|
29121
|
-
margin-right: 24px;
|
|
29122
|
-
}
|
|
29123
|
-
|
|
29124
|
-
.NextspaceWalkthroughBarTips >*:last-child {
|
|
29125
|
-
margin-right: 0;
|
|
29126
|
-
}
|
|
29127
28822
|
`;
|
|
29128
28823
|
document.head.appendChild(style);
|
|
29129
28824
|
}
|
|
@@ -29149,7 +28844,6 @@
|
|
|
29149
28844
|
this._generateSelect();
|
|
29150
28845
|
this._generatePan();
|
|
29151
28846
|
this._generateMeasure();
|
|
29152
|
-
this._generateWalkthrough();
|
|
29153
28847
|
this._updateControls();
|
|
29154
28848
|
this.Container.appendChild(element);
|
|
29155
28849
|
this._element = element;
|
|
@@ -29168,16 +28862,8 @@
|
|
|
29168
28862
|
`;
|
|
29169
28863
|
div.appendChild(inner);
|
|
29170
28864
|
inner.addEventListener("click", () => {
|
|
29171
|
-
var _a;
|
|
29172
28865
|
this._disposeMeasureTool();
|
|
29173
28866
|
this._disposeCesiumEvent();
|
|
29174
|
-
this._disposeWalkthroughBar();
|
|
29175
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29176
|
-
exports.Walkthrough.Stop({
|
|
29177
|
-
viewer: this._viewer
|
|
29178
|
-
});
|
|
29179
|
-
}
|
|
29180
|
-
this._disposeWalkthroughBar();
|
|
29181
28867
|
onClick();
|
|
29182
28868
|
this._updateControls();
|
|
29183
28869
|
});
|
|
@@ -29307,473 +28993,6 @@
|
|
|
29307
28993
|
this._enabledMeasureTool.Start();
|
|
29308
28994
|
}, polygonSvg);
|
|
29309
28995
|
}
|
|
29310
|
-
_generateWalkthrough() {
|
|
29311
|
-
const svg = `
|
|
29312
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29313
|
-
<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"/>
|
|
29314
|
-
</svg>
|
|
29315
|
-
`;
|
|
29316
|
-
this._generateControl("Walkthrough", ECursor.Walkthrough, () => {
|
|
29317
|
-
var _a;
|
|
29318
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29319
|
-
this._selectedCursor = this._selectedCursor == ECursor.Walkthrough ? ECursor.Select : ECursor.Walkthrough;
|
|
29320
|
-
if (this._selectedCursor == ECursor.Walkthrough) {
|
|
29321
|
-
this._generateWalkthroughSecondary();
|
|
29322
|
-
this._updateSecondary();
|
|
29323
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29324
|
-
exports.Walkthrough.Start({
|
|
29325
|
-
viewer: this._viewer
|
|
29326
|
-
});
|
|
29327
|
-
let moveType = localStorage.getItem(KEY_WALKTHROUGH_MODE);
|
|
29328
|
-
if (!moveType) {
|
|
29329
|
-
moveType = exports.Walkthrough.EMoveType.Walk;
|
|
29330
|
-
}
|
|
29331
|
-
exports.Walkthrough.SetMoveType({
|
|
29332
|
-
type: moveType,
|
|
29333
|
-
viewer: this._viewer
|
|
29334
|
-
});
|
|
29335
|
-
let speed = localStorage.getItem(KEY_WALKTHROUGH_SPEED_FLY);
|
|
29336
|
-
if (speed != null && !isNaN(+speed)) {
|
|
29337
|
-
exports.Walkthrough.SetFlyMoveRate({
|
|
29338
|
-
rate: +speed,
|
|
29339
|
-
viewer: this._viewer
|
|
29340
|
-
});
|
|
29341
|
-
}
|
|
29342
|
-
speed = localStorage.getItem(KEY_WALKTHROUGH_SPEED_WALK);
|
|
29343
|
-
if (speed != null && !isNaN(+speed)) {
|
|
29344
|
-
exports.Walkthrough.SetWalkMoveRate({
|
|
29345
|
-
rate: +speed,
|
|
29346
|
-
viewer: this._viewer
|
|
29347
|
-
});
|
|
29348
|
-
}
|
|
29349
|
-
}
|
|
29350
|
-
this._generateWalkthroughBar();
|
|
29351
|
-
}
|
|
29352
|
-
else {
|
|
29353
|
-
this._secondary.style.display = "none";
|
|
29354
|
-
}
|
|
29355
|
-
if (this._selectedCursor == ECursor.Select || this._selectedSecondaryCursor == ESecondaryCursor.Select) {
|
|
29356
|
-
this._listenSelection();
|
|
29357
|
-
}
|
|
29358
|
-
this.OnCursorChange.Trigger(this._selectedCursor);
|
|
29359
|
-
}, svg);
|
|
29360
|
-
}
|
|
29361
|
-
_generateWalkthroughSecondary() {
|
|
29362
|
-
this._secondaryContent.innerHTML = "";
|
|
29363
|
-
this._secondary.style.display = "flex";
|
|
29364
|
-
const selectSvg = `
|
|
29365
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29366
|
-
<path d="M11.0706 25L9 7L23 17.8592L15.3135 18.3375L11.0706 25Z" fill="white" stroke="white" strokeLinejoin="round"/>
|
|
29367
|
-
</svg>
|
|
29368
|
-
`;
|
|
29369
|
-
this._generateSecondaryControl("Select", ESecondaryCursor.Select, () => {
|
|
29370
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29371
|
-
this._walkthroughPinEventRemoval();
|
|
29372
|
-
this._walkthroughPinEventRemoval = null;
|
|
29373
|
-
}
|
|
29374
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29375
|
-
this._listenSelection();
|
|
29376
|
-
}, selectSvg);
|
|
29377
|
-
const panSvg = `
|
|
29378
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29379
|
-
<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"/>
|
|
29380
|
-
</svg>
|
|
29381
|
-
`;
|
|
29382
|
-
this._generateSecondaryControl("Pan", ESecondaryCursor.Pan, () => {
|
|
29383
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29384
|
-
this._walkthroughPinEventRemoval();
|
|
29385
|
-
this._walkthroughPinEventRemoval = null;
|
|
29386
|
-
}
|
|
29387
|
-
if (this._selectedSecondaryCursor == ESecondaryCursor.Pan) {
|
|
29388
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29389
|
-
this._listenSelection();
|
|
29390
|
-
}
|
|
29391
|
-
else {
|
|
29392
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Pan;
|
|
29393
|
-
}
|
|
29394
|
-
this._updateSecondary();
|
|
29395
|
-
}, panSvg);
|
|
29396
|
-
const pinSvg = `
|
|
29397
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29398
|
-
<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"/>
|
|
29399
|
-
</svg>
|
|
29400
|
-
`;
|
|
29401
|
-
this._generateSecondaryControl("Move to point", ESecondaryCursor.WalkthroughPin, () => {
|
|
29402
|
-
if (this._selectedSecondaryCursor == ESecondaryCursor.WalkthroughPin) {
|
|
29403
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29404
|
-
this._listenSelection();
|
|
29405
|
-
}
|
|
29406
|
-
else {
|
|
29407
|
-
this._selectedSecondaryCursor = ESecondaryCursor.WalkthroughPin;
|
|
29408
|
-
this._initWalkthroughPin();
|
|
29409
|
-
}
|
|
29410
|
-
this._updateSecondary();
|
|
29411
|
-
}, pinSvg);
|
|
29412
|
-
}
|
|
29413
|
-
_initWalkthroughPin() {
|
|
29414
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29415
|
-
this._walkthroughPinEventRemoval();
|
|
29416
|
-
this._walkthroughPinEventRemoval = null;
|
|
29417
|
-
}
|
|
29418
|
-
let pointer;
|
|
29419
|
-
let events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
|
|
29420
|
-
this._walkthroughPinEventRemoval = () => {
|
|
29421
|
-
var _a;
|
|
29422
|
-
if (events && !events.isDestroyed()) {
|
|
29423
|
-
events.destroy();
|
|
29424
|
-
events = null;
|
|
29425
|
-
}
|
|
29426
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.scene.isDestroyed()) {
|
|
29427
|
-
if (pointer && this._viewer.entities.contains(pointer)) {
|
|
29428
|
-
this._viewer.entities.remove(pointer);
|
|
29429
|
-
}
|
|
29430
|
-
pointer = null;
|
|
29431
|
-
this._viewer.scene.requestRender();
|
|
29432
|
-
}
|
|
29433
|
-
};
|
|
29434
|
-
let dropPosition3d;
|
|
29435
|
-
let dropOnTerrain = false;
|
|
29436
|
-
events.setInputAction((e) => {
|
|
29437
|
-
const pos2d = e.endPosition;
|
|
29438
|
-
// First try find a position on a 'thing'.
|
|
29439
|
-
// This lets us put our pin underground if there is something there.
|
|
29440
|
-
let pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, pos2d, true, pointer ? [pointer] : null);
|
|
29441
|
-
dropOnTerrain = false;
|
|
29442
|
-
// Fallback to position including terrain as an option.
|
|
29443
|
-
if (!BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29444
|
-
pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, pos2d, false, pointer ? [pointer] : null);
|
|
29445
|
-
dropOnTerrain = true;
|
|
29446
|
-
}
|
|
29447
|
-
if (BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29448
|
-
dropPosition3d = pos3d;
|
|
29449
|
-
}
|
|
29450
|
-
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
29451
|
-
let processing = false;
|
|
29452
|
-
events.setInputAction(async (e) => {
|
|
29453
|
-
if (processing) {
|
|
29454
|
-
return;
|
|
29455
|
-
}
|
|
29456
|
-
processing = true;
|
|
29457
|
-
try {
|
|
29458
|
-
if (!BModels.Cartes.ValidateCartes3(dropPosition3d) && e.position) {
|
|
29459
|
-
// First try find a position on a 'thing'.
|
|
29460
|
-
// This lets us put our pin underground if there is something there.
|
|
29461
|
-
let pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, e.position, true);
|
|
29462
|
-
dropOnTerrain = false;
|
|
29463
|
-
// Fallback to position including terrain as an option.
|
|
29464
|
-
if (!BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29465
|
-
pos3d = exports.DrawingUtils.GetAccuratePosition(this._viewer, e.position, false);
|
|
29466
|
-
dropOnTerrain = true;
|
|
29467
|
-
}
|
|
29468
|
-
dropPosition3d = pos3d;
|
|
29469
|
-
}
|
|
29470
|
-
let pos3d = dropPosition3d === null || dropPosition3d === void 0 ? void 0 : dropPosition3d.clone();
|
|
29471
|
-
if (BModels.Cartes.ValidateCartes3(pos3d)) {
|
|
29472
|
-
const carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
29473
|
-
// If we can raycast to something then we won't adjust above terrain.
|
|
29474
|
-
// Eg: we clicked on an Entity so if it's underground, that's likely intended.
|
|
29475
|
-
if (dropOnTerrain) {
|
|
29476
|
-
const terrainCarto = carto.clone();
|
|
29477
|
-
terrainCarto.height = 0;
|
|
29478
|
-
if (this._viewer.scene.terrainProvider instanceof Cesium.EllipsoidTerrainProvider) ;
|
|
29479
|
-
else {
|
|
29480
|
-
const sample = await Cesium.sampleTerrainMostDetailed(this._viewer.scene.terrainProvider, [terrainCarto]);
|
|
29481
|
-
const terrainHeight = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
29482
|
-
if (terrainHeight != null) {
|
|
29483
|
-
if (carto.height < terrainHeight) {
|
|
29484
|
-
carto.height = terrainHeight;
|
|
29485
|
-
}
|
|
29486
|
-
}
|
|
29487
|
-
}
|
|
29488
|
-
}
|
|
29489
|
-
// Add average human height.
|
|
29490
|
-
carto.height += 1.7;
|
|
29491
|
-
pos3d = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height);
|
|
29492
|
-
this._viewer.camera.flyTo({
|
|
29493
|
-
destination: pos3d,
|
|
29494
|
-
duration: 2,
|
|
29495
|
-
orientation: {
|
|
29496
|
-
heading: this._viewer.camera.heading,
|
|
29497
|
-
pitch: Cesium.Math.toRadians(0),
|
|
29498
|
-
roll: Cesium.Math.toRadians(0)
|
|
29499
|
-
}
|
|
29500
|
-
});
|
|
29501
|
-
// Disable this picking cursor.
|
|
29502
|
-
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
29503
|
-
this._listenSelection();
|
|
29504
|
-
this._updateSecondary();
|
|
29505
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29506
|
-
this._walkthroughPinEventRemoval();
|
|
29507
|
-
this._walkthroughPinEventRemoval = null;
|
|
29508
|
-
}
|
|
29509
|
-
}
|
|
29510
|
-
}
|
|
29511
|
-
catch (e) {
|
|
29512
|
-
console.error(e);
|
|
29513
|
-
}
|
|
29514
|
-
processing = false;
|
|
29515
|
-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
29516
|
-
}
|
|
29517
|
-
/**
|
|
29518
|
-
* Generates the Walkthrough controls bar at the bottom of the screen.
|
|
29519
|
-
* This bar will be collapsable to show minimal information.
|
|
29520
|
-
* A TODO is to break this class into pieces similar the ViewBar.
|
|
29521
|
-
*/
|
|
29522
|
-
_generateWalkthroughBar() {
|
|
29523
|
-
this._disposeWalkthroughBar();
|
|
29524
|
-
const element = document.createElement("div");
|
|
29525
|
-
element.className = "NextspaceWalkthroughBar";
|
|
29526
|
-
this.Container.appendChild(element);
|
|
29527
|
-
const content = document.createElement("div");
|
|
29528
|
-
content.className = "NextspaceWalkthroughBarContent";
|
|
29529
|
-
element.appendChild(content);
|
|
29530
|
-
const inputs = document.createElement("div");
|
|
29531
|
-
inputs.className = "NextspaceWalkthroughBarInputs";
|
|
29532
|
-
inputs.style.marginRight = "40px";
|
|
29533
|
-
const title = document.createElement("div");
|
|
29534
|
-
title.className = "NextspaceWalkthroughBarTitle";
|
|
29535
|
-
title.innerText = "Walkthrough";
|
|
29536
|
-
inputs.appendChild(title);
|
|
29537
|
-
// Expanded by default to show how to use Walkthrough.
|
|
29538
|
-
let expanded = localStorage.getItem(KEY_WALKTHROUGH_EXPANDED) != "false";
|
|
29539
|
-
// Close button.
|
|
29540
|
-
{
|
|
29541
|
-
const svg = `
|
|
29542
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29543
|
-
<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"/>
|
|
29544
|
-
</svg>
|
|
29545
|
-
`;
|
|
29546
|
-
const close = document.createElement("div");
|
|
29547
|
-
close.className = "NextspaceWalkthroughButtonClose";
|
|
29548
|
-
close.innerHTML = svg;
|
|
29549
|
-
close.onclick = () => {
|
|
29550
|
-
var _a;
|
|
29551
|
-
// Toggles off the Walkthrough mode (enables first primary cursor).
|
|
29552
|
-
// TODO: We need a more elegant way to handle this.
|
|
29553
|
-
this._secondary.style.display = "none";
|
|
29554
|
-
this._selectedCursor = ECursor.Select;
|
|
29555
|
-
this._selectedSecondaryCursor = ESecondaryCursor.None;
|
|
29556
|
-
this._updateControls();
|
|
29557
|
-
this._updateSecondary();
|
|
29558
|
-
this._disposeWalkthroughBar();
|
|
29559
|
-
this._listenSelection();
|
|
29560
|
-
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.isDestroyed()) {
|
|
29561
|
-
exports.Walkthrough.Stop({
|
|
29562
|
-
viewer: this._viewer
|
|
29563
|
-
});
|
|
29564
|
-
}
|
|
29565
|
-
this.OnCursorChange.Trigger(this._selectedCursor);
|
|
29566
|
-
};
|
|
29567
|
-
content.appendChild(close);
|
|
29568
|
-
}
|
|
29569
|
-
// Toggle expand button.
|
|
29570
|
-
{
|
|
29571
|
-
const svgExpand = `
|
|
29572
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29573
|
-
<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"/>
|
|
29574
|
-
</svg>
|
|
29575
|
-
`;
|
|
29576
|
-
const svgMinimize = `
|
|
29577
|
-
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29578
|
-
<path d="M15 1L1 0.999999" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
29579
|
-
</svg>
|
|
29580
|
-
`;
|
|
29581
|
-
const heightCollapsed = "70px";
|
|
29582
|
-
const heightExpanded = "150px";
|
|
29583
|
-
const expand = document.createElement("div");
|
|
29584
|
-
expand.className = "NextspaceWalkthroughButtonExpand";
|
|
29585
|
-
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
29586
|
-
expand.onclick = () => {
|
|
29587
|
-
expanded = !expanded;
|
|
29588
|
-
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
29589
|
-
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
29590
|
-
localStorage.setItem(KEY_WALKTHROUGH_EXPANDED, expanded ? "true" : "false");
|
|
29591
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
29592
|
-
};
|
|
29593
|
-
content.appendChild(expand);
|
|
29594
|
-
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
29595
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
29596
|
-
}
|
|
29597
|
-
content.appendChild(inputs);
|
|
29598
|
-
const tips = document.createElement("div");
|
|
29599
|
-
tips.className = "NextspaceWalkthroughBarTips";
|
|
29600
|
-
{
|
|
29601
|
-
const wasd = document.createElement("div");
|
|
29602
|
-
wasd.setAttribute("style", `
|
|
29603
|
-
display: flex;
|
|
29604
|
-
flex-direction: column;
|
|
29605
|
-
justify-content: flex-end;
|
|
29606
|
-
`);
|
|
29607
|
-
const wasdSvg = `
|
|
29608
|
-
<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>
|
|
29609
|
-
`;
|
|
29610
|
-
wasd.innerHTML = wasdSvg;
|
|
29611
|
-
wasd.innerHTML += `
|
|
29612
|
-
<div style="margin-top: 5px;">
|
|
29613
|
-
Click W,A,S,D on your keyboard to move your camera.
|
|
29614
|
-
</div>
|
|
29615
|
-
`;
|
|
29616
|
-
tips.appendChild(wasd);
|
|
29617
|
-
const arrows = document.createElement("div");
|
|
29618
|
-
arrows.setAttribute("style", `
|
|
29619
|
-
display: flex;
|
|
29620
|
-
flex-direction: column;
|
|
29621
|
-
justify-content: flex-end;
|
|
29622
|
-
`);
|
|
29623
|
-
const arrowsSvg = `
|
|
29624
|
-
<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>
|
|
29625
|
-
`;
|
|
29626
|
-
arrows.innerHTML = arrowsSvg;
|
|
29627
|
-
arrows.innerHTML += `
|
|
29628
|
-
<div style="margin-top: 5px;">
|
|
29629
|
-
Click the arrow keys to pan.
|
|
29630
|
-
</div>
|
|
29631
|
-
`;
|
|
29632
|
-
tips.appendChild(arrows);
|
|
29633
|
-
const upDown = document.createElement("div");
|
|
29634
|
-
upDown.setAttribute("style", `
|
|
29635
|
-
display: flex;
|
|
29636
|
-
flex-direction: column;
|
|
29637
|
-
justify-content: flex-end;
|
|
29638
|
-
`);
|
|
29639
|
-
const upDownSvg = `
|
|
29640
|
-
<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>
|
|
29641
|
-
`;
|
|
29642
|
-
upDown.innerHTML = upDownSvg;
|
|
29643
|
-
upDown.innerHTML += `
|
|
29644
|
-
<div style="margin-top: 5px;">
|
|
29645
|
-
Click Q and E to move up and down.
|
|
29646
|
-
</div>
|
|
29647
|
-
`;
|
|
29648
|
-
tips.appendChild(upDown);
|
|
29649
|
-
}
|
|
29650
|
-
content.appendChild(tips);
|
|
29651
|
-
// Reference to our speed slider so we can adjust it when the move type changes.
|
|
29652
|
-
let moveRateInput = null;
|
|
29653
|
-
// Fly toggle row.
|
|
29654
|
-
{
|
|
29655
|
-
const row = document.createElement("div");
|
|
29656
|
-
row.className = "NextspaceWalkthroughBarRow";
|
|
29657
|
-
inputs.appendChild(row);
|
|
29658
|
-
const label = document.createElement("div");
|
|
29659
|
-
label.className = "NextspaceWalkthroughBarRowLabel";
|
|
29660
|
-
label.innerText = "Fly";
|
|
29661
|
-
row.appendChild(label);
|
|
29662
|
-
const toggle = document.createElement("input");
|
|
29663
|
-
toggle.className = "NextspaceWalkthroughBarRowToggle";
|
|
29664
|
-
toggle.type = "checkbox";
|
|
29665
|
-
row.appendChild(toggle);
|
|
29666
|
-
toggle.checked = exports.Walkthrough.GetMoveType({
|
|
29667
|
-
viewer: this._viewer
|
|
29668
|
-
}) == exports.Walkthrough.EMoveType.Fly;
|
|
29669
|
-
toggle.addEventListener("change", () => {
|
|
29670
|
-
const newType = toggle.checked ? exports.Walkthrough.EMoveType.Fly : exports.Walkthrough.EMoveType.Walk;
|
|
29671
|
-
exports.Walkthrough.SetMoveType({
|
|
29672
|
-
viewer: this._viewer,
|
|
29673
|
-
type: newType
|
|
29674
|
-
});
|
|
29675
|
-
// Update the speed slider to match the new move type.
|
|
29676
|
-
if (moveRateInput) {
|
|
29677
|
-
if (newType == exports.Walkthrough.EMoveType.Fly) {
|
|
29678
|
-
const rate = exports.Walkthrough.GetFlyMoveRate({
|
|
29679
|
-
viewer: this._viewer
|
|
29680
|
-
});
|
|
29681
|
-
moveRateInput.value = (rate * 50).toFixed(2);
|
|
29682
|
-
}
|
|
29683
|
-
else {
|
|
29684
|
-
const rate = exports.Walkthrough.GetWalkMoveRate({
|
|
29685
|
-
viewer: this._viewer
|
|
29686
|
-
});
|
|
29687
|
-
moveRateInput.value = (rate * 500).toFixed(2);
|
|
29688
|
-
}
|
|
29689
|
-
}
|
|
29690
|
-
localStorage.setItem(KEY_WALKTHROUGH_MODE, newType);
|
|
29691
|
-
});
|
|
29692
|
-
// Tip for the row.
|
|
29693
|
-
// Will be hidden while collapsed through css.
|
|
29694
|
-
{
|
|
29695
|
-
const tip = document.createElement("div");
|
|
29696
|
-
tip.style.marginBottom = "10px";
|
|
29697
|
-
tip.className = "NextspaceWalkthroughBarRowTip";
|
|
29698
|
-
tip.innerText = "Flying means the camera will not maintain its height.";
|
|
29699
|
-
inputs.appendChild(tip);
|
|
29700
|
-
}
|
|
29701
|
-
}
|
|
29702
|
-
// Speed slider row.
|
|
29703
|
-
{
|
|
29704
|
-
const row = document.createElement("div");
|
|
29705
|
-
row.className = "NextspaceWalkthroughBarRow";
|
|
29706
|
-
inputs.appendChild(row);
|
|
29707
|
-
const label = document.createElement("div");
|
|
29708
|
-
label.className = "NextspaceWalkthroughBarRowLabel";
|
|
29709
|
-
label.innerText = "Speed";
|
|
29710
|
-
row.appendChild(label);
|
|
29711
|
-
const slider = document.createElement("input");
|
|
29712
|
-
moveRateInput = slider;
|
|
29713
|
-
slider.className = "NextspaceWalkthroughBarRowSlider";
|
|
29714
|
-
slider.type = "range";
|
|
29715
|
-
slider.min = "0.01";
|
|
29716
|
-
slider.max = "100";
|
|
29717
|
-
slider.step = "0.01";
|
|
29718
|
-
slider.value = "50";
|
|
29719
|
-
slider.addEventListener("input", () => {
|
|
29720
|
-
// Walk is between 0.01 and 0.5
|
|
29721
|
-
// Fly is between 0.01 and 10
|
|
29722
|
-
// We want to convert this slider's range into the respective values and apply based on active move type.
|
|
29723
|
-
const type = exports.Walkthrough.GetMoveType({
|
|
29724
|
-
viewer: this._viewer
|
|
29725
|
-
});
|
|
29726
|
-
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
29727
|
-
const value = parseFloat(slider.value);
|
|
29728
|
-
const speed = value / 50;
|
|
29729
|
-
exports.Walkthrough.SetFlyMoveRate({
|
|
29730
|
-
viewer: this._viewer,
|
|
29731
|
-
rate: speed
|
|
29732
|
-
});
|
|
29733
|
-
localStorage.setItem(KEY_WALKTHROUGH_SPEED_FLY, speed.toString());
|
|
29734
|
-
}
|
|
29735
|
-
else {
|
|
29736
|
-
const value = parseFloat(slider.value);
|
|
29737
|
-
const speed = value / 500;
|
|
29738
|
-
exports.Walkthrough.SetWalkMoveRate({
|
|
29739
|
-
viewer: this._viewer,
|
|
29740
|
-
rate: speed
|
|
29741
|
-
});
|
|
29742
|
-
localStorage.setItem(KEY_WALKTHROUGH_SPEED_WALK, speed.toString());
|
|
29743
|
-
}
|
|
29744
|
-
});
|
|
29745
|
-
// Set the initial value based on the move type.
|
|
29746
|
-
const type = exports.Walkthrough.GetMoveType({
|
|
29747
|
-
viewer: this._viewer
|
|
29748
|
-
});
|
|
29749
|
-
if (type == exports.Walkthrough.EMoveType.Fly) {
|
|
29750
|
-
const rate = exports.Walkthrough.GetFlyMoveRate({
|
|
29751
|
-
viewer: this._viewer
|
|
29752
|
-
});
|
|
29753
|
-
slider.value = (rate * 50).toFixed(2);
|
|
29754
|
-
}
|
|
29755
|
-
else {
|
|
29756
|
-
const rate = exports.Walkthrough.GetWalkMoveRate({
|
|
29757
|
-
viewer: this._viewer
|
|
29758
|
-
});
|
|
29759
|
-
slider.value = (rate * 500).toFixed(2);
|
|
29760
|
-
}
|
|
29761
|
-
row.appendChild(slider);
|
|
29762
|
-
}
|
|
29763
|
-
this._walkthroughBar = element;
|
|
29764
|
-
}
|
|
29765
|
-
_disposeWalkthroughBar() {
|
|
29766
|
-
var _a;
|
|
29767
|
-
if (this._walkthroughPinEventRemoval) {
|
|
29768
|
-
this._walkthroughPinEventRemoval();
|
|
29769
|
-
this._walkthroughPinEventRemoval = null;
|
|
29770
|
-
}
|
|
29771
|
-
if ((_a = this._walkthroughBar) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
29772
|
-
this._walkthroughBar.parentElement.removeChild(this._walkthroughBar);
|
|
29773
|
-
this._walkthroughBar = null;
|
|
29774
|
-
}
|
|
29775
|
-
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
29776
|
-
}
|
|
29777
28996
|
_updateControls() {
|
|
29778
28997
|
const controls = this._primaryContent.querySelectorAll(".NextspaceCursorBarPrimControlInner");
|
|
29779
28998
|
controls.forEach((control) => {
|
|
@@ -29809,9 +29028,9 @@
|
|
|
29809
29028
|
_listenSelection() {
|
|
29810
29029
|
this._disposeCesiumEvent();
|
|
29811
29030
|
const events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
|
|
29031
|
+
const throttle = new CursorBarMouseEventThrottle(this._viewer);
|
|
29812
29032
|
let lastHoverPos = null;
|
|
29813
|
-
|
|
29814
|
-
//let unhighlightTimeout: any = null;
|
|
29033
|
+
let cursorSettleTimeout = null;
|
|
29815
29034
|
const process2dCursor = (pos2d, isHover) => {
|
|
29816
29035
|
try {
|
|
29817
29036
|
const { regos } = this._manager.VisualsRegister.GetRegosFromCursor({
|
|
@@ -29826,34 +29045,6 @@
|
|
|
29826
29045
|
else if (this._viewer.canvas.style.cursor) {
|
|
29827
29046
|
this._viewer.canvas.style.removeProperty("cursor");
|
|
29828
29047
|
}
|
|
29829
|
-
/*
|
|
29830
|
-
clearTimeout(unhighlightTimeout);
|
|
29831
|
-
if (lastHoveredEntityId && lastHoveredEntityId != firstId) {
|
|
29832
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29833
|
-
entityIds: [lastHoveredEntityId],
|
|
29834
|
-
highlighted: false
|
|
29835
|
-
});
|
|
29836
|
-
}
|
|
29837
|
-
if (firstId) {
|
|
29838
|
-
unhighlightTimeout = setTimeout(() => {
|
|
29839
|
-
if (lastHoveredEntityId == firstId) {
|
|
29840
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29841
|
-
entityIds: [firstId],
|
|
29842
|
-
highlighted: false
|
|
29843
|
-
});
|
|
29844
|
-
lastHoveredEntityId = null;
|
|
29845
|
-
}
|
|
29846
|
-
}, 5000);
|
|
29847
|
-
if (lastHoveredEntityId != firstId) {
|
|
29848
|
-
this._manager.VisualsRegister.SetHighlighted({
|
|
29849
|
-
entityIds: [firstId],
|
|
29850
|
-
highlighted: true
|
|
29851
|
-
});
|
|
29852
|
-
}
|
|
29853
|
-
}
|
|
29854
|
-
|
|
29855
|
-
lastHoveredEntityId = firstId;
|
|
29856
|
-
*/
|
|
29857
29048
|
}
|
|
29858
29049
|
else {
|
|
29859
29050
|
this._manager.VisualsRegister.ClearSelected();
|
|
@@ -29870,8 +29061,27 @@
|
|
|
29870
29061
|
}
|
|
29871
29062
|
};
|
|
29872
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);
|
|
29873
29076
|
process2dCursor(lastHoverPos, true);
|
|
29874
|
-
},
|
|
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
|
+
});
|
|
29875
29085
|
events.setInputAction((e) => {
|
|
29876
29086
|
var _a;
|
|
29877
29087
|
if (!((_a = e === null || e === void 0 ? void 0 : e.position) === null || _a === void 0 ? void 0 : _a.x)) {
|
|
@@ -29885,10 +29095,25 @@
|
|
|
29885
29095
|
return;
|
|
29886
29096
|
}
|
|
29887
29097
|
lastHoverPos = e.endPosition;
|
|
29888
|
-
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
|
+
}
|
|
29889
29110
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
29890
29111
|
this._cesiumEventRemoval = () => {
|
|
29112
|
+
if (cursorSettleTimeout) {
|
|
29113
|
+
clearTimeout(cursorSettleTimeout);
|
|
29114
|
+
}
|
|
29891
29115
|
hoverDelayQueue.Dispose();
|
|
29116
|
+
throttle.Dispose();
|
|
29892
29117
|
if (!events || events.isDestroyed()) {
|
|
29893
29118
|
return;
|
|
29894
29119
|
}
|
|
@@ -30817,20 +30042,1352 @@
|
|
|
30817
30042
|
}
|
|
30818
30043
|
}
|
|
30819
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
|
+
|
|
30820
31333
|
class WidgetNavCompass$$1 extends exports.Widget.AWidget {
|
|
30821
31334
|
constructor(params) {
|
|
30822
31335
|
super(params);
|
|
30823
|
-
this.ZOOM_DISTANCE = 0.85;
|
|
30824
|
-
this.ZOOM_TIME = 0.2;
|
|
30825
|
-
this.TURN_SPEED = 0.04;
|
|
30826
|
-
this.MIN_ZOOM_DISTANCE = 0.3;
|
|
30827
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;
|
|
31351
|
+
// Fires whenever walkthrough mode is toggled on/off via this widget's own button.
|
|
31352
|
+
this.OnWalkthroughChange = new BModels.BruceEvent();
|
|
30828
31353
|
this._generateStyles();
|
|
30829
31354
|
this._generateElement();
|
|
30830
31355
|
this._listenToRenders();
|
|
31356
|
+
this._listenGlobalRelease();
|
|
31357
|
+
}
|
|
31358
|
+
_getSelectedIds() {
|
|
31359
|
+
var _a, _b;
|
|
31360
|
+
return ((_b = (_a = this._manager) === null || _a === void 0 ? void 0 : _a.VisualsRegister) === null || _b === void 0 ? void 0 : _b.GetSelected()) || [];
|
|
30831
31361
|
}
|
|
30832
|
-
|
|
30833
|
-
|
|
31362
|
+
_getStablePivot() {
|
|
31363
|
+
const camera = this._viewer.camera;
|
|
31364
|
+
// Re-validate a cached pivot too, since it may have been established from a bad raycast.
|
|
31365
|
+
if (this._stablePivot && IsPivotPlausible(this._viewer, this._stablePivot)) {
|
|
31366
|
+
const distance = Cesium.Cartesian3.distance(camera.position, this._stablePivot);
|
|
31367
|
+
if (distance <= this.PIVOT_DISTANCE_TOLERANCE_METERS) {
|
|
31368
|
+
return this._stablePivot;
|
|
31369
|
+
}
|
|
31370
|
+
}
|
|
31371
|
+
const c = this._viewer.canvas;
|
|
31372
|
+
const center = new Cesium.Cartesian2(c.width / 2, c.height / 2);
|
|
31373
|
+
const ground = exports.DrawingUtils.GetAccuratePosition(this._viewer, center);
|
|
31374
|
+
if ((ground === null || ground === void 0 ? void 0 : ground.x) && IsPivotPlausible(this._viewer, ground)) {
|
|
31375
|
+
this._stablePivot = ground.clone();
|
|
31376
|
+
return this._stablePivot;
|
|
31377
|
+
}
|
|
31378
|
+
this._stablePivot = null;
|
|
31379
|
+
return null;
|
|
31380
|
+
}
|
|
31381
|
+
_updateStablePivot(pivot) {
|
|
31382
|
+
if (pivot && IsPivotPlausible(this._viewer, pivot)) {
|
|
31383
|
+
this._stablePivot = pivot.clone ? pivot.clone() : pivot;
|
|
31384
|
+
}
|
|
31385
|
+
}
|
|
31386
|
+
_listenGlobalRelease() {
|
|
31387
|
+
this._globalMouseUp = () => this._handlePointerUp();
|
|
31388
|
+
this._globalTouchEnd = () => this._handlePointerUp();
|
|
31389
|
+
window.addEventListener("mouseup", this._globalMouseUp);
|
|
31390
|
+
window.addEventListener("touchend", this._globalTouchEnd);
|
|
30834
31391
|
}
|
|
30835
31392
|
_listenToRenders() {
|
|
30836
31393
|
if (this._renderRemoval) {
|
|
@@ -30842,10 +31399,30 @@
|
|
|
30842
31399
|
});
|
|
30843
31400
|
}
|
|
30844
31401
|
Dispose() {
|
|
31402
|
+
var _a, _b, _c;
|
|
30845
31403
|
if (this._renderRemoval) {
|
|
30846
31404
|
this._renderRemoval();
|
|
30847
31405
|
this._renderRemoval = null;
|
|
30848
31406
|
}
|
|
31407
|
+
if (this._globalMouseUp) {
|
|
31408
|
+
window.removeEventListener("mouseup", this._globalMouseUp);
|
|
31409
|
+
}
|
|
31410
|
+
if (this._globalTouchEnd) {
|
|
31411
|
+
window.removeEventListener("touchend", this._globalTouchEnd);
|
|
31412
|
+
}
|
|
31413
|
+
if (this._fullscreenChange) {
|
|
31414
|
+
document.removeEventListener("fullscreenchange", this._fullscreenChange);
|
|
31415
|
+
document.removeEventListener("webkitfullscreenchange", this._fullscreenChange);
|
|
31416
|
+
}
|
|
31417
|
+
if (this._loaderTimer) {
|
|
31418
|
+
window.clearTimeout(this._loaderTimer);
|
|
31419
|
+
}
|
|
31420
|
+
if (this._holdTimer) {
|
|
31421
|
+
window.clearTimeout(this._holdTimer);
|
|
31422
|
+
}
|
|
31423
|
+
(_a = this._stopContinuous) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
31424
|
+
(_b = this._holdLoader) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
31425
|
+
(_c = this._walkthroughBar) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
30849
31426
|
super.Dispose();
|
|
30850
31427
|
}
|
|
30851
31428
|
_generateStyles() {
|
|
@@ -30859,15 +31436,14 @@
|
|
|
30859
31436
|
display: flex;
|
|
30860
31437
|
flex-direction: column;
|
|
30861
31438
|
align-items: center;
|
|
30862
|
-
width:
|
|
30863
|
-
min-height:
|
|
31439
|
+
width: 65px;
|
|
31440
|
+
min-height: 100px;
|
|
30864
31441
|
background: rgba(33, 39, 42, 0.75);
|
|
30865
|
-
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.18), 0px
|
|
31442
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.18), 0px 12px 22px -2px rgba(18, 22, 25, 0.26);
|
|
30866
31443
|
backdrop-filter: blur(20px);
|
|
30867
|
-
border-radius: 102px 102px
|
|
31444
|
+
border-radius: 102px 102px 30px 30px;
|
|
30868
31445
|
overflow: hidden;
|
|
30869
|
-
padding-top:
|
|
30870
|
-
padding-bottom: 5px;
|
|
31446
|
+
padding-top: 60px;
|
|
30871
31447
|
position: absolute;
|
|
30872
31448
|
bottom: 10px;
|
|
30873
31449
|
right: 10px;
|
|
@@ -30880,27 +31456,27 @@
|
|
|
30880
31456
|
|
|
30881
31457
|
.NextspaceNavCompassTop {
|
|
30882
31458
|
position: absolute;
|
|
30883
|
-
height:
|
|
30884
|
-
width:
|
|
30885
|
-
top:
|
|
31459
|
+
height: 65px;
|
|
31460
|
+
width: 100%;
|
|
31461
|
+
top: 0;
|
|
30886
31462
|
border-radius: 50%;
|
|
30887
|
-
border: 1px solid #4D5358;
|
|
30888
31463
|
display: flex;
|
|
30889
31464
|
justify-content: center;
|
|
30890
31465
|
align-items: center;
|
|
30891
31466
|
}
|
|
30892
31467
|
|
|
30893
31468
|
.NextspaceNavCompassAxis {
|
|
30894
|
-
background: #
|
|
30895
|
-
border: 1px solid
|
|
30896
|
-
width:
|
|
30897
|
-
height:
|
|
31469
|
+
background: #121619;
|
|
31470
|
+
border: 1px solid #ffffff1f;
|
|
31471
|
+
width: 50px;
|
|
31472
|
+
height: 50px;
|
|
30898
31473
|
border-radius: 50%;
|
|
30899
31474
|
position: relative;
|
|
30900
31475
|
display: flex;
|
|
30901
31476
|
align-items: center;
|
|
30902
31477
|
justify-content: center;
|
|
30903
31478
|
cursor: pointer;
|
|
31479
|
+
z-index: 2;
|
|
30904
31480
|
}
|
|
30905
31481
|
|
|
30906
31482
|
.NextspaceNavCompassAxis >svg {
|
|
@@ -30911,6 +31487,7 @@
|
|
|
30911
31487
|
|
|
30912
31488
|
.NextspaceNavCompassArrow {
|
|
30913
31489
|
margin-bottom: 6px;
|
|
31490
|
+
z-index: 1;
|
|
30914
31491
|
}
|
|
30915
31492
|
|
|
30916
31493
|
.NextspaceNavCompassAxis:hover .NextspaceNavCompassArrow {
|
|
@@ -30921,6 +31498,8 @@
|
|
|
30921
31498
|
.NextspaceNavCompassRow {
|
|
30922
31499
|
display: flex;
|
|
30923
31500
|
align-items: center;
|
|
31501
|
+
padding-top: 4px;
|
|
31502
|
+
padding-bottom: 4px;
|
|
30924
31503
|
}
|
|
30925
31504
|
|
|
30926
31505
|
.NextspaceNavCompassCol {
|
|
@@ -30929,8 +31508,8 @@
|
|
|
30929
31508
|
}
|
|
30930
31509
|
|
|
30931
31510
|
.NextspaceNavCompassButt {
|
|
30932
|
-
width:
|
|
30933
|
-
height:
|
|
31511
|
+
width: 28px;
|
|
31512
|
+
height: 28px;
|
|
30934
31513
|
flex-shrink: 1;
|
|
30935
31514
|
flex-grow: 0;
|
|
30936
31515
|
display: flex;
|
|
@@ -30940,24 +31519,56 @@
|
|
|
30940
31519
|
transition: 0.3s ease;
|
|
30941
31520
|
}
|
|
30942
31521
|
|
|
31522
|
+
.NextspaceNavCompassButt:hover {
|
|
31523
|
+
transform: translateY(-2px);
|
|
31524
|
+
}
|
|
31525
|
+
|
|
30943
31526
|
.NextspaceNavCompassButt[is-disabled="true"] {
|
|
30944
31527
|
opacity: 0.4;
|
|
30945
31528
|
cursor: default;
|
|
30946
31529
|
pointer-events: none;
|
|
30947
31530
|
}
|
|
30948
31531
|
|
|
30949
|
-
.
|
|
30950
|
-
|
|
31532
|
+
.NextspaceNavCompassLookButt {
|
|
31533
|
+
position: absolute;
|
|
31534
|
+
z-index: 3;
|
|
31535
|
+
margin-top: -6px;
|
|
31536
|
+
opacity: 0.7;
|
|
30951
31537
|
}
|
|
30952
31538
|
|
|
30953
|
-
.
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
30957
|
-
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
31539
|
+
.NextspaceNavCompassLookButt:hover {
|
|
31540
|
+
opacity: 1;
|
|
31541
|
+
}
|
|
31542
|
+
|
|
31543
|
+
.NextspaceNavCompassLookButt.look-up {
|
|
31544
|
+
top: 0;
|
|
31545
|
+
}
|
|
31546
|
+
|
|
31547
|
+
.NextspaceNavCompassLookButt.look-down {
|
|
31548
|
+
bottom: -6px;
|
|
31549
|
+
}
|
|
31550
|
+
|
|
31551
|
+
.NextspaceNavCompassRotateButt {
|
|
31552
|
+
position: absolute;
|
|
31553
|
+
z-index: 3;
|
|
31554
|
+
margin-top: 14px;
|
|
31555
|
+
width: 32px;
|
|
31556
|
+
height: 28px;
|
|
31557
|
+
transform: scale(0.8);
|
|
31558
|
+
opacity: 0.7;
|
|
31559
|
+
}
|
|
31560
|
+
|
|
31561
|
+
.NextspaceNavCompassRotateButt:hover {
|
|
31562
|
+
transform: scale(0.85) translateY(-2px);
|
|
31563
|
+
opacity: 1;
|
|
31564
|
+
}
|
|
31565
|
+
|
|
31566
|
+
.NextspaceNavCompassRotateButt.rotate-left {
|
|
31567
|
+
left: -6px;
|
|
31568
|
+
}
|
|
31569
|
+
|
|
31570
|
+
.NextspaceNavCompassRotateButt.rotate-right {
|
|
31571
|
+
right: -6px;
|
|
30961
31572
|
}
|
|
30962
31573
|
|
|
30963
31574
|
.NextspaceNavCompassVerDash {
|
|
@@ -30974,13 +31585,22 @@
|
|
|
30974
31585
|
|
|
30975
31586
|
.NextspaceNavCompassDimToggle {
|
|
30976
31587
|
background: #121619;
|
|
30977
|
-
|
|
30978
|
-
|
|
31588
|
+
width: 100%;
|
|
31589
|
+
margin-left: auto;
|
|
31590
|
+
margin-right: auto;
|
|
30979
31591
|
height: 24px;
|
|
30980
31592
|
flex-grow: 0;
|
|
30981
31593
|
flex-shrink: 1;
|
|
30982
|
-
padding: 2px;
|
|
31594
|
+
padding: 2px 0;
|
|
30983
31595
|
display: flex;
|
|
31596
|
+
align-items: center;
|
|
31597
|
+
justify-content: center;
|
|
31598
|
+
color: white;
|
|
31599
|
+
transition: 0.3s ease;
|
|
31600
|
+
font-size: 12px;
|
|
31601
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
31602
|
+
border: 1px solid #ffffff1f;
|
|
31603
|
+
border-radius: 0 0 9px 9px;
|
|
30984
31604
|
}
|
|
30985
31605
|
|
|
30986
31606
|
.NextspaceNavCompassDimToggleButt {
|
|
@@ -30991,12 +31611,21 @@
|
|
|
30991
31611
|
flex-grow: 1;
|
|
30992
31612
|
flex-shrink: 1;
|
|
30993
31613
|
width: 100%;
|
|
31614
|
+
height: 100%;
|
|
30994
31615
|
transition: 0.3s ease;
|
|
30995
31616
|
cursor: pointer;
|
|
30996
31617
|
opacity: 0.4;
|
|
30997
31618
|
color: white;
|
|
30998
|
-
|
|
30999
|
-
|
|
31619
|
+
}
|
|
31620
|
+
|
|
31621
|
+
.NextspaceNavCompassDimToggleButt:first-child {
|
|
31622
|
+
margin-left: 2px;
|
|
31623
|
+
border-radius: 2px 2px 1px 6px;
|
|
31624
|
+
}
|
|
31625
|
+
|
|
31626
|
+
.NextspaceNavCompassDimToggleButt:last-child {
|
|
31627
|
+
margin-right: 2px;
|
|
31628
|
+
border-radius: 2px 2px 6px 1px;
|
|
31000
31629
|
}
|
|
31001
31630
|
|
|
31002
31631
|
.NextspaceNavCompassDimToggleButt[is-selected="true"] {
|
|
@@ -31004,6 +31633,12 @@
|
|
|
31004
31633
|
background-color: #4D5358;
|
|
31005
31634
|
box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.12);
|
|
31006
31635
|
}
|
|
31636
|
+
|
|
31637
|
+
.NextspaceNavCompassDimToggle[is-disabled="true"] {
|
|
31638
|
+
opacity: 0.7;
|
|
31639
|
+
cursor: default;
|
|
31640
|
+
pointer-events: none;
|
|
31641
|
+
}
|
|
31007
31642
|
`;
|
|
31008
31643
|
document.head.appendChild(style);
|
|
31009
31644
|
}
|
|
@@ -31013,34 +31648,24 @@
|
|
|
31013
31648
|
const top = document.createElement("div");
|
|
31014
31649
|
top.className = "NextspaceNavCompassTop";
|
|
31015
31650
|
element.appendChild(top);
|
|
31651
|
+
this._generateLookButtons(top);
|
|
31652
|
+
this._generateRotateButtons(top);
|
|
31653
|
+
this._generateAxis(top);
|
|
31654
|
+
this._generateZoomRow(element);
|
|
31655
|
+
this._generateExtraTools(element);
|
|
31656
|
+
this._generateDimensionToggle(element);
|
|
31657
|
+
this.Container.appendChild(element);
|
|
31658
|
+
this._element = element;
|
|
31659
|
+
this._update2d3d();
|
|
31660
|
+
}
|
|
31661
|
+
_generateAxis(top) {
|
|
31016
31662
|
const axis = document.createElement("div");
|
|
31017
31663
|
axis.className = "NextspaceNavCompassAxis";
|
|
31018
31664
|
axis.setAttribute("title", "Click to reset north");
|
|
31019
31665
|
top.appendChild(axis);
|
|
31020
|
-
axis.addEventListener("click", () =>
|
|
31021
|
-
this._clickResetNorth();
|
|
31022
|
-
});
|
|
31666
|
+
axis.addEventListener("click", () => this._clickResetNorth());
|
|
31023
31667
|
axis.innerHTML = `
|
|
31024
|
-
<svg width="
|
|
31025
|
-
<rect x="46" width="2" height="8" rx="1" fill="#FF3D00"/>
|
|
31026
|
-
<rect x="46" y="86" width="2" height="8" rx="1" fill="#4D5254"/>
|
|
31027
|
-
<rect x="94" y="46" width="2" height="8" rx="1" transform="rotate(90 94 46)" fill="#4D5254"/>
|
|
31028
|
-
<rect x="8" y="46" width="2" height="8" rx="1" transform="rotate(90 8 46)" fill="#4D5254"/>
|
|
31029
|
-
<rect x="79.5269" y="13.0589" width="2" height="8" rx="1" transform="rotate(45 79.5269 13.0589)" fill="#4D5254"/>
|
|
31030
|
-
<rect x="18.7157" y="73.8701" width="2" height="8" rx="1" transform="rotate(45 18.7157 73.8701)" fill="#4D5254"/>
|
|
31031
|
-
<rect x="80.9412" y="79.5269" width="2" height="8" rx="1" transform="rotate(135 80.9412 79.5269)" fill="#4D5254"/>
|
|
31032
|
-
<rect x="20.1299" y="18.7157" width="2" height="8" rx="1" transform="rotate(135 20.1299 18.7157)" fill="#4D5254"/>
|
|
31033
|
-
<rect x="28.8555" y="5.80811" width="2" height="4" rx="1" transform="rotate(-22.5 28.8555 5.80811)" fill="#505456"/>
|
|
31034
|
-
<rect x="61.7662" y="85.2617" width="2" height="4" rx="1" transform="rotate(-22.5 61.7662 85.2617)" fill="#505456"/>
|
|
31035
|
-
<rect x="88.1919" y="28.8553" width="2" height="4" rx="1" transform="rotate(67.5 88.1919 28.8553)" fill="#505456"/>
|
|
31036
|
-
<rect x="8.73828" y="61.7661" width="2" height="4" rx="1" transform="rotate(67.5 8.73828 61.7661)" fill="#505456"/>
|
|
31037
|
-
<rect x="63.2969" y="5.04272" width="2" height="4" rx="1" transform="rotate(22.5 63.2969 5.04272)" fill="#505456"/>
|
|
31038
|
-
<rect x="30.386" y="84.4963" width="2" height="4" rx="1" transform="rotate(22.5 30.386 84.4963)" fill="#505456"/>
|
|
31039
|
-
<rect x="88.9572" y="63.2969" width="2" height="4" rx="1" transform="rotate(112.5 88.9572 63.2969)" fill="#505456"/>
|
|
31040
|
-
<rect x="9.50354" y="30.3861" width="2" height="4" rx="1" transform="rotate(112.5 9.50354 30.3861)" fill="#505456"/>
|
|
31041
|
-
</svg>
|
|
31042
|
-
|
|
31043
|
-
<svg class="NextspaceNavCompassArrow" width="28" height="35" viewBox="0 0 32 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31668
|
+
<svg class="NextspaceNavCompassArrow" width="21" height="26.25" viewBox="0 0 32 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31044
31669
|
<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)"/>
|
|
31045
31670
|
<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"/>
|
|
31046
31671
|
<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)"/>
|
|
@@ -31062,214 +31687,374 @@
|
|
|
31062
31687
|
</svg>
|
|
31063
31688
|
`;
|
|
31064
31689
|
this._axis = axis;
|
|
31065
|
-
|
|
31066
|
-
|
|
31067
|
-
|
|
31068
|
-
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
|
|
31072
|
-
</
|
|
31073
|
-
|
|
31074
|
-
<div class="NextspaceNavCompassButt">
|
|
31075
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31076
|
-
<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"/>
|
|
31077
|
-
</svg>
|
|
31078
|
-
</div>
|
|
31690
|
+
}
|
|
31691
|
+
_generateLookButtons(top) {
|
|
31692
|
+
const lookUp = document.createElement("div");
|
|
31693
|
+
lookUp.className = "NextspaceNavCompassButt NextspaceNavCompassLookButt look-up";
|
|
31694
|
+
lookUp.innerHTML = `
|
|
31695
|
+
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31696
|
+
<path d="M1 8L8 1L15 8" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31697
|
+
</svg>
|
|
31079
31698
|
`;
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31699
|
+
top.appendChild(lookUp);
|
|
31700
|
+
this._attachHold(lookUp, {
|
|
31701
|
+
action: () => this._clickLookUp(),
|
|
31702
|
+
continuousAction: () => StartContinuousLook({
|
|
31703
|
+
viewer: this._viewer,
|
|
31704
|
+
manager: this._manager,
|
|
31705
|
+
lookUp: true,
|
|
31706
|
+
selectedIds: this._getSelectedIds(),
|
|
31707
|
+
stablePivot: this._getStablePivot(),
|
|
31708
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31709
|
+
})
|
|
31085
31710
|
});
|
|
31086
|
-
|
|
31087
|
-
|
|
31711
|
+
this._lookUp = lookUp;
|
|
31712
|
+
const lookDown = document.createElement("div");
|
|
31713
|
+
lookDown.className = "NextspaceNavCompassButt NextspaceNavCompassLookButt look-down";
|
|
31714
|
+
lookDown.innerHTML = `
|
|
31715
|
+
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31716
|
+
<path d="M15 1L8 8L1 1" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31717
|
+
</svg>
|
|
31718
|
+
`;
|
|
31719
|
+
top.appendChild(lookDown);
|
|
31720
|
+
this._attachHold(lookDown, {
|
|
31721
|
+
action: () => this._clickLookDown(),
|
|
31722
|
+
continuousAction: () => StartContinuousLook({
|
|
31723
|
+
viewer: this._viewer,
|
|
31724
|
+
manager: this._manager,
|
|
31725
|
+
lookUp: false,
|
|
31726
|
+
selectedIds: this._getSelectedIds(),
|
|
31727
|
+
stablePivot: this._getStablePivot(),
|
|
31728
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31729
|
+
})
|
|
31088
31730
|
});
|
|
31089
|
-
|
|
31090
|
-
|
|
31091
|
-
|
|
31092
|
-
const
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
<
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
</div>
|
|
31101
|
-
|
|
31102
|
-
<div class="NextspaceNavCompassButt">
|
|
31103
|
-
<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31104
|
-
<path d="M15 1L8 8L1 1" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31105
|
-
</svg>
|
|
31106
|
-
</div>
|
|
31107
|
-
</div>
|
|
31108
|
-
<div class="NextspaceNavCompassVerDash"></div>
|
|
31109
|
-
<div class="NextspaceNavCompassCol">
|
|
31110
|
-
<div class="NextspaceNavCompassButt">
|
|
31111
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31112
|
-
<path d="M8 1V15" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31113
|
-
<path d="M15 8L1 8" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31114
|
-
</svg>
|
|
31115
|
-
</div>
|
|
31116
|
-
|
|
31117
|
-
<div class="NextspaceNavCompassButt">
|
|
31118
|
-
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31119
|
-
<path d="M15 1L1 0.999999" stroke="#A2A9B0" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
|
31120
|
-
</svg>
|
|
31121
|
-
</div>
|
|
31122
|
-
</div>
|
|
31731
|
+
this._lookDown = lookDown;
|
|
31732
|
+
}
|
|
31733
|
+
_rotateIconSvg(flip) {
|
|
31734
|
+
const transform = flip ? "scaleX(-1) rotate(145deg)" : "rotate(145deg)";
|
|
31735
|
+
return `
|
|
31736
|
+
<svg style="transform: ${transform}" width="22" height="22" viewBox="0 0 565.3 533.667" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31737
|
+
<g transform="translate(33.5 33.5)">
|
|
31738
|
+
<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)"/>
|
|
31739
|
+
<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)"/>
|
|
31740
|
+
</g>
|
|
31741
|
+
</svg>
|
|
31123
31742
|
`;
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31743
|
+
}
|
|
31744
|
+
_generateRotateButtons(top) {
|
|
31745
|
+
const rotateLeft = document.createElement("div");
|
|
31746
|
+
rotateLeft.className = "NextspaceNavCompassButt NextspaceNavCompassRotateButt rotate-left";
|
|
31747
|
+
rotateLeft.innerHTML = this._rotateIconSvg(true);
|
|
31748
|
+
top.appendChild(rotateLeft);
|
|
31749
|
+
this._attachHold(rotateLeft, {
|
|
31750
|
+
action: () => this._clickRotate(-Math.PI * 0.25),
|
|
31751
|
+
continuousAction: () => StartContinuousRotate({
|
|
31752
|
+
viewer: this._viewer,
|
|
31753
|
+
manager: this._manager,
|
|
31754
|
+
rotateLeft: true,
|
|
31755
|
+
selectedIds: this._getSelectedIds(),
|
|
31756
|
+
stablePivot: this._getStablePivot(),
|
|
31757
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31758
|
+
})
|
|
31130
31759
|
});
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31760
|
+
const rotateRight = document.createElement("div");
|
|
31761
|
+
rotateRight.className = "NextspaceNavCompassButt NextspaceNavCompassRotateButt rotate-right";
|
|
31762
|
+
rotateRight.innerHTML = this._rotateIconSvg(false);
|
|
31763
|
+
top.appendChild(rotateRight);
|
|
31764
|
+
this._attachHold(rotateRight, {
|
|
31765
|
+
action: () => this._clickRotate(Math.PI * 0.25),
|
|
31766
|
+
continuousAction: () => StartContinuousRotate({
|
|
31767
|
+
viewer: this._viewer,
|
|
31768
|
+
manager: this._manager,
|
|
31769
|
+
rotateLeft: false,
|
|
31770
|
+
selectedIds: this._getSelectedIds(),
|
|
31771
|
+
stablePivot: this._getStablePivot(),
|
|
31772
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31773
|
+
})
|
|
31134
31774
|
});
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31775
|
+
}
|
|
31776
|
+
_generateZoomRow(element) {
|
|
31777
|
+
const row = document.createElement("div");
|
|
31778
|
+
row.className = "NextspaceNavCompassRow";
|
|
31779
|
+
element.appendChild(row);
|
|
31780
|
+
const zoomIn = document.createElement("div");
|
|
31781
|
+
zoomIn.className = "NextspaceNavCompassButt";
|
|
31782
|
+
zoomIn.innerHTML = `
|
|
31783
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31784
|
+
<path d="M8 1V15" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31785
|
+
<path d="M15 8L1 8" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31786
|
+
</svg>
|
|
31787
|
+
`;
|
|
31788
|
+
row.appendChild(zoomIn);
|
|
31789
|
+
this._attachHold(zoomIn, {
|
|
31790
|
+
action: () => this._clickZoom(true),
|
|
31791
|
+
continuousAction: () => StartContinuousZoom({
|
|
31792
|
+
viewer: this._viewer,
|
|
31793
|
+
zoomIn: true,
|
|
31794
|
+
stablePivot: this._getStablePivot(),
|
|
31795
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31796
|
+
})
|
|
31139
31797
|
});
|
|
31140
|
-
zoomOut.
|
|
31141
|
-
|
|
31798
|
+
const zoomOut = document.createElement("div");
|
|
31799
|
+
zoomOut.className = "NextspaceNavCompassButt";
|
|
31800
|
+
zoomOut.innerHTML = `
|
|
31801
|
+
<svg width="16" height="2" viewBox="0 0 16 2" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31802
|
+
<path d="M15 1L1 0.999999" stroke="#A2A9B0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31803
|
+
</svg>
|
|
31804
|
+
`;
|
|
31805
|
+
row.appendChild(zoomOut);
|
|
31806
|
+
this._attachHold(zoomOut, {
|
|
31807
|
+
action: () => this._clickZoom(false),
|
|
31808
|
+
continuousAction: () => StartContinuousZoom({
|
|
31809
|
+
viewer: this._viewer,
|
|
31810
|
+
zoomIn: false,
|
|
31811
|
+
stablePivot: this._getStablePivot(),
|
|
31812
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31813
|
+
})
|
|
31142
31814
|
});
|
|
31815
|
+
}
|
|
31816
|
+
_generateExtraTools(element) {
|
|
31817
|
+
const row = document.createElement("div");
|
|
31818
|
+
row.className = "NextspaceNavCompassRow";
|
|
31819
|
+
row.style.paddingTop = "0";
|
|
31820
|
+
row.style.paddingBottom = "8px";
|
|
31821
|
+
element.appendChild(row);
|
|
31822
|
+
const walkthroughButt = document.createElement("div");
|
|
31823
|
+
walkthroughButt.className = "NextspaceNavCompassButt";
|
|
31824
|
+
walkthroughButt.setAttribute("title", "Toggle Walkthrough mode");
|
|
31825
|
+
walkthroughButt.innerHTML = this._walkthroughIconSvg(false);
|
|
31826
|
+
walkthroughButt.addEventListener("click", () => this._toggleWalkthrough());
|
|
31827
|
+
row.appendChild(walkthroughButt);
|
|
31828
|
+
this._walkthroughButt = walkthroughButt;
|
|
31829
|
+
const vrButt = document.createElement("div");
|
|
31830
|
+
vrButt.className = "NextspaceNavCompassButt";
|
|
31831
|
+
vrButt.setAttribute("title", "Toggle VR mode");
|
|
31832
|
+
vrButt.innerHTML = this._vrIconSvg(false);
|
|
31833
|
+
vrButt.addEventListener("click", () => this._toggleVR());
|
|
31834
|
+
row.appendChild(vrButt);
|
|
31835
|
+
this._vrButt = vrButt;
|
|
31836
|
+
this._fullscreenChange = () => {
|
|
31837
|
+
if (Cesium.Fullscreen.fullscreen || !this._isVR) {
|
|
31838
|
+
return;
|
|
31839
|
+
}
|
|
31840
|
+
this._setVR(false);
|
|
31841
|
+
};
|
|
31842
|
+
document.addEventListener("fullscreenchange", this._fullscreenChange);
|
|
31843
|
+
document.addEventListener("webkitfullscreenchange", this._fullscreenChange);
|
|
31844
|
+
}
|
|
31845
|
+
_walkthroughIconSvg(active) {
|
|
31846
|
+
const color = active ? "#4D9CF8" : "#A2A9B0";
|
|
31847
|
+
return `
|
|
31848
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31849
|
+
<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}"/>
|
|
31850
|
+
</svg>
|
|
31851
|
+
`;
|
|
31852
|
+
}
|
|
31853
|
+
_vrIconSvg(active) {
|
|
31854
|
+
const color = active ? "#4D9CF8" : "#A2A9B0";
|
|
31855
|
+
return `
|
|
31856
|
+
<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">
|
|
31857
|
+
<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"/>
|
|
31858
|
+
</svg>
|
|
31859
|
+
`;
|
|
31860
|
+
}
|
|
31861
|
+
_generateDimensionToggle(element) {
|
|
31143
31862
|
const dimToggle = document.createElement("div");
|
|
31144
31863
|
dimToggle.className = "NextspaceNavCompassDimToggle";
|
|
31145
31864
|
dimToggle.innerHTML = `
|
|
31146
|
-
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">
|
|
31147
|
-
|
|
31148
|
-
</div>
|
|
31149
|
-
|
|
31150
|
-
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">
|
|
31151
|
-
2D
|
|
31152
|
-
</div>
|
|
31865
|
+
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">3D</div>
|
|
31866
|
+
<div class="NextspaceNavCompassDimToggleButt" is-selected="false">2D</div>
|
|
31153
31867
|
`;
|
|
31154
31868
|
element.appendChild(dimToggle);
|
|
31155
|
-
|
|
31156
|
-
this._2d = butt2d;
|
|
31157
|
-
butt2d.addEventListener("click", () => {
|
|
31158
|
-
this._toggle2d3d();
|
|
31159
|
-
});
|
|
31869
|
+
this._dimensionToggle = dimToggle;
|
|
31160
31870
|
const butt3d = dimToggle.children[0];
|
|
31871
|
+
const butt2d = dimToggle.children[1];
|
|
31161
31872
|
this._3d = butt3d;
|
|
31162
|
-
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31873
|
+
this._2d = butt2d;
|
|
31874
|
+
butt3d.addEventListener("click", () => this._toggle2d3d());
|
|
31875
|
+
butt2d.addEventListener("click", () => this._toggle2d3d());
|
|
31876
|
+
}
|
|
31877
|
+
_attachHold(el, params) {
|
|
31878
|
+
const start = (e) => {
|
|
31879
|
+
e.stopPropagation();
|
|
31880
|
+
this._handlePointerDown(params.action, params.continuousAction, e);
|
|
31881
|
+
};
|
|
31882
|
+
el.addEventListener("mousedown", start);
|
|
31883
|
+
el.addEventListener("touchstart", start, { passive: true });
|
|
31884
|
+
}
|
|
31885
|
+
_handlePointerDown(action, continuousAction, e) {
|
|
31886
|
+
const x = "clientX" in e ? e.clientX : e.touches[0].clientX;
|
|
31887
|
+
const y = "clientY" in e ? e.clientY : e.touches[0].clientY;
|
|
31888
|
+
const isTouch = "touches" in e;
|
|
31889
|
+
this._didActivateContinuous = false;
|
|
31890
|
+
this._pendingSingleAction = action;
|
|
31891
|
+
this._loaderTimer = window.setTimeout(() => {
|
|
31892
|
+
this._holdLoader = new WidgetNavCompassHoldLoader({ x, y, durationMs: 200, isTouch });
|
|
31893
|
+
this._loaderTimer = null;
|
|
31894
|
+
}, HOLD_LOADER_DELAY_MS);
|
|
31895
|
+
this._holdTimer = window.setTimeout(() => {
|
|
31896
|
+
this._didActivateContinuous = true;
|
|
31897
|
+
this._pendingSingleAction = null;
|
|
31898
|
+
this._stopContinuous = continuousAction();
|
|
31899
|
+
this._holdTimer = null;
|
|
31900
|
+
}, HOLD_ACTIVATION_TIME_MS);
|
|
31901
|
+
}
|
|
31902
|
+
_handlePointerUp() {
|
|
31903
|
+
var _a;
|
|
31904
|
+
if (!this._holdLoader && !this._holdTimer && !this._stopContinuous && !this._loaderTimer) {
|
|
31905
|
+
return;
|
|
31906
|
+
}
|
|
31907
|
+
if (this._loaderTimer) {
|
|
31908
|
+
window.clearTimeout(this._loaderTimer);
|
|
31909
|
+
this._loaderTimer = null;
|
|
31910
|
+
}
|
|
31911
|
+
if (this._holdTimer) {
|
|
31912
|
+
window.clearTimeout(this._holdTimer);
|
|
31913
|
+
this._holdTimer = null;
|
|
31914
|
+
}
|
|
31915
|
+
if (this._stopContinuous) {
|
|
31916
|
+
this._stopContinuous();
|
|
31917
|
+
this._stopContinuous = null;
|
|
31918
|
+
}
|
|
31919
|
+
if (this._pendingSingleAction && !this._didActivateContinuous) {
|
|
31920
|
+
const action = this._pendingSingleAction;
|
|
31921
|
+
this._pendingSingleAction = null;
|
|
31922
|
+
setTimeout(() => action(), 0);
|
|
31923
|
+
}
|
|
31924
|
+
(_a = this._holdLoader) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
31925
|
+
this._holdLoader = null;
|
|
31926
|
+
this._didActivateContinuous = false;
|
|
31168
31927
|
}
|
|
31169
31928
|
_updateAxis() {
|
|
31170
|
-
const heading = this._viewer.camera.heading;
|
|
31171
|
-
const
|
|
31172
|
-
|
|
31929
|
+
const heading = Number(this._viewer.camera.heading);
|
|
31930
|
+
const headingDegrees = 360 - Cesium.Math.toDegrees(heading);
|
|
31931
|
+
this._axis.style.transform = `rotate(${headingDegrees}deg)`;
|
|
31173
31932
|
}
|
|
31174
31933
|
_clickResetNorth() {
|
|
31175
31934
|
const viewer = this._viewer;
|
|
31176
31935
|
const h = viewer.camera.heading;
|
|
31177
31936
|
const north = h < Math.PI ? h : h - Math.PI * 2;
|
|
31178
|
-
this.
|
|
31937
|
+
this._clickRotate(north);
|
|
31938
|
+
}
|
|
31939
|
+
// Chains a single-tap action onto any in-flight one so animations never overlap.
|
|
31940
|
+
_runOrbitAction(fn) {
|
|
31941
|
+
const run = this._orbitActionChain.then(fn, fn);
|
|
31942
|
+
this._orbitActionChain = run.catch(() => { });
|
|
31943
|
+
return run;
|
|
31944
|
+
}
|
|
31945
|
+
_clickRotate(radians) {
|
|
31946
|
+
this._runOrbitAction(async () => {
|
|
31947
|
+
const pivot = await DoRotate({
|
|
31948
|
+
viewer: this._viewer,
|
|
31949
|
+
manager: this._manager,
|
|
31950
|
+
radians,
|
|
31951
|
+
selectedIds: this._getSelectedIds(),
|
|
31952
|
+
stablePivot: this._getStablePivot(),
|
|
31953
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31954
|
+
});
|
|
31955
|
+
this._updateStablePivot(pivot);
|
|
31956
|
+
});
|
|
31179
31957
|
}
|
|
31180
|
-
|
|
31181
|
-
|
|
31182
|
-
|
|
31183
|
-
|
|
31184
|
-
|
|
31185
|
-
|
|
31186
|
-
|
|
31187
|
-
|
|
31188
|
-
|
|
31189
|
-
|
|
31190
|
-
|
|
31191
|
-
|
|
31192
|
-
|
|
31193
|
-
|
|
31194
|
-
|
|
31195
|
-
|
|
31196
|
-
|
|
31958
|
+
_clickZoom(zoomIn) {
|
|
31959
|
+
this._runOrbitAction(async () => {
|
|
31960
|
+
const pivot = await DoZoom({
|
|
31961
|
+
viewer: this._viewer,
|
|
31962
|
+
zoomIn,
|
|
31963
|
+
stablePivot: this._getStablePivot(),
|
|
31964
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31965
|
+
});
|
|
31966
|
+
this._updateStablePivot(pivot);
|
|
31967
|
+
});
|
|
31968
|
+
}
|
|
31969
|
+
_clickLookUp() {
|
|
31970
|
+
if (GetIs2d(this._viewer)) {
|
|
31971
|
+
return;
|
|
31972
|
+
}
|
|
31973
|
+
this._runOrbitAction(async () => {
|
|
31974
|
+
const pivot = await DoLook({
|
|
31975
|
+
viewer: this._viewer,
|
|
31976
|
+
manager: this._manager,
|
|
31977
|
+
tiltUp: true,
|
|
31978
|
+
selectedIds: this._getSelectedIds(),
|
|
31979
|
+
stablePivot: this._getStablePivot(),
|
|
31980
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31981
|
+
});
|
|
31982
|
+
this._updateStablePivot(pivot);
|
|
31983
|
+
});
|
|
31984
|
+
}
|
|
31985
|
+
_clickLookDown() {
|
|
31986
|
+
if (GetIs2d(this._viewer)) {
|
|
31987
|
+
return;
|
|
31988
|
+
}
|
|
31989
|
+
this._runOrbitAction(async () => {
|
|
31990
|
+
const pivot = await DoLook({
|
|
31991
|
+
viewer: this._viewer,
|
|
31992
|
+
manager: this._manager,
|
|
31993
|
+
tiltUp: false,
|
|
31994
|
+
selectedIds: this._getSelectedIds(),
|
|
31995
|
+
stablePivot: this._getStablePivot(),
|
|
31996
|
+
onPivotUpdate: (p) => this._updateStablePivot(p)
|
|
31997
|
+
});
|
|
31998
|
+
this._updateStablePivot(pivot);
|
|
31999
|
+
});
|
|
32000
|
+
}
|
|
32001
|
+
IsWalkthroughActive() {
|
|
32002
|
+
return this._isWalkthroughActive;
|
|
32003
|
+
}
|
|
32004
|
+
_toggleWalkthrough() {
|
|
32005
|
+
this._setWalkthrough(!this._isWalkthroughActive);
|
|
32006
|
+
}
|
|
32007
|
+
_setWalkthrough(active) {
|
|
32008
|
+
var _a, _b, _c;
|
|
32009
|
+
this._isWalkthroughActive = active;
|
|
32010
|
+
this._walkthroughButt.innerHTML = this._walkthroughIconSvg(active);
|
|
32011
|
+
this._dimensionToggle.setAttribute("is-disabled", active ? "true" : "false");
|
|
32012
|
+
if (active) {
|
|
32013
|
+
exports.Walkthrough.Start({ viewer: this._viewer });
|
|
32014
|
+
(_a = this._walkthroughBar) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
32015
|
+
this._walkthroughBar = new WidgetNavCompassWalkthroughBar({
|
|
32016
|
+
viewer: this._viewer,
|
|
32017
|
+
container: this.Container,
|
|
32018
|
+
onClose: () => this._setWalkthrough(false)
|
|
31197
32019
|
});
|
|
31198
32020
|
}
|
|
31199
32021
|
else {
|
|
31200
|
-
|
|
31201
|
-
|
|
31202
|
-
const ground = exports.DrawingUtils.GetAccuratePosition(viewer, center);
|
|
31203
|
-
if (!(ground === null || ground === void 0 ? void 0 : ground.x)) {
|
|
31204
|
-
return;
|
|
32022
|
+
if (((_b = this._viewer) === null || _b === void 0 ? void 0 : _b.scene) && !this._viewer.isDestroyed()) {
|
|
32023
|
+
exports.Walkthrough.Stop({ viewer: this._viewer });
|
|
31205
32024
|
}
|
|
31206
|
-
|
|
31207
|
-
|
|
31208
|
-
const unsub = viewer.clock.onTick.addEventListener(function () {
|
|
31209
|
-
let inc = Math.PI * TURN_SPEED;
|
|
31210
|
-
if (r + inc >= radians) {
|
|
31211
|
-
unsub();
|
|
31212
|
-
inc = radians - r;
|
|
31213
|
-
}
|
|
31214
|
-
camera.lookAt(ground, new Cesium.HeadingPitchRange(camera.heading, camera.pitch, offset));
|
|
31215
|
-
left ? camera.rotateLeft(inc) : camera.rotateRight(inc);
|
|
31216
|
-
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
|
31217
|
-
r += inc;
|
|
31218
|
-
});
|
|
32025
|
+
(_c = this._walkthroughBar) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
32026
|
+
this._walkthroughBar = null;
|
|
31219
32027
|
}
|
|
32028
|
+
this.OnWalkthroughChange.Trigger(active);
|
|
31220
32029
|
}
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
const
|
|
31227
|
-
if (!
|
|
32030
|
+
_toggleVR() {
|
|
32031
|
+
this._setVR(!this._isVR);
|
|
32032
|
+
}
|
|
32033
|
+
_setVR(active) {
|
|
32034
|
+
var _a, _b;
|
|
32035
|
+
const scene = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene;
|
|
32036
|
+
if (!scene) {
|
|
31228
32037
|
return;
|
|
31229
32038
|
}
|
|
31230
|
-
|
|
31231
|
-
|
|
31232
|
-
|
|
31233
|
-
|
|
31234
|
-
|
|
31235
|
-
|
|
31236
|
-
|
|
32039
|
+
try {
|
|
32040
|
+
scene.useWebVR = active;
|
|
32041
|
+
(_b = scene.requestRender) === null || _b === void 0 ? void 0 : _b.call(scene);
|
|
32042
|
+
this._isVR = active;
|
|
32043
|
+
this._vrButt.innerHTML = this._vrIconSvg(active);
|
|
32044
|
+
}
|
|
32045
|
+
catch (e) {
|
|
32046
|
+
console.warn("[VR] Failed to toggle VR mode.", e);
|
|
31237
32047
|
}
|
|
31238
|
-
const to = Cesium.Cartesian3.add(ground, offset, new Cesium.Cartesian3);
|
|
31239
|
-
camera.flyTo({
|
|
31240
|
-
destination: to,
|
|
31241
|
-
orientation: { heading: camera.heading, pitch: camera.pitch, roll: camera.roll },
|
|
31242
|
-
duration: this.ZOOM_TIME,
|
|
31243
|
-
easingFunction: Cesium.EasingFunction.QUADRATIC_IN_OUT
|
|
31244
|
-
});
|
|
31245
|
-
}
|
|
31246
|
-
_doLook(tiltUp) {
|
|
31247
|
-
const viewer = this._viewer;
|
|
31248
|
-
let diff = 6.26 / 32;
|
|
31249
|
-
if (!tiltUp) {
|
|
31250
|
-
diff *= -1;
|
|
31251
|
-
}
|
|
31252
|
-
let current = viewer.camera.pitch;
|
|
31253
|
-
current += diff;
|
|
31254
|
-
viewer.camera.flyTo({
|
|
31255
|
-
destination: viewer.camera.position,
|
|
31256
|
-
orientation: {
|
|
31257
|
-
heading: viewer.camera.heading,
|
|
31258
|
-
pitch: current,
|
|
31259
|
-
roll: viewer.camera.roll
|
|
31260
|
-
},
|
|
31261
|
-
duration: 0.2
|
|
31262
|
-
});
|
|
31263
32048
|
}
|
|
31264
32049
|
_update2d3d() {
|
|
31265
|
-
const is2d = this.
|
|
32050
|
+
const is2d = GetIs2d(this._viewer);
|
|
31266
32051
|
this._2d.setAttribute("is-selected", is2d ? "true" : "false");
|
|
31267
32052
|
this._3d.setAttribute("is-selected", is2d ? "false" : "true");
|
|
31268
|
-
this.
|
|
31269
|
-
this.
|
|
32053
|
+
this._lookUp.style.display = is2d ? "none" : "flex";
|
|
32054
|
+
this._lookDown.style.display = is2d ? "none" : "flex";
|
|
31270
32055
|
}
|
|
31271
32056
|
_toggle2d3d() {
|
|
31272
|
-
const shouldBe2d = !this.
|
|
32057
|
+
const shouldBe2d = !GetIs2d(this._viewer);
|
|
31273
32058
|
exports.ViewUtils.Set2dStatus({
|
|
31274
32059
|
status: shouldBe2d,
|
|
31275
32060
|
viewer: this._viewer,
|
|
@@ -37512,7 +38297,7 @@
|
|
|
37512
38297
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
37513
38298
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
37514
38299
|
|
|
37515
|
-
const VERSION = "6.
|
|
38300
|
+
const VERSION = "6.9.1";
|
|
37516
38301
|
/**
|
|
37517
38302
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
37518
38303
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|