bruce-cesium 5.0.4 → 5.0.6
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 +153 -2
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +153 -2
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/utils/drawing-utils.js +3 -1
- package/dist/lib/utils/drawing-utils.js.map +1 -1
- package/dist/lib/widgets/widget-cursorbar.js +152 -0
- package/dist/lib/widgets/widget-cursorbar.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/widgets/widget-cursorbar.d.ts +2 -0
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -644,11 +644,12 @@ var DrawingUtils;
|
|
|
644
644
|
let cachedPick = null;
|
|
645
645
|
let cacheTimestamp = null;
|
|
646
646
|
let cachedCameraState = null;
|
|
647
|
+
let cachedPickOnlyState = null;
|
|
647
648
|
return (viewer, cursor, pickOnly = false) => {
|
|
648
649
|
const scene = viewer.scene;
|
|
649
650
|
const camera = scene.camera;
|
|
650
651
|
// Check if we can use cached position.
|
|
651
|
-
if (cachedPick && cacheTimestamp) {
|
|
652
|
+
if (cachedPick && cacheTimestamp && cachedPickOnlyState === pickOnly) {
|
|
652
653
|
const timeElapsed = Date.now() - cacheTimestamp;
|
|
653
654
|
const isWithinCacheDuration = timeElapsed < 3000; // 3 seconds
|
|
654
655
|
const isNearPreviousPick = Cartesian2.distanceSquared(cursor, cachedPick.cursor) < 9; // 3 pixels
|
|
@@ -708,6 +709,7 @@ var DrawingUtils;
|
|
|
708
709
|
position: camera.positionWC.clone(),
|
|
709
710
|
direction: camera.directionWC.clone()
|
|
710
711
|
};
|
|
712
|
+
cachedPickOnlyState = pickOnly;
|
|
711
713
|
return pos3d;
|
|
712
714
|
};
|
|
713
715
|
})();
|
|
@@ -26273,11 +26275,13 @@ var ESecondaryCursor;
|
|
|
26273
26275
|
ESecondaryCursor["MeasurePoint"] = "measure-point";
|
|
26274
26276
|
ESecondaryCursor["MeasurePolyline"] = "measure-polyline";
|
|
26275
26277
|
ESecondaryCursor["MeasurePolygon"] = "measure-polygon";
|
|
26278
|
+
ESecondaryCursor["WalkthroughPin"] = "walkthrough-pin";
|
|
26276
26279
|
})(ESecondaryCursor || (ESecondaryCursor = {}));
|
|
26277
26280
|
const KEY_WALKTHROUGH_MODE = "WidgetCursorBar.Walkthrough.Mode";
|
|
26278
26281
|
const KEY_WALKTHROUGH_SPEED_FLY = "WidgetCursorBar.Walkthrough.SpeedFly";
|
|
26279
26282
|
const KEY_WALKTHROUGH_SPEED_WALK = "WidgetCursorBar.Walkthrough.SpeedWalk";
|
|
26280
26283
|
const KEY_WALKTHROUGH_EXPANDED = "WidgetCursorBar.Walkthrough.Expanded";
|
|
26284
|
+
const VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM = "--viewer-walkthrough-panel-bottom";
|
|
26281
26285
|
class WidgetCursorBar extends Widget.AWidget {
|
|
26282
26286
|
constructor(params) {
|
|
26283
26287
|
super(params);
|
|
@@ -26290,6 +26294,7 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26290
26294
|
if (this._selectedCursor == ECursor.Select || this._selectedSecondaryCursor == ESecondaryCursor.Select) {
|
|
26291
26295
|
this._listenSelection();
|
|
26292
26296
|
}
|
|
26297
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
26293
26298
|
}
|
|
26294
26299
|
Dispose() {
|
|
26295
26300
|
var _a, _b, _c;
|
|
@@ -26329,6 +26334,7 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26329
26334
|
flex-direction: column;
|
|
26330
26335
|
overflow: hidden;
|
|
26331
26336
|
pointer-events: none;
|
|
26337
|
+
color: black;
|
|
26332
26338
|
}
|
|
26333
26339
|
|
|
26334
26340
|
.NextspaceCursorBar * {
|
|
@@ -26516,6 +26522,7 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26516
26522
|
display: flex;
|
|
26517
26523
|
flex-direction: row;
|
|
26518
26524
|
padding: 14px 18px;
|
|
26525
|
+
box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.36), 0px 18px 36px -4px rgba(18, 22, 25, 0.36);
|
|
26519
26526
|
}
|
|
26520
26527
|
|
|
26521
26528
|
.NextspaceWalkthroughBarTitle {
|
|
@@ -26891,6 +26898,141 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26891
26898
|
}
|
|
26892
26899
|
this._updateSecondary();
|
|
26893
26900
|
}, panSvg);
|
|
26901
|
+
const pinSvg = `
|
|
26902
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
26903
|
+
<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"/>
|
|
26904
|
+
</svg>
|
|
26905
|
+
`;
|
|
26906
|
+
this._generateSecondaryControl("Move to point", ESecondaryCursor.WalkthroughPin, () => {
|
|
26907
|
+
if (this._selectedSecondaryCursor == ESecondaryCursor.WalkthroughPin) {
|
|
26908
|
+
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
26909
|
+
this._listenSelection();
|
|
26910
|
+
}
|
|
26911
|
+
else {
|
|
26912
|
+
this._selectedSecondaryCursor = ESecondaryCursor.WalkthroughPin;
|
|
26913
|
+
this._initWalkthroughPin();
|
|
26914
|
+
}
|
|
26915
|
+
this._updateSecondary();
|
|
26916
|
+
}, pinSvg);
|
|
26917
|
+
}
|
|
26918
|
+
_initWalkthroughPin() {
|
|
26919
|
+
if (this._walkthroughPinEventRemoval) {
|
|
26920
|
+
this._walkthroughPinEventRemoval();
|
|
26921
|
+
}
|
|
26922
|
+
let pointer;
|
|
26923
|
+
let events = new ScreenSpaceEventHandler(this._viewer.scene.canvas);
|
|
26924
|
+
this._walkthroughPinEventRemoval = () => {
|
|
26925
|
+
var _a;
|
|
26926
|
+
if (events && !events.isDestroyed()) {
|
|
26927
|
+
events.destroy();
|
|
26928
|
+
events = null;
|
|
26929
|
+
}
|
|
26930
|
+
if (((_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) && !this._viewer.scene.isDestroyed()) {
|
|
26931
|
+
if (pointer && this._viewer.entities.contains(pointer)) {
|
|
26932
|
+
this._viewer.entities.remove(pointer);
|
|
26933
|
+
}
|
|
26934
|
+
pointer = null;
|
|
26935
|
+
this._viewer.scene.requestRender();
|
|
26936
|
+
}
|
|
26937
|
+
};
|
|
26938
|
+
let dropPosition3d;
|
|
26939
|
+
let dropPosition2d;
|
|
26940
|
+
let dropOnTerrain = false;
|
|
26941
|
+
events.setInputAction((e) => {
|
|
26942
|
+
const pos2d = e.endPosition;
|
|
26943
|
+
// First try find a position on a 'thing'.
|
|
26944
|
+
// This lets us put our pin underground if there is something there.
|
|
26945
|
+
let pos3d = DrawingUtils.GetAccuratePosition(this._viewer, pos2d, true);
|
|
26946
|
+
dropOnTerrain = false;
|
|
26947
|
+
// Fallback to position including terrain as an option.
|
|
26948
|
+
if (!Cartes.ValidateCartes3(pos3d)) {
|
|
26949
|
+
pos3d = DrawingUtils.GetAccuratePosition(this._viewer, pos2d, false);
|
|
26950
|
+
dropOnTerrain = true;
|
|
26951
|
+
}
|
|
26952
|
+
if (Cartes.ValidateCartes3(pos3d)) {
|
|
26953
|
+
dropPosition3d = pos3d;
|
|
26954
|
+
dropPosition2d = pos2d;
|
|
26955
|
+
if (!pointer) {
|
|
26956
|
+
pointer = this._viewer.entities.add({
|
|
26957
|
+
position: new CallbackProperty(() => dropPosition3d, false),
|
|
26958
|
+
point: {
|
|
26959
|
+
pixelSize: 10,
|
|
26960
|
+
color: Color.fromCssColorString("#33B1FF"),
|
|
26961
|
+
outlineColor: Color.WHITE,
|
|
26962
|
+
outlineWidth: 2,
|
|
26963
|
+
heightReference: HeightReference.NONE,
|
|
26964
|
+
show: true
|
|
26965
|
+
}
|
|
26966
|
+
});
|
|
26967
|
+
}
|
|
26968
|
+
}
|
|
26969
|
+
}, ScreenSpaceEventType.MOUSE_MOVE);
|
|
26970
|
+
let processing = false;
|
|
26971
|
+
events.setInputAction(async (e) => {
|
|
26972
|
+
if (processing) {
|
|
26973
|
+
return;
|
|
26974
|
+
}
|
|
26975
|
+
processing = true;
|
|
26976
|
+
try {
|
|
26977
|
+
if (!Cartes.ValidateCartes3(dropPosition3d) && e.position) {
|
|
26978
|
+
// First try find a position on a 'thing'.
|
|
26979
|
+
// This lets us put our pin underground if there is something there.
|
|
26980
|
+
let pos3d = DrawingUtils.GetAccuratePosition(this._viewer, e.position, true);
|
|
26981
|
+
dropOnTerrain = false;
|
|
26982
|
+
// Fallback to position including terrain as an option.
|
|
26983
|
+
if (!Cartes.ValidateCartes3(pos3d)) {
|
|
26984
|
+
pos3d = DrawingUtils.GetAccuratePosition(this._viewer, e.position, false);
|
|
26985
|
+
dropOnTerrain = true;
|
|
26986
|
+
}
|
|
26987
|
+
dropPosition3d = pos3d;
|
|
26988
|
+
dropPosition2d = e.position;
|
|
26989
|
+
}
|
|
26990
|
+
let pos3d = dropPosition3d === null || dropPosition3d === void 0 ? void 0 : dropPosition3d.clone();
|
|
26991
|
+
if (Cartes.ValidateCartes3(pos3d)) {
|
|
26992
|
+
const carto = Cartographic.fromCartesian(pos3d);
|
|
26993
|
+
// If we can raycast to something then we won't adjust above terrain.
|
|
26994
|
+
// Eg: we clicked on an Entity so if it's underground, that's likely intended.
|
|
26995
|
+
if (dropOnTerrain) {
|
|
26996
|
+
const terrainCarto = carto.clone();
|
|
26997
|
+
terrainCarto.height = 0;
|
|
26998
|
+
if (this._viewer.scene.terrainProvider instanceof EllipsoidTerrainProvider) ;
|
|
26999
|
+
else {
|
|
27000
|
+
const sample = await sampleTerrainMostDetailed(this._viewer.scene.terrainProvider, [terrainCarto]);
|
|
27001
|
+
const terrainHeight = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
27002
|
+
if (terrainHeight != null) {
|
|
27003
|
+
if (carto.height < terrainHeight) {
|
|
27004
|
+
carto.height = terrainHeight;
|
|
27005
|
+
}
|
|
27006
|
+
}
|
|
27007
|
+
}
|
|
27008
|
+
}
|
|
27009
|
+
// Add average human height.
|
|
27010
|
+
carto.height += 1.7;
|
|
27011
|
+
pos3d = Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height);
|
|
27012
|
+
this._viewer.camera.flyTo({
|
|
27013
|
+
destination: pos3d,
|
|
27014
|
+
duration: 2,
|
|
27015
|
+
orientation: {
|
|
27016
|
+
heading: this._viewer.camera.heading,
|
|
27017
|
+
pitch: Math$1.toRadians(0),
|
|
27018
|
+
roll: Math$1.toRadians(0)
|
|
27019
|
+
}
|
|
27020
|
+
});
|
|
27021
|
+
// Disable this picking cursor.
|
|
27022
|
+
this._selectedSecondaryCursor = ESecondaryCursor.Select;
|
|
27023
|
+
this._listenSelection();
|
|
27024
|
+
this._updateSecondary();
|
|
27025
|
+
if (this._walkthroughPinEventRemoval) {
|
|
27026
|
+
this._walkthroughPinEventRemoval();
|
|
27027
|
+
this._walkthroughPinEventRemoval = null;
|
|
27028
|
+
}
|
|
27029
|
+
}
|
|
27030
|
+
}
|
|
27031
|
+
catch (e) {
|
|
27032
|
+
console.error(e);
|
|
27033
|
+
}
|
|
27034
|
+
processing = false;
|
|
27035
|
+
}, ScreenSpaceEventType.LEFT_CLICK);
|
|
26894
27036
|
}
|
|
26895
27037
|
/**
|
|
26896
27038
|
* Generates the Walkthrough controls bar at the bottom of the screen.
|
|
@@ -26956,6 +27098,8 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26956
27098
|
<path d="M15 1L1 0.999999" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
26957
27099
|
</svg>
|
|
26958
27100
|
`;
|
|
27101
|
+
const heightCollapsed = "70px";
|
|
27102
|
+
const heightExpanded = "150px";
|
|
26959
27103
|
const expand = document.createElement("div");
|
|
26960
27104
|
expand.className = "NextspaceWalkthroughButtonExpand";
|
|
26961
27105
|
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
@@ -26964,9 +27108,11 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
26964
27108
|
expand.innerHTML = expanded ? svgMinimize : svgExpand;
|
|
26965
27109
|
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
26966
27110
|
localStorage.setItem(KEY_WALKTHROUGH_EXPANDED, expanded ? "true" : "false");
|
|
27111
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
26967
27112
|
};
|
|
26968
27113
|
content.appendChild(expand);
|
|
26969
27114
|
element.setAttribute("expanded", expanded ? "true" : "false");
|
|
27115
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, expanded ? heightExpanded : heightCollapsed);
|
|
26970
27116
|
}
|
|
26971
27117
|
content.appendChild(inputs);
|
|
26972
27118
|
const tips = document.createElement("div");
|
|
@@ -27138,10 +27284,15 @@ class WidgetCursorBar extends Widget.AWidget {
|
|
|
27138
27284
|
}
|
|
27139
27285
|
_disposeWalkthroughBar() {
|
|
27140
27286
|
var _a;
|
|
27287
|
+
if (this._walkthroughPinEventRemoval) {
|
|
27288
|
+
this._walkthroughPinEventRemoval();
|
|
27289
|
+
this._walkthroughPinEventRemoval = null;
|
|
27290
|
+
}
|
|
27141
27291
|
if ((_a = this._walkthroughBar) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
27142
27292
|
this._walkthroughBar.parentElement.removeChild(this._walkthroughBar);
|
|
27143
27293
|
this._walkthroughBar = null;
|
|
27144
27294
|
}
|
|
27295
|
+
document.documentElement.style.setProperty(VIEWER_WALKTHROUGH_PANEL_CSS_VAR_BOTTOM, "0px");
|
|
27145
27296
|
}
|
|
27146
27297
|
_updateControls() {
|
|
27147
27298
|
const controls = this._primaryContent.querySelectorAll(".NextspaceCursorBarPrimControlInner");
|
|
@@ -29210,7 +29361,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
29210
29361
|
}
|
|
29211
29362
|
}
|
|
29212
29363
|
|
|
29213
|
-
const VERSION = "5.0.
|
|
29364
|
+
const VERSION = "5.0.6";
|
|
29214
29365
|
|
|
29215
29366
|
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
29216
29367
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|