bruce-cesium 7.9.3 → 7.9.5
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 +429 -35
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +424 -32
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/viewer/camera-controls.js +428 -32
- package/dist/lib/viewer/camera-controls.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/viewer/camera-controls.d.ts +37 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1367,6 +1367,11 @@ void main()
|
|
|
1367
1367
|
const PUSH_NOTCHES_NOTHING_BELOW = 10;
|
|
1368
1368
|
// Pushes further apart than this start counting again.
|
|
1369
1369
|
const PUSH_WINDOW_MS = 1200;
|
|
1370
|
+
// How long after a zoom newly loaded terrain may lift the camera, and how much longer while loading.
|
|
1371
|
+
const SURFACE_HOLD_MS = 4000;
|
|
1372
|
+
const SURFACE_LOADING_MS = 30000;
|
|
1373
|
+
// No visible ground lies lower; a stand-in tileset below this is a coarse tile cutting under the curve.
|
|
1374
|
+
const GROUND_FLOOR = -500;
|
|
1370
1375
|
// How far below the ground something must reach to count as data underground, in metres.
|
|
1371
1376
|
const UNDERGROUND_MARGIN = 3;
|
|
1372
1377
|
// How long a scan of the scene for underground data and stand-in ground is trusted, in milliseconds.
|
|
@@ -1380,6 +1385,20 @@ void main()
|
|
|
1380
1385
|
const HIDDEN_GLOBE_MAX_HEIGHT = 10000000;
|
|
1381
1386
|
// Marks a tileset that stands in for the globe, such as Google's photorealistic tiles.
|
|
1382
1387
|
const GROUND_TILESET_KEY = "_nextspace_camera_ground";
|
|
1388
|
+
// A viewer's own mouse scheme and wheel direction, kept on the viewer so a host may set them before Attach.
|
|
1389
|
+
const MOUSE_KEY = "_nextspace_camera_mouse";
|
|
1390
|
+
// Marks a wheel event these controls turned round, so it is not turned back again.
|
|
1391
|
+
const MIRRORED_WHEEL_KEY = "_nextspace_mirrored";
|
|
1392
|
+
(function (ECameraMouseScheme) {
|
|
1393
|
+
// CesiumJS's own: left drag pans, middle or ctrl drag orbits, right drag zooms.
|
|
1394
|
+
ECameraMouseScheme["Default"] = "default";
|
|
1395
|
+
// Autodesk Fusion, Revit, Navisworks and AutoCAD: middle drag pans, shift+middle orbits, ctrl+shift+middle zooms.
|
|
1396
|
+
ECameraMouseScheme["Autodesk"] = "autodesk";
|
|
1397
|
+
// SketchUp: middle drag orbits, shift+middle pans.
|
|
1398
|
+
ECameraMouseScheme["SketchUp"] = "sketchup";
|
|
1399
|
+
})(exports.ECameraMouseScheme || (exports.ECameraMouseScheme = {}));
|
|
1400
|
+
// What a viewer without its own setting uses: the app user's preference, set once for every viewer the app makes.
|
|
1401
|
+
const _mouseDefault = { scheme: exports.ECameraMouseScheme.Default, wheelReversed: false };
|
|
1383
1402
|
var EDrag;
|
|
1384
1403
|
(function (EDrag) {
|
|
1385
1404
|
EDrag["Pan"] = "pan";
|
|
@@ -1391,7 +1410,7 @@ void main()
|
|
|
1391
1410
|
* Takes over mouse drag and wheel navigation close to the ground; CesiumJS keeps planet scale, pinch and look.
|
|
1392
1411
|
*/
|
|
1393
1412
|
function Attach(viewer) {
|
|
1394
|
-
var _a, _b, _c;
|
|
1413
|
+
var _a, _b, _c, _d;
|
|
1395
1414
|
if (!viewer || viewer.isDestroyed() || viewer[CESIUM_CAMERA_CONTROLS_KEY]) {
|
|
1396
1415
|
return;
|
|
1397
1416
|
}
|
|
@@ -1412,15 +1431,18 @@ void main()
|
|
|
1412
1431
|
push: { notches: 0, at: 0 },
|
|
1413
1432
|
scan: null,
|
|
1414
1433
|
undergroundOverride: null,
|
|
1434
|
+
surface: { above: false, through: false, until: 0, at: null },
|
|
1415
1435
|
saved: {
|
|
1416
1436
|
rotateEventTypes: controller.rotateEventTypes,
|
|
1417
1437
|
zoomEventTypes: controller.zoomEventTypes,
|
|
1418
1438
|
tiltEventTypes: controller.tiltEventTypes,
|
|
1439
|
+
translateEventTypes: controller.translateEventTypes,
|
|
1419
1440
|
enableCollisionDetection: controller.enableCollisionDetection,
|
|
1420
1441
|
backFaceAlpha: (_b = (_a = scene.globe) === null || _a === void 0 ? void 0 : _a.translucency) === null || _b === void 0 ? void 0 : _b.backFaceAlpha,
|
|
1421
1442
|
showSkirts: (_c = scene.globe) === null || _c === void 0 ? void 0 : _c.showSkirts
|
|
1422
1443
|
},
|
|
1423
1444
|
ours: false,
|
|
1445
|
+
cesiumScheme: null,
|
|
1424
1446
|
removals: []
|
|
1425
1447
|
};
|
|
1426
1448
|
viewer[CESIUM_CAMERA_CONTROLS_KEY] = state;
|
|
@@ -1436,7 +1458,13 @@ void main()
|
|
|
1436
1458
|
listen(window, "pointerup", (e) => onPointerUp(state, e));
|
|
1437
1459
|
listen(window, "pointercancel", (e) => onPointerUp(state, e));
|
|
1438
1460
|
listen(canvas, "wheel", (e) => onWheel(state, e), { passive: true });
|
|
1439
|
-
|
|
1461
|
+
// Caught before the canvas sees it, so CesiumJS's controller and these controls both get the turned wheel.
|
|
1462
|
+
const wheelHost = (_d = canvas.parentElement) !== null && _d !== void 0 ? _d : window;
|
|
1463
|
+
listen(wheelHost, "wheel", (e) => mirrorWheel(state, e), { capture: true, passive: false });
|
|
1464
|
+
state.removals.push(scene.preUpdate.addEventListener(() => {
|
|
1465
|
+
syncController(state);
|
|
1466
|
+
keepAboveGround(state);
|
|
1467
|
+
}));
|
|
1440
1468
|
syncController(state);
|
|
1441
1469
|
scene.requestRender();
|
|
1442
1470
|
}
|
|
@@ -1468,6 +1496,52 @@ void main()
|
|
|
1468
1496
|
return Boolean(viewer === null || viewer === void 0 ? void 0 : viewer[CESIUM_CAMERA_CONTROLS_KEY]);
|
|
1469
1497
|
}
|
|
1470
1498
|
CameraControls.IsAttached = IsAttached;
|
|
1499
|
+
/**
|
|
1500
|
+
* Picks which mouse buttons pan, orbit and zoom, here and for CesiumJS's controller above the hand-over height.
|
|
1501
|
+
*/
|
|
1502
|
+
function SetMouseScheme(viewer, scheme) {
|
|
1503
|
+
if (!viewer || viewer.isDestroyed()) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
viewer[MOUSE_KEY] = { ...viewer[MOUSE_KEY], scheme: knownScheme(scheme) };
|
|
1507
|
+
const state = viewer[CESIUM_CAMERA_CONTROLS_KEY];
|
|
1508
|
+
if (state && !state.ours) {
|
|
1509
|
+
applyCesiumGestures(state);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
CameraControls.SetMouseScheme = SetMouseScheme;
|
|
1513
|
+
/**
|
|
1514
|
+
* Sets the scheme for every viewer without its own, such as the app user's preference; viewers follow next frame.
|
|
1515
|
+
*/
|
|
1516
|
+
function SetMouseSchemeDefault(scheme) {
|
|
1517
|
+
_mouseDefault.scheme = knownScheme(scheme);
|
|
1518
|
+
}
|
|
1519
|
+
CameraControls.SetMouseSchemeDefault = SetMouseSchemeDefault;
|
|
1520
|
+
function GetMouseScheme(viewer) {
|
|
1521
|
+
return mouseOf(viewer).scheme;
|
|
1522
|
+
}
|
|
1523
|
+
CameraControls.GetMouseScheme = GetMouseScheme;
|
|
1524
|
+
/**
|
|
1525
|
+
* Makes wheel forward zoom out instead of in, for these controls and CesiumJS's controller alike.
|
|
1526
|
+
*/
|
|
1527
|
+
function SetMouseWheelReversed(viewer, reversed) {
|
|
1528
|
+
if (!viewer || viewer.isDestroyed()) {
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
viewer[MOUSE_KEY] = { ...viewer[MOUSE_KEY], wheelReversed: Boolean(reversed) };
|
|
1532
|
+
}
|
|
1533
|
+
CameraControls.SetMouseWheelReversed = SetMouseWheelReversed;
|
|
1534
|
+
/**
|
|
1535
|
+
* Sets the wheel direction for every viewer without its own, such as the app user's preference.
|
|
1536
|
+
*/
|
|
1537
|
+
function SetMouseWheelReversedDefault(reversed) {
|
|
1538
|
+
_mouseDefault.wheelReversed = Boolean(reversed);
|
|
1539
|
+
}
|
|
1540
|
+
CameraControls.SetMouseWheelReversedDefault = SetMouseWheelReversedDefault;
|
|
1541
|
+
function GetMouseWheelReversed(viewer) {
|
|
1542
|
+
return mouseOf(viewer).wheelReversed;
|
|
1543
|
+
}
|
|
1544
|
+
CameraControls.GetMouseWheelReversed = GetMouseWheelReversed;
|
|
1471
1545
|
/**
|
|
1472
1546
|
* Marks a tileset as standing in for the globe (Google's photorealistic tiles), so the camera treats it as ground.
|
|
1473
1547
|
*/
|
|
@@ -1525,11 +1599,67 @@ void main()
|
|
|
1525
1599
|
}
|
|
1526
1600
|
CameraControls.SetModelSpace = SetModelSpace;
|
|
1527
1601
|
})(exports.CameraControls || (exports.CameraControls = {}));
|
|
1602
|
+
/*
|
|
1603
|
+
* The scheme and wheel direction a viewer uses: its own where set, else the app default.
|
|
1604
|
+
*/
|
|
1605
|
+
function mouseOf(viewer) {
|
|
1606
|
+
var _a, _b;
|
|
1607
|
+
const own = viewer === null || viewer === void 0 ? void 0 : viewer[MOUSE_KEY];
|
|
1608
|
+
return {
|
|
1609
|
+
scheme: (_a = own === null || own === void 0 ? void 0 : own.scheme) !== null && _a !== void 0 ? _a : _mouseDefault.scheme,
|
|
1610
|
+
wheelReversed: (_b = own === null || own === void 0 ? void 0 : own.wheelReversed) !== null && _b !== void 0 ? _b : _mouseDefault.wheelReversed
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
/*
|
|
1614
|
+
* A scheme this version knows, or Default for one saved by a newer app or mistyped.
|
|
1615
|
+
*/
|
|
1616
|
+
function knownScheme(scheme) {
|
|
1617
|
+
return Object.values(exports.ECameraMouseScheme).includes(scheme) ? scheme : exports.ECameraMouseScheme.Default;
|
|
1618
|
+
}
|
|
1528
1619
|
function restoreCesiumGestures(state) {
|
|
1529
1620
|
const controller = state.viewer.scene.screenSpaceCameraController;
|
|
1530
1621
|
controller.rotateEventTypes = state.saved.rotateEventTypes;
|
|
1531
1622
|
controller.zoomEventTypes = state.saved.zoomEventTypes;
|
|
1532
1623
|
controller.tiltEventTypes = state.saved.tiltEventTypes;
|
|
1624
|
+
if (state.saved.translateEventTypes !== undefined) {
|
|
1625
|
+
controller.translateEventTypes = state.saved.translateEventTypes;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
/*
|
|
1629
|
+
* Gives CesiumJS's controller its own gestures under the mouse scheme, so the buttons do not swap at the hand-over.
|
|
1630
|
+
*/
|
|
1631
|
+
function applyCesiumGestures(state) {
|
|
1632
|
+
restoreCesiumGestures(state);
|
|
1633
|
+
const scheme = mouseOf(state.viewer).scheme;
|
|
1634
|
+
state.cesiumScheme = scheme;
|
|
1635
|
+
if (scheme === exports.ECameraMouseScheme.Default) {
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
const middle = Cesium.CameraEventType.MIDDLE_DRAG;
|
|
1639
|
+
const shiftMiddle = { eventType: middle, modifier: Cesium.KeyboardEventModifier.SHIFT };
|
|
1640
|
+
const tilt = asEventTypes(state.saved.tiltEventTypes);
|
|
1641
|
+
// A host that moved CesiumJS's middle drag elsewhere has its own mapping, which is left alone.
|
|
1642
|
+
if (!tilt.includes(middle)) {
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
// CesiumJS orbits with tilt and pans with rotate in 3D, or translate in 2D and Columbus view.
|
|
1646
|
+
const orbit = scheme === exports.ECameraMouseScheme.Autodesk ? shiftMiddle : middle;
|
|
1647
|
+
const pan = scheme === exports.ECameraMouseScheme.Autodesk ? middle : shiftMiddle;
|
|
1648
|
+
const controller = state.viewer.scene.screenSpaceCameraController;
|
|
1649
|
+
controller.tiltEventTypes = tilt.map((type) => (type === middle ? orbit : type));
|
|
1650
|
+
controller.rotateEventTypes = [...asEventTypes(state.saved.rotateEventTypes), pan];
|
|
1651
|
+
if (state.saved.translateEventTypes !== undefined) {
|
|
1652
|
+
controller.translateEventTypes = [...asEventTypes(state.saved.translateEventTypes), pan];
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
/*
|
|
1656
|
+
* CesiumJS takes one event type or a list of them; this always gives a list.
|
|
1657
|
+
*/
|
|
1658
|
+
function asEventTypes(types) {
|
|
1659
|
+
if (types == null) {
|
|
1660
|
+
return [];
|
|
1661
|
+
}
|
|
1662
|
+
return Array.isArray(types) ? types : [types];
|
|
1533
1663
|
}
|
|
1534
1664
|
/*
|
|
1535
1665
|
* Decides each frame who has the mouse: these controls near the ground, CesiumJS for planets, orthographic and tracking.
|
|
@@ -1541,6 +1671,9 @@ void main()
|
|
|
1541
1671
|
}
|
|
1542
1672
|
const ours = shouldControl(state);
|
|
1543
1673
|
if (ours === state.ours) {
|
|
1674
|
+
if (!ours && state.cesiumScheme !== mouseOf(viewer).scheme) {
|
|
1675
|
+
applyCesiumGestures(state);
|
|
1676
|
+
}
|
|
1544
1677
|
return;
|
|
1545
1678
|
}
|
|
1546
1679
|
state.ours = ours;
|
|
@@ -1551,7 +1684,7 @@ void main()
|
|
|
1551
1684
|
controller.tiltEventTypes = [Cesium.CameraEventType.PINCH];
|
|
1552
1685
|
}
|
|
1553
1686
|
else {
|
|
1554
|
-
|
|
1687
|
+
applyCesiumGestures(state);
|
|
1555
1688
|
}
|
|
1556
1689
|
}
|
|
1557
1690
|
function shouldControl(state) {
|
|
@@ -1588,6 +1721,38 @@ void main()
|
|
|
1588
1721
|
const height = globe.getHeight(carto);
|
|
1589
1722
|
return Number.isFinite(height) ? height : undefined;
|
|
1590
1723
|
}
|
|
1724
|
+
/*
|
|
1725
|
+
* The ground's height at a place: the loaded terrain, or the tileset standing in for a hidden globe.
|
|
1726
|
+
*/
|
|
1727
|
+
function groundHeightAt(state, carto) {
|
|
1728
|
+
var _a;
|
|
1729
|
+
if (globeShown(state)) {
|
|
1730
|
+
return terrainHeightAt(state, carto);
|
|
1731
|
+
}
|
|
1732
|
+
const tileset = scanScene(state).ground;
|
|
1733
|
+
if (!carto || !tileset || ((_a = tileset.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(tileset)) || typeof tileset.getHeight !== "function") {
|
|
1734
|
+
return undefined;
|
|
1735
|
+
}
|
|
1736
|
+
try {
|
|
1737
|
+
// Only tiles drawn this frame answer, which near the camera are the finest loaded.
|
|
1738
|
+
const height = tileset.getHeight(carto, state.viewer.scene);
|
|
1739
|
+
return Number.isFinite(height) && height > GROUND_FLOOR ? height : undefined;
|
|
1740
|
+
}
|
|
1741
|
+
catch (e) {
|
|
1742
|
+
return undefined;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
/*
|
|
1746
|
+
* Whether the ground is still loading: the globe's tiles, or the stand-in tileset's.
|
|
1747
|
+
*/
|
|
1748
|
+
function groundLoading(state) {
|
|
1749
|
+
var _a;
|
|
1750
|
+
if (globeShown(state)) {
|
|
1751
|
+
return state.viewer.scene.globe.tilesLoaded === false;
|
|
1752
|
+
}
|
|
1753
|
+
const tileset = scanScene(state).ground;
|
|
1754
|
+
return Boolean(tileset && !((_a = tileset.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(tileset)) && tileset.tilesLoaded === false);
|
|
1755
|
+
}
|
|
1591
1756
|
function ellipsoidOf(state) {
|
|
1592
1757
|
var _a, _b;
|
|
1593
1758
|
return (_b = (_a = state.viewer.scene.globe) === null || _a === void 0 ? void 0 : _a.ellipsoid) !== null && _b !== void 0 ? _b : Cesium.Ellipsoid.WGS84;
|
|
@@ -1625,8 +1790,8 @@ void main()
|
|
|
1625
1790
|
if (!carto) {
|
|
1626
1791
|
return null;
|
|
1627
1792
|
}
|
|
1628
|
-
// Level with the
|
|
1629
|
-
const surface = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, (_a =
|
|
1793
|
+
// Level with the ground under the camera, not sea level, so a guess over high ground is not far too deep.
|
|
1794
|
+
const surface = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, (_a = groundHeightAt(state, carto)) !== null && _a !== void 0 ? _a : 0, ellipsoid);
|
|
1630
1795
|
return Cesium.Plane.fromPointNormal(surface, ellipsoid.geodeticSurfaceNormal(surface, new Cesium.Cartesian3()));
|
|
1631
1796
|
}
|
|
1632
1797
|
/*
|
|
@@ -1650,6 +1815,15 @@ void main()
|
|
|
1650
1815
|
// Directions around the centre, and how many must hold nearer pixels for the centre to be surrounded.
|
|
1651
1816
|
const GAP_SECTORS = 8;
|
|
1652
1817
|
const GAP_SECTORS_NEAR = 6;
|
|
1818
|
+
// How far around the cursor, in CSS pixels, nearer parts limit a zoom, and the most buffer pixels read.
|
|
1819
|
+
const CLEARANCE_RADIUS_PX = 24;
|
|
1820
|
+
const CLEARANCE_RADIUS_MAX = 64;
|
|
1821
|
+
// The share of that window that must be nearer, so a stray pixel or a thin cable does not slow the zoom.
|
|
1822
|
+
const CLEARANCE_SHARE = 0.05;
|
|
1823
|
+
// A pixel at least this share of the level ground's distance on its ray is ground, and never limits.
|
|
1824
|
+
const CLEARANCE_GROUND = 0.9;
|
|
1825
|
+
// A pan or orbit grabbing this many times farther than the reach grabs at the reach instead.
|
|
1826
|
+
const CLEARANCE_GRAB = 2;
|
|
1653
1827
|
const PACKED_DEPTH = new Cesium.Cartesian4(1, 1 / 255, 1 / 65025, 1 / 16581375);
|
|
1654
1828
|
/*
|
|
1655
1829
|
* Distances along the view axis drawn around a window position, rows bottom-up, Infinity where nothing is drawn.
|
|
@@ -1698,6 +1872,21 @@ void main()
|
|
|
1698
1872
|
}
|
|
1699
1873
|
return distances;
|
|
1700
1874
|
}
|
|
1875
|
+
/*
|
|
1876
|
+
* The depth window around a position for the gap search and the reach, or null when unreadable.
|
|
1877
|
+
*/
|
|
1878
|
+
function readWindow(scene, position) {
|
|
1879
|
+
const scale = scene.drawingBufferWidth / scene.canvas.clientWidth;
|
|
1880
|
+
const clearance = Math.min(Math.round(CLEARANCE_RADIUS_PX * (Number.isFinite(scale) ? scale : 1)), CLEARANCE_RADIUS_MAX);
|
|
1881
|
+
const radius = Math.max(GAP_RADII[GAP_RADII.length - 1], clearance);
|
|
1882
|
+
try {
|
|
1883
|
+
const distances = readDepthDistances(scene, position, radius);
|
|
1884
|
+
return distances ? { distances, radius } : null;
|
|
1885
|
+
}
|
|
1886
|
+
catch (e) {
|
|
1887
|
+
return null;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1701
1890
|
/*
|
|
1702
1891
|
* Offsets of the surface pixel around the centre for each radius where clearly nearer pixels surround it.
|
|
1703
1892
|
*/
|
|
@@ -1735,15 +1924,7 @@ void main()
|
|
|
1735
1924
|
/*
|
|
1736
1925
|
* The point cloud surface around a pick that looked through a gap between its points, or null when it did not.
|
|
1737
1926
|
*/
|
|
1738
|
-
function fillGap(scene, position, picked) {
|
|
1739
|
-
const radius = GAP_RADII[GAP_RADII.length - 1];
|
|
1740
|
-
let distances = null;
|
|
1741
|
-
try {
|
|
1742
|
-
distances = readDepthDistances(scene, position, radius);
|
|
1743
|
-
}
|
|
1744
|
-
catch (e) {
|
|
1745
|
-
return null;
|
|
1746
|
-
}
|
|
1927
|
+
function fillGap(scene, position, picked, distances, radius) {
|
|
1747
1928
|
if (!distances) {
|
|
1748
1929
|
return null;
|
|
1749
1930
|
}
|
|
@@ -1763,9 +1944,80 @@ void main()
|
|
|
1763
1944
|
return null;
|
|
1764
1945
|
}
|
|
1765
1946
|
/*
|
|
1766
|
-
* The
|
|
1947
|
+
* The view-axis distance within which a share of the window around the cursor is drawn, ground aside.
|
|
1948
|
+
*/
|
|
1949
|
+
function NearClearance(distances, radius, groundAt) {
|
|
1950
|
+
const width = 2 * radius + 1;
|
|
1951
|
+
const near = [];
|
|
1952
|
+
for (let dy = -radius; dy <= radius; dy++) {
|
|
1953
|
+
for (let dx = -radius; dx <= radius; dx++) {
|
|
1954
|
+
const distance = distances[(radius + dy) * width + (radius + dx)];
|
|
1955
|
+
if (!Number.isFinite(distance)) {
|
|
1956
|
+
continue;
|
|
1957
|
+
}
|
|
1958
|
+
const ground = groundAt ? groundAt(dx, dy) : Infinity;
|
|
1959
|
+
if (!(ground > 0 && distance >= ground * CLEARANCE_GROUND)) {
|
|
1960
|
+
near.push(distance);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
const needed = Math.max(1, Math.ceil(width * width * CLEARANCE_SHARE));
|
|
1965
|
+
if (near.length < needed) {
|
|
1966
|
+
return Infinity;
|
|
1967
|
+
}
|
|
1968
|
+
near.sort((a, b) => a - b);
|
|
1969
|
+
return near[needed - 1];
|
|
1970
|
+
}
|
|
1971
|
+
/*
|
|
1972
|
+
* The level ground's view-axis distance through each window pixel, or null when there is no ground.
|
|
1973
|
+
*/
|
|
1974
|
+
function groundDistances(state, position) {
|
|
1975
|
+
const scene = state.viewer.scene;
|
|
1976
|
+
const camera = scene.camera;
|
|
1977
|
+
const frustum = camera.frustum;
|
|
1978
|
+
if (!(state.getModelSpaceFrame || hasGround(state)) ||
|
|
1979
|
+
typeof (frustum === null || frustum === void 0 ? void 0 : frustum.getPixelDimensions) !== "function") {
|
|
1980
|
+
return null;
|
|
1981
|
+
}
|
|
1982
|
+
const plane = groundPlane(state);
|
|
1983
|
+
if (!plane) {
|
|
1984
|
+
return null;
|
|
1985
|
+
}
|
|
1986
|
+
const width = scene.drawingBufferWidth;
|
|
1987
|
+
const height = scene.drawingBufferHeight;
|
|
1988
|
+
// The size of one buffer pixel one metre ahead, which turns a pixel offset into a ray direction.
|
|
1989
|
+
const pixel = frustum.getPixelDimensions(width, height, 1, 1, new Cesium.Cartesian2());
|
|
1990
|
+
const above = Cesium.Plane.getPointDistance(plane, camera.positionWC);
|
|
1991
|
+
const normal = plane.normal;
|
|
1992
|
+
const along = Cesium.Cartesian3.dot(camera.directionWC, normal);
|
|
1993
|
+
const right = Cesium.Cartesian3.dot(camera.rightWC, normal);
|
|
1994
|
+
const up = Cesium.Cartesian3.dot(camera.upWC, normal);
|
|
1995
|
+
// The cursor's offset from the centre in buffer pixels, rows bottom-up as the window's are.
|
|
1996
|
+
const x = Math.floor(position.x * width / scene.canvas.clientWidth) + 0.5 - width / 2;
|
|
1997
|
+
const y = height / 2 - Math.floor(position.y * height / scene.canvas.clientHeight) - 0.5;
|
|
1998
|
+
return (dx, dy) => {
|
|
1999
|
+
const rate = along + (x + dx) * pixel.x * right + (y + dy) * pixel.y * up;
|
|
2000
|
+
return rate < 0 ? -above / rate : Infinity;
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
/*
|
|
2004
|
+
* The point under a screen position, and how far a zoom toward it may go before passing parts beside it.
|
|
1767
2005
|
*/
|
|
1768
2006
|
function pickTarget(state, position) {
|
|
2007
|
+
const scene = state.viewer.scene;
|
|
2008
|
+
// Read before anything else picks, while the depth still holds the frame on screen.
|
|
2009
|
+
const depths = scene.pickPositionSupported ? readWindow(scene, position) : null;
|
|
2010
|
+
const target = pickPoint(state, position, depths);
|
|
2011
|
+
if (target && depths) {
|
|
2012
|
+
target.reach = NearClearance(depths.distances, depths.radius, groundDistances(state, position));
|
|
2013
|
+
target.reachFrom = Cesium.Cartesian3.clone(state.viewer.camera.positionWC);
|
|
2014
|
+
}
|
|
2015
|
+
return target;
|
|
2016
|
+
}
|
|
2017
|
+
/*
|
|
2018
|
+
* The point under a screen position: what is drawn there, else the ground plane, else a point at the last distance.
|
|
2019
|
+
*/
|
|
2020
|
+
function pickPoint(state, position, depths) {
|
|
1769
2021
|
const viewer = state.viewer;
|
|
1770
2022
|
const scene = viewer.scene;
|
|
1771
2023
|
const camera = viewer.camera;
|
|
@@ -1790,12 +2042,16 @@ void main()
|
|
|
1790
2042
|
}
|
|
1791
2043
|
const plausible = plausibleDistance(state);
|
|
1792
2044
|
// A click between point cloud points sees the background; turning or zooming about that throws the camera far off.
|
|
1793
|
-
const surface =
|
|
2045
|
+
const surface = depths ? fillGap(scene, position, ahead !== null && ahead !== void 0 ? ahead : null, depths.distances, depths.radius) : null;
|
|
1794
2046
|
if (isAhead(camera, surface) && Cesium.Cartesian3.distance(surface, camera.positionWC) < plausible) {
|
|
1795
2047
|
return { point: surface, source: "pick", ground: false };
|
|
1796
2048
|
}
|
|
1797
2049
|
if (isAhead(camera, picked) && Cesium.Cartesian3.distance(picked, camera.positionWC) < plausible) {
|
|
1798
|
-
|
|
2050
|
+
const ground = isGroundPick(state, position);
|
|
2051
|
+
// Right after a jump a stand-in tileset's coarse tiles cut far under the curve; use sea level.
|
|
2052
|
+
if (!ground || globeShown(state) || heightOf(state, picked) > GROUND_FLOOR) {
|
|
2053
|
+
return { point: picked, source: "pick", ground };
|
|
2054
|
+
}
|
|
1799
2055
|
}
|
|
1800
2056
|
const ground = groundPlane(state);
|
|
1801
2057
|
const onGround = ground ? Cesium.IntersectionTests.rayPlane(ray, ground) : null;
|
|
@@ -1842,9 +2098,18 @@ void main()
|
|
|
1842
2098
|
return Cesium.Cartesian3.dot(toPoint, camera.directionWC) > 0;
|
|
1843
2099
|
}
|
|
1844
2100
|
/*
|
|
1845
|
-
* Picks which gesture a button and its modifiers start
|
|
2101
|
+
* Picks which gesture a button and its modifiers start under the mouse scheme; Default matches CesiumJS's own mapping.
|
|
1846
2102
|
*/
|
|
1847
|
-
function dragKind(e) {
|
|
2103
|
+
function dragKind(e, scheme) {
|
|
2104
|
+
if (scheme === exports.ECameraMouseScheme.Autodesk && e.button === 1) {
|
|
2105
|
+
if (e.shiftKey && e.ctrlKey) {
|
|
2106
|
+
return EDrag.Zoom;
|
|
2107
|
+
}
|
|
2108
|
+
return e.shiftKey ? EDrag.Orbit : EDrag.Pan;
|
|
2109
|
+
}
|
|
2110
|
+
if (scheme === exports.ECameraMouseScheme.SketchUp && e.button === 1) {
|
|
2111
|
+
return e.shiftKey ? EDrag.Pan : EDrag.Orbit;
|
|
2112
|
+
}
|
|
1848
2113
|
if (e.shiftKey) {
|
|
1849
2114
|
// Shift drag looks around, which CesiumJS still handles.
|
|
1850
2115
|
return null;
|
|
@@ -1888,7 +2153,7 @@ void main()
|
|
|
1888
2153
|
return;
|
|
1889
2154
|
}
|
|
1890
2155
|
}
|
|
1891
|
-
const kind = dragKind(e);
|
|
2156
|
+
const kind = dragKind(e, mouseOf(viewer).scheme);
|
|
1892
2157
|
if (!kind || !allows(state, kind)) {
|
|
1893
2158
|
return;
|
|
1894
2159
|
}
|
|
@@ -1897,8 +2162,8 @@ void main()
|
|
|
1897
2162
|
if (!picked) {
|
|
1898
2163
|
return;
|
|
1899
2164
|
}
|
|
1900
|
-
const target = picked.point;
|
|
1901
2165
|
const camera = viewer.camera;
|
|
2166
|
+
const target = kind === EDrag.Zoom ? picked.point : GrabPoint(camera, position, picked);
|
|
1902
2167
|
const distance = Cesium.Cartesian3.distance(camera.positionWC, target);
|
|
1903
2168
|
state.lastDistance = Math.max(distance, MIN_ZOOM_DISTANCE);
|
|
1904
2169
|
const drag = { kind, pointerId: e.pointerId, last: position, target, up: upAt(state, target), distance, picked };
|
|
@@ -1906,10 +2171,28 @@ void main()
|
|
|
1906
2171
|
drag.plane = panPlane(camera, target, drag.up);
|
|
1907
2172
|
}
|
|
1908
2173
|
else if (kind === EDrag.Zoom) {
|
|
2174
|
+
holdSurface(state);
|
|
1909
2175
|
drag.direction = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(target, camera.positionWC, new Cesium.Cartesian3()), new Cesium.Cartesian3());
|
|
1910
2176
|
}
|
|
1911
2177
|
state.drag = drag;
|
|
1912
2178
|
}
|
|
2179
|
+
/*
|
|
2180
|
+
* Where a pan or orbit takes hold: the pick, or beside the cursor when it looked far past parts there.
|
|
2181
|
+
*/
|
|
2182
|
+
function GrabPoint(camera, position, picked) {
|
|
2183
|
+
const reach = picked.reach;
|
|
2184
|
+
const ray = camera.getPickRay(position);
|
|
2185
|
+
if (!ray || reach == null || !Number.isFinite(reach)) {
|
|
2186
|
+
return picked.point;
|
|
2187
|
+
}
|
|
2188
|
+
const facing = Cesium.Cartesian3.dot(ray.direction, camera.directionWC);
|
|
2189
|
+
const depth = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(picked.point, camera.positionWC, new Cesium.Cartesian3()), camera.directionWC);
|
|
2190
|
+
if (facing <= 0 || depth <= reach * CLEARANCE_GRAB) {
|
|
2191
|
+
return picked.point;
|
|
2192
|
+
}
|
|
2193
|
+
// The reach is along the view axis, so the ray goes a little further to the same depth.
|
|
2194
|
+
return Cesium.Ray.getPoint(ray, Math.max(reach, MIN_ZOOM_DISTANCE) / facing);
|
|
2195
|
+
}
|
|
1913
2196
|
/*
|
|
1914
2197
|
* A level plane through the grabbed point, or one facing the camera when the level one is seen edge on.
|
|
1915
2198
|
*/
|
|
@@ -2058,6 +2341,7 @@ void main()
|
|
|
2058
2341
|
if (!target || !ray) {
|
|
2059
2342
|
return;
|
|
2060
2343
|
}
|
|
2344
|
+
holdSurface(state);
|
|
2061
2345
|
const step = zoomStep(state, ray.direction, target, notches);
|
|
2062
2346
|
Cesium.Cartesian3.add(state.pendingZoom, step, state.pendingZoom);
|
|
2063
2347
|
state.zoomPosition = Cesium.Cartesian3.clone(camera.position);
|
|
@@ -2065,6 +2349,37 @@ void main()
|
|
|
2065
2349
|
state.zoomFrame = requestAnimationFrame(() => easeZoom(state));
|
|
2066
2350
|
}
|
|
2067
2351
|
}
|
|
2352
|
+
/*
|
|
2353
|
+
* Swaps a wheel event over the scene for one turned round, so wheel forward zooms out when the user asked for that.
|
|
2354
|
+
*/
|
|
2355
|
+
function mirrorWheel(state, e) {
|
|
2356
|
+
const viewer = state.viewer;
|
|
2357
|
+
const canvas = viewer.isDestroyed() ? null : viewer.scene.canvas;
|
|
2358
|
+
if (!canvas || e.target !== canvas || e[MIRRORED_WHEEL_KEY] || !mouseOf(viewer).wheelReversed) {
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
e.stopImmediatePropagation();
|
|
2362
|
+
e.preventDefault();
|
|
2363
|
+
const mirrored = new WheelEvent("wheel", {
|
|
2364
|
+
bubbles: true,
|
|
2365
|
+
cancelable: true,
|
|
2366
|
+
clientX: e.clientX,
|
|
2367
|
+
clientY: e.clientY,
|
|
2368
|
+
screenX: e.screenX,
|
|
2369
|
+
screenY: e.screenY,
|
|
2370
|
+
ctrlKey: e.ctrlKey,
|
|
2371
|
+
shiftKey: e.shiftKey,
|
|
2372
|
+
altKey: e.altKey,
|
|
2373
|
+
metaKey: e.metaKey,
|
|
2374
|
+
buttons: e.buttons,
|
|
2375
|
+
deltaMode: e.deltaMode,
|
|
2376
|
+
deltaX: e.deltaX,
|
|
2377
|
+
deltaY: -e.deltaY,
|
|
2378
|
+
deltaZ: e.deltaZ
|
|
2379
|
+
});
|
|
2380
|
+
mirrored[MIRRORED_WHEEL_KEY] = true;
|
|
2381
|
+
canvas.dispatchEvent(mirrored);
|
|
2382
|
+
}
|
|
2068
2383
|
/*
|
|
2069
2384
|
* Applies part of the outstanding wheel movement each frame, so a notch glides rather than jumps.
|
|
2070
2385
|
*/
|
|
@@ -2086,6 +2401,8 @@ void main()
|
|
|
2086
2401
|
const step = Cesium.Cartesian3.multiplyByScalar(state.pendingZoom, share, new Cesium.Cartesian3());
|
|
2087
2402
|
Cesium.Cartesian3.subtract(state.pendingZoom, step, state.pendingZoom);
|
|
2088
2403
|
Cesium.Cartesian3.add(viewer.camera.position, step, viewer.camera.position);
|
|
2404
|
+
zoomMoved(state);
|
|
2405
|
+
keepAboveGround(state);
|
|
2089
2406
|
state.zoomPosition = Cesium.Cartesian3.clone(viewer.camera.position);
|
|
2090
2407
|
viewer.scene.requestRender();
|
|
2091
2408
|
if (share < 1) {
|
|
@@ -2095,6 +2412,7 @@ void main()
|
|
|
2095
2412
|
function moveAlong(state, direction, target, notches) {
|
|
2096
2413
|
const step = zoomStep(state, direction, target, notches);
|
|
2097
2414
|
Cesium.Cartesian3.add(state.viewer.camera.position, step, state.viewer.camera.position);
|
|
2415
|
+
zoomMoved(state);
|
|
2098
2416
|
}
|
|
2099
2417
|
/*
|
|
2100
2418
|
* The move for some notches toward a target along a direction, a share of the distance with a floor so it never stalls.
|
|
@@ -2104,7 +2422,14 @@ void main()
|
|
|
2104
2422
|
const target = picked.point;
|
|
2105
2423
|
// Where the camera will be once the glide already under way ends, which this step continues from.
|
|
2106
2424
|
const from = Cesium.Cartesian3.add(camera.positionWC, state.pendingZoom, new Cesium.Cartesian3());
|
|
2107
|
-
const
|
|
2425
|
+
const unit = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3());
|
|
2426
|
+
let distance = Cesium.Cartesian3.distance(from, target);
|
|
2427
|
+
// Between parts of a model, each step goes as far as it would on the nearest part around the cursor.
|
|
2428
|
+
if (picked.reach != null && picked.reachFrom) {
|
|
2429
|
+
const travelled = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(from, picked.reachFrom, new Cesium.Cartesian3()), unit);
|
|
2430
|
+
distance = Math.min(distance, picked.reach - travelled);
|
|
2431
|
+
}
|
|
2432
|
+
distance = Math.max(distance, MIN_ZOOM_DISTANCE);
|
|
2108
2433
|
state.lastDistance = distance;
|
|
2109
2434
|
let length = distance * ZOOM_SHARE * notches * zoomSpeedShare(state, picked);
|
|
2110
2435
|
// A geospatial camera zooming out hands over to CesiumJS once it is high enough, so only model-space is capped.
|
|
@@ -2116,7 +2441,6 @@ void main()
|
|
|
2116
2441
|
return new Cesium.Cartesian3();
|
|
2117
2442
|
}
|
|
2118
2443
|
}
|
|
2119
|
-
const unit = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3());
|
|
2120
2444
|
// With the globe hidden there is no hand-over, so zooming out stops where the Earth is a dot.
|
|
2121
2445
|
if (length < 0 && !state.getModelSpaceFrame && !globeShown(state)) {
|
|
2122
2446
|
const rise = -Cesium.Cartesian3.dot(unit, upAt(state, from));
|
|
@@ -2132,15 +2456,14 @@ void main()
|
|
|
2132
2456
|
return length > 0 ? resistDescent(state, from, step, picked, notches) : step;
|
|
2133
2457
|
}
|
|
2134
2458
|
/*
|
|
2135
|
-
* How fast to zoom toward a target: slower toward a guess, or while the
|
|
2459
|
+
* How fast to zoom toward a target: slower toward a guess, or while the ground that would give a real one loads.
|
|
2136
2460
|
*/
|
|
2137
2461
|
function zoomSpeedShare(state, picked) {
|
|
2138
2462
|
let share = 1;
|
|
2139
2463
|
if (picked.source !== "pick") {
|
|
2140
2464
|
share *= ZOOM_GUESS_SHARE;
|
|
2141
2465
|
}
|
|
2142
|
-
|
|
2143
|
-
if (!state.getModelSpaceFrame && globeShown(state) && globe.tilesLoaded === false) {
|
|
2466
|
+
if (!state.getModelSpaceFrame && groundLoading(state)) {
|
|
2144
2467
|
share *= ZOOM_LOADING_SHARE;
|
|
2145
2468
|
}
|
|
2146
2469
|
return share;
|
|
@@ -2156,16 +2479,17 @@ void main()
|
|
|
2156
2479
|
if (picked === null || picked === void 0 ? void 0 : picked.ground) {
|
|
2157
2480
|
return { point: picked.point, up: upAt(state, picked.point) };
|
|
2158
2481
|
}
|
|
2159
|
-
if (!globeShown(state)) {
|
|
2160
|
-
return null;
|
|
2161
|
-
}
|
|
2162
2482
|
const ellipsoid = ellipsoidOf(state);
|
|
2163
2483
|
const end = Cesium.Cartesian3.add(from, step, new Cesium.Cartesian3());
|
|
2164
2484
|
const carto = ellipsoid.cartesianToCartographic(end);
|
|
2165
2485
|
if (!carto) {
|
|
2166
2486
|
return null;
|
|
2167
2487
|
}
|
|
2168
|
-
|
|
2488
|
+
// Unloaded terrain counts as sea level; an unknown stand-in tileset counts as nothing.
|
|
2489
|
+
const height = (_b = (_a = groundHeightAt(state, carto)) !== null && _a !== void 0 ? _a : groundHeightAt(state, ellipsoid.cartesianToCartographic(from))) !== null && _b !== void 0 ? _b : (globeShown(state) ? 0 : null);
|
|
2490
|
+
if (height == null) {
|
|
2491
|
+
return null;
|
|
2492
|
+
}
|
|
2169
2493
|
const point = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, height, ellipsoid);
|
|
2170
2494
|
return { point, up: ellipsoid.geodeticSurfaceNormal(point, new Cesium.Cartesian3()) };
|
|
2171
2495
|
}
|
|
@@ -2215,12 +2539,77 @@ void main()
|
|
|
2215
2539
|
const needed = scanScene(state).undergroundData ? PUSH_NOTCHES_DATA_BELOW : PUSH_NOTCHES_NOTHING_BELOW;
|
|
2216
2540
|
if (state.push.notches >= needed) {
|
|
2217
2541
|
state.push.notches = 0;
|
|
2542
|
+
state.surface = { above: false, through: true, until: now + SURFACE_HOLD_MS, at: null };
|
|
2218
2543
|
// A shallow push would land far along the ground to get under it, so it goes no further than a usual step.
|
|
2219
2544
|
const through = Math.min((above + GROUND_BREAK_DEPTH) / sink, Math.max(length, (above + GROUND_BREAK_DEPTH) * 4));
|
|
2220
2545
|
return Cesium.Cartesian3.multiplyByScalar(unit, through, new Cesium.Cartesian3());
|
|
2221
2546
|
}
|
|
2222
2547
|
return Cesium.Cartesian3.multiplyByScalar(unit, toStandOff, new Cesium.Cartesian3());
|
|
2223
2548
|
}
|
|
2549
|
+
/*
|
|
2550
|
+
* The camera's height above the loaded ground under it, or undefined without ground or in model-space.
|
|
2551
|
+
*/
|
|
2552
|
+
function heightAboveGround(state) {
|
|
2553
|
+
if (state.getModelSpaceFrame || !hasGround(state)) {
|
|
2554
|
+
return undefined;
|
|
2555
|
+
}
|
|
2556
|
+
const carto = ellipsoidOf(state).cartesianToCartographic(state.viewer.camera.positionWC);
|
|
2557
|
+
const ground = carto ? groundHeightAt(state, carto) : undefined;
|
|
2558
|
+
return ground == null ? undefined : carto.height - ground;
|
|
2559
|
+
}
|
|
2560
|
+
/*
|
|
2561
|
+
* Notes whether the camera is above the ground as a zoom begins, unless it is being pushed through it.
|
|
2562
|
+
*/
|
|
2563
|
+
function holdSurface(state) {
|
|
2564
|
+
var _a;
|
|
2565
|
+
const now = Date.now();
|
|
2566
|
+
if (state.surface.through && now < state.surface.until) {
|
|
2567
|
+
return;
|
|
2568
|
+
}
|
|
2569
|
+
const at = Cesium.Cartesian3.clone(state.viewer.camera.positionWC);
|
|
2570
|
+
// Ground not loaded yet counts as sea level, as it does for a descent.
|
|
2571
|
+
const above = (_a = heightAboveGround(state)) !== null && _a !== void 0 ? _a : (hasGround(state) && !state.getModelSpaceFrame ? heightOf(state, at) : undefined);
|
|
2572
|
+
state.surface = { above: above != null && above > 0, through: false, until: now + SURFACE_HOLD_MS, at };
|
|
2573
|
+
}
|
|
2574
|
+
/*
|
|
2575
|
+
* Lifts a camera a zoom kept above the ground back over finer ground that loads in higher.
|
|
2576
|
+
*/
|
|
2577
|
+
function keepAboveGround(state) {
|
|
2578
|
+
const surface = state.surface;
|
|
2579
|
+
const now = Date.now();
|
|
2580
|
+
if (!surface.above || !state.ours || now > surface.until + SURFACE_LOADING_MS) {
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
// Ground that has finished loading does not move under a still camera.
|
|
2584
|
+
if (now > surface.until && !groundLoading(state)) {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
const camera = state.viewer.camera;
|
|
2588
|
+
// A bookmark, fly-to or pan moved it since, which may mean to go below the ground.
|
|
2589
|
+
if (!surface.at || !Cesium.Cartesian3.equalsEpsilon(camera.positionWC, surface.at, 0, 1e-3)) {
|
|
2590
|
+
surface.above = false;
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
const above = heightAboveGround(state);
|
|
2594
|
+
if (above == null || above >= GROUND_STANDOFF / 2) {
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
const ellipsoid = ellipsoidOf(state);
|
|
2598
|
+
const carto = ellipsoid.cartesianToCartographic(camera.positionWC);
|
|
2599
|
+
Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height - above + GROUND_STANDOFF, ellipsoid, camera.position);
|
|
2600
|
+
// What is left of the glide would take it straight back down.
|
|
2601
|
+
state.pendingZoom = new Cesium.Cartesian3();
|
|
2602
|
+
surface.at = Cesium.Cartesian3.clone(camera.position);
|
|
2603
|
+
state.viewer.scene.requestRender();
|
|
2604
|
+
}
|
|
2605
|
+
/*
|
|
2606
|
+
* Notes where a zoom just put the camera, so the ground hold can tell its moves from others.
|
|
2607
|
+
*/
|
|
2608
|
+
function zoomMoved(state) {
|
|
2609
|
+
if (state.surface.at) {
|
|
2610
|
+
Cesium.Cartesian3.clone(state.viewer.camera.positionWC, state.surface.at);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2224
2613
|
/*
|
|
2225
2614
|
* What the scene holds that the camera cares about, rescanned at most every couple of seconds.
|
|
2226
2615
|
*/
|
|
@@ -2231,7 +2620,7 @@ void main()
|
|
|
2231
2620
|
return applyOverride(state, state.scan);
|
|
2232
2621
|
}
|
|
2233
2622
|
const scene = state.viewer.scene;
|
|
2234
|
-
const found = { at: now, undergroundData: false, groundTileset: false };
|
|
2623
|
+
const found = { at: now, undergroundData: false, groundTileset: false, ground: null };
|
|
2235
2624
|
// Seeing through the ground is turned on to look at what is under it.
|
|
2236
2625
|
if ((_b = (_a = scene.globe) === null || _a === void 0 ? void 0 : _a.translucency) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
2237
2626
|
found.undergroundData = true;
|
|
@@ -2248,6 +2637,7 @@ void main()
|
|
|
2248
2637
|
}
|
|
2249
2638
|
if (primitive[GROUND_TILESET_KEY]) {
|
|
2250
2639
|
found.groundTileset = true;
|
|
2640
|
+
found.ground = primitive;
|
|
2251
2641
|
return;
|
|
2252
2642
|
}
|
|
2253
2643
|
if (!found.undergroundData && reachesBelowGround(state, lowestPointOf(primitive))) {
|
|
@@ -61924,7 +62314,7 @@ void main() {
|
|
|
61924
62314
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
61925
62315
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
61926
62316
|
|
|
61927
|
-
const VERSION = "7.9.
|
|
62317
|
+
const VERSION = "7.9.5";
|
|
61928
62318
|
/**
|
|
61929
62319
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
61930
62320
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|
|
@@ -61966,6 +62356,8 @@ void main() {
|
|
|
61966
62356
|
exports.LIGHT_INTENSITY_COMPENSATION = LIGHT_INTENSITY_COMPENSATION;
|
|
61967
62357
|
exports.MAX_COMPENSATED_LIGHT_INTENSITY = MAX_COMPENSATED_LIGHT_INTENSITY;
|
|
61968
62358
|
exports.FindGapSurfaces = FindGapSurfaces;
|
|
62359
|
+
exports.NearClearance = NearClearance;
|
|
62360
|
+
exports.GrabPoint = GrabPoint;
|
|
61969
62361
|
exports.Draw3dPolygon = Draw3dPolygon;
|
|
61970
62362
|
exports.Draw3dPolyline = Draw3dPolyline;
|
|
61971
62363
|
exports.WidgetControlViewBarSearch = WidgetControlViewBarSearch;
|