@cesium/engine 22.1.0 → 22.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-YZWA5B4R.js → chunk-2MLJ46ZZ.js} +13 -13
- package/Build/Workers/{chunk-GKWOUMYA.js → chunk-4BBANFU6.js} +1 -1
- package/Build/Workers/{chunk-23T2IPHV.js → chunk-4O2ARYS7.js} +1 -1
- package/Build/Workers/{chunk-RXZDTDIY.js → chunk-4R6FGUFP.js} +9 -9
- package/Build/Workers/{chunk-UG2DPFOL.js → chunk-5PJB7ASO.js} +6 -6
- package/Build/Workers/{chunk-JKXPC5HD.js → chunk-6GBGEUWR.js} +3 -3
- package/Build/Workers/{chunk-YF2NVO5B.js → chunk-6WDMPXQ7.js} +12 -12
- package/Build/Workers/{chunk-B7JRBTT6.js → chunk-7ATKQRBM.js} +10 -10
- package/Build/Workers/{chunk-TDSVSW5A.js → chunk-7SLNBIZS.js} +5 -34
- package/Build/Workers/{chunk-2RCIRXNI.js → chunk-7U5YNLF3.js} +1 -1
- package/Build/Workers/{chunk-GTY4K4IA.js → chunk-AFGP5BXS.js} +7 -7
- package/Build/Workers/{chunk-WTLYD4FE.js → chunk-AWELU5C6.js} +14 -14
- package/Build/Workers/{chunk-IL5F6WEE.js → chunk-BO22JHBX.js} +3 -3
- package/Build/Workers/{chunk-YX562XOB.js → chunk-D2PEV362.js} +10 -10
- package/Build/Workers/{chunk-MKMZHRB3.js → chunk-D63Z7KKL.js} +11 -11
- package/Build/Workers/{chunk-P5CGIJUY.js → chunk-D6OKR3BQ.js} +2 -2
- package/Build/Workers/{chunk-GDU4RZSZ.js → chunk-E4YDCSQK.js} +9 -9
- package/Build/Workers/{chunk-KKGD7HAW.js → chunk-EAAH543Q.js} +11 -11
- package/Build/Workers/{chunk-I4REFVXB.js → chunk-EOSX23OS.js} +4 -4
- package/Build/Workers/{chunk-V35NQOJC.js → chunk-EUDHHS7K.js} +6 -6
- package/Build/Workers/{chunk-OXFU5HNU.js → chunk-EY5HOJFQ.js} +5 -5
- package/Build/Workers/{chunk-DMEFNTUV.js → chunk-FDOLXORR.js} +7 -7
- package/Build/Workers/{chunk-QEANVUGT.js → chunk-FS42VX2H.js} +2 -2
- package/Build/Workers/{chunk-L4JLDVCM.js → chunk-FUDC3KOT.js} +5 -5
- package/Build/Workers/{chunk-LIYMRHGR.js → chunk-HWGP4GVC.js} +13 -13
- package/Build/Workers/{chunk-KROSQJUA.js → chunk-IHFAFGR2.js} +2 -2
- package/Build/Workers/{chunk-SPA2KPH3.js → chunk-IXL46IYV.js} +12 -12
- package/Build/Workers/{chunk-A6YFUGJO.js → chunk-K2PLKJJG.js} +5 -5
- package/Build/Workers/{chunk-CW7W27IZ.js → chunk-K4PGSAR5.js} +8 -8
- package/Build/Workers/{chunk-DICY26ID.js → chunk-KIJR26N3.js} +16 -16
- package/Build/Workers/{chunk-YSYSXSHF.js → chunk-L4OFWHNI.js} +1 -1
- package/Build/Workers/{chunk-2AM4E2WD.js → chunk-LK7GEFGB.js} +2 -2
- package/Build/Workers/{chunk-W4XUEDU5.js → chunk-LWZHJWYK.js} +6 -6
- package/Build/Workers/{chunk-3YTMGEXW.js → chunk-LYBNPUEI.js} +4 -4
- package/Build/Workers/{chunk-4BHWJWS3.js → chunk-M5DVYXJJ.js} +6 -6
- package/Build/Workers/{chunk-COGPE5Z2.js → chunk-MASEF4OV.js} +8 -8
- package/Build/Workers/{chunk-QUAH3XOT.js → chunk-N66PIK46.js} +4 -4
- package/Build/Workers/{chunk-H6Q7E4BQ.js → chunk-N6XBJBI7.js} +6 -6
- package/Build/Workers/{chunk-Y4ALZ4SS.js → chunk-NO3LMU7T.js} +7 -7
- package/Build/Workers/{chunk-MO25ZQ2I.js → chunk-NVL7JXAQ.js} +10 -10
- package/Build/Workers/{chunk-DQSJEOZY.js → chunk-OOYICVOK.js} +1 -1
- package/Build/Workers/{chunk-CJOV55CW.js → chunk-PJLRXIMS.js} +17 -17
- package/Build/Workers/{chunk-AOIO5VUS.js → chunk-S2KVL7OJ.js} +8 -8
- package/Build/Workers/{chunk-URGEDZBS.js → chunk-T5MJDW43.js} +7 -7
- package/Build/Workers/{chunk-OOCGX2OD.js → chunk-TCOUGKXF.js} +4 -4
- package/Build/Workers/{chunk-A53R2F2L.js → chunk-TMGLPEZW.js} +4 -4
- package/Build/Workers/{chunk-6HKAPCSO.js → chunk-TY5JXMVO.js} +1 -1
- package/Build/Workers/{chunk-2MWF4IES.js → chunk-VIQIKMTZ.js} +14 -14
- package/Build/Workers/{chunk-5JKH4AMT.js → chunk-VRAAQ3FS.js} +2 -2
- package/Build/Workers/{chunk-CHNDJRYA.js → chunk-W5NV72VR.js} +17 -17
- package/Build/Workers/{chunk-HXKUEOOD.js → chunk-WHLGBMBC.js} +5 -5
- package/Build/Workers/{chunk-QFBCIX7J.js → chunk-WUWPKBOZ.js} +6 -6
- package/Build/Workers/{chunk-Z6DFT4D3.js → chunk-XLIJV3YZ.js} +10 -10
- package/Build/Workers/{chunk-WB4TSSBQ.js → chunk-Y5MRBKQN.js} +144 -53
- package/Build/Workers/{chunk-HHGOFZVQ.js → chunk-YHPBT4I5.js} +5 -5
- package/Build/Workers/{chunk-O6RZEKHZ.js → chunk-ZGGVEGTA.js} +12 -12
- package/Build/Workers/{chunk-AJYWXC6I.js → chunk-ZWWN2CQH.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/BoxGeometry.js +1 -1
- package/Source/Core/CornerType.js +1 -1
- package/Source/Core/CorridorGeometry.js +1 -1
- package/Source/Core/FeatureDetection.js +1 -32
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/IntersectionTests.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PinBuilder.js +1 -1
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometry.js +1 -1
- package/Source/Core/RectangleGeometry.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +4 -8
- package/Source/Core/TerrainMesh.js +11 -8
- package/Source/Core/TerrainPicker.js +24 -7
- package/Source/Core/VideoSynchronizer.js +1 -1
- package/Source/Core/WallGeometry.js +1 -1
- package/Source/Core/writeTextToCanvas.js +40 -86
- package/Source/DataSources/BillboardGraphics.js +1 -1
- package/Source/DataSources/BoxGraphics.js +1 -1
- package/Source/DataSources/CallbackPositionProperty.js +1 -1
- package/Source/DataSources/CorridorGraphics.js +1 -1
- package/Source/DataSources/CzmlDataSource.js +1 -1
- package/Source/DataSources/EllipseGraphics.js +1 -1
- package/Source/DataSources/EllipsoidGraphics.js +1 -1
- package/Source/DataSources/Entity.js +1 -1
- package/Source/DataSources/EntityCluster.js +2 -2
- package/Source/DataSources/GeoJsonDataSource.js +2 -2
- package/Source/DataSources/GpxDataSource.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -1
- package/Source/DataSources/KmlTour.js +1 -1
- package/Source/DataSources/LabelGraphics.js +1 -1
- package/Source/DataSources/ModelGraphics.js +1 -1
- package/Source/DataSources/PlaneGraphics.js +1 -1
- package/Source/DataSources/PolygonGraphics.js +1 -1
- package/Source/DataSources/PolylineGraphics.js +1 -1
- package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
- package/Source/DataSources/RectangleGraphics.js +1 -1
- package/Source/DataSources/WallGraphics.js +1 -1
- package/Source/DataSources/exportKml.js +1 -1
- package/Source/Renderer/Context.js +11 -10
- package/Source/Renderer/ContextLimits.js +66 -33
- package/Source/Renderer/ShaderSource.js +19 -18
- package/Source/Renderer/Texture.js +1 -1
- package/Source/Renderer/Texture3D.js +166 -7
- package/Source/Renderer/TextureAtlas.js +10 -19
- package/Source/Scene/Appearance.js +1 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +7 -8
- package/Source/Scene/Billboard.js +1 -1
- package/Source/Scene/BillboardCollection.js +15 -1
- package/Source/Scene/BillboardTexture.js +4 -1
- package/Source/Scene/Camera.js +13 -2
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/CloudCollection.js +2 -2
- package/Source/Scene/CumulusCloud.js +1 -1
- package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
- package/Source/Scene/Fog.js +1 -1
- package/Source/Scene/GaussianSplatPrimitive.js +1 -1
- package/Source/Scene/Globe.js +3 -10
- package/Source/Scene/GltfLoader.js +10 -0
- package/Source/Scene/ImageBasedLighting.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +2 -2
- package/Source/Scene/ImageryProvider.js +2 -2
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Material.js +1 -1
- package/Source/Scene/MaterialAppearance.js +1 -1
- package/Source/Scene/Megatexture.js +174 -242
- package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/ParticleSystem.js +2 -2
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/Polyline.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -4
- package/Source/Scene/PolylineColorAppearance.js +1 -6
- package/Source/Scene/PolylineMaterialAppearance.js +1 -6
- package/Source/Scene/PostProcessStageCollection.js +1 -1
- package/Source/Scene/QuadtreePrimitive.js +6 -3
- package/Source/Scene/ShadowMap.js +1 -2
- package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
- package/Source/Scene/Vector3DTilePolylines.js +1 -5
- package/Source/Scene/VoxelPrimitive.js +16 -33
- package/Source/Scene/VoxelRenderResources.js +1 -8
- package/Source/Scene/VoxelTraversal.js +16 -61
- package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/processVoxelProperties.js +1 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
- package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
- package/Source/Shaders/Model/ModelFS.glsl +8 -0
- package/Source/Shaders/Model/ModelFS.js +8 -0
- package/Source/Shaders/Model/ModelVS.glsl +2 -0
- package/Source/Shaders/Model/ModelVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
- package/Source/Shaders/Voxels/Megatexture.js +15 -83
- package/Source/Shaders/Voxels/Octree.glsl +6 -9
- package/Source/Shaders/Voxels/Octree.js +6 -9
- package/Source/Widget/CesiumWidget.js +1 -1
- package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
- package/index.d.ts +32 -21
- package/index.js +52 -52
- package/package.json +4 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 1.
|
|
4
|
+
* Version 1.138.0
|
|
5
5
|
*
|
|
6
6
|
* Copyright 2011-2022 Cesium Contributors
|
|
7
7
|
*
|
|
@@ -25,32 +25,32 @@
|
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
Cesium3DTilesTerrainGeometryProcessor_default
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-Y5MRBKQN.js";
|
|
29
|
+
import "./chunk-WHLGBMBC.js";
|
|
30
|
+
import "./chunk-D63Z7KKL.js";
|
|
31
31
|
import {
|
|
32
32
|
createTaskProcessorWorker_default
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-LK7GEFGB.js";
|
|
34
|
+
import "./chunk-N6XBJBI7.js";
|
|
35
|
+
import "./chunk-6WDMPXQ7.js";
|
|
36
|
+
import "./chunk-4R6FGUFP.js";
|
|
37
|
+
import "./chunk-XLIJV3YZ.js";
|
|
38
|
+
import "./chunk-EY5HOJFQ.js";
|
|
39
|
+
import "./chunk-FDOLXORR.js";
|
|
40
|
+
import "./chunk-M5DVYXJJ.js";
|
|
41
|
+
import "./chunk-K2PLKJJG.js";
|
|
42
|
+
import "./chunk-E4YDCSQK.js";
|
|
43
|
+
import "./chunk-4O2ARYS7.js";
|
|
44
|
+
import "./chunk-S2KVL7OJ.js";
|
|
45
|
+
import "./chunk-LWZHJWYK.js";
|
|
46
|
+
import "./chunk-EOSX23OS.js";
|
|
47
|
+
import "./chunk-L4OFWHNI.js";
|
|
48
|
+
import "./chunk-VRAAQ3FS.js";
|
|
49
|
+
import "./chunk-7SLNBIZS.js";
|
|
50
|
+
import "./chunk-LYBNPUEI.js";
|
|
51
|
+
import "./chunk-BO22JHBX.js";
|
|
52
|
+
import "./chunk-FS42VX2H.js";
|
|
53
|
+
import "./chunk-7U5YNLF3.js";
|
|
54
54
|
|
|
55
55
|
// packages/engine/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js
|
|
56
56
|
function upsampleVerticesFromCesium3DTilesTerrain(options, transferableObjects) {
|
|
@@ -29,7 +29,7 @@ const diffScratch = new Cartesian3();
|
|
|
29
29
|
* @see BoxGeometry.createGeometry
|
|
30
30
|
* @see Packable
|
|
31
31
|
*
|
|
32
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
32
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=box|Cesium Sandcastle Box Demo}
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* const box = new Cesium.BoxGeometry({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Style options for corners.
|
|
3
3
|
*
|
|
4
|
-
* @demo The {@link https://sandcastle.cesium.com/index.html?
|
|
4
|
+
* @demo The {@link https://sandcastle.cesium.com/index.html?id=corridor|Corridor Demo}
|
|
5
5
|
* demonstrates the three corner types, as used by {@link CorridorGraphics}.
|
|
6
6
|
*
|
|
7
7
|
* @enum {number}
|
|
@@ -1060,7 +1060,7 @@ function computeRectangle(positions, ellipsoid, width, cornerType, result) {
|
|
|
1060
1060
|
* @see CorridorGeometry.createGeometry
|
|
1061
1061
|
* @see Packable
|
|
1062
1062
|
*
|
|
1063
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
1063
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=corridor|Cesium Sandcastle Corridor Demo}
|
|
1064
1064
|
*
|
|
1065
1065
|
* @example
|
|
1066
1066
|
* const corridor = new Cesium.CorridorGeometry({
|
|
@@ -88,36 +88,6 @@ function webkitVersion() {
|
|
|
88
88
|
return isWebkit() && webkitVersionResult;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
let isInternetExplorerResult;
|
|
92
|
-
let internetExplorerVersionResult;
|
|
93
|
-
function isInternetExplorer() {
|
|
94
|
-
if (!defined(isInternetExplorerResult)) {
|
|
95
|
-
isInternetExplorerResult = false;
|
|
96
|
-
|
|
97
|
-
let fields;
|
|
98
|
-
if (theNavigator.appName === "Microsoft Internet Explorer") {
|
|
99
|
-
fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent);
|
|
100
|
-
if (fields !== null) {
|
|
101
|
-
isInternetExplorerResult = true;
|
|
102
|
-
internetExplorerVersionResult = extractVersion(fields[1]);
|
|
103
|
-
}
|
|
104
|
-
} else if (theNavigator.appName === "Netscape") {
|
|
105
|
-
fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(
|
|
106
|
-
theNavigator.userAgent,
|
|
107
|
-
);
|
|
108
|
-
if (fields !== null) {
|
|
109
|
-
isInternetExplorerResult = true;
|
|
110
|
-
internetExplorerVersionResult = extractVersion(fields[1]);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return isInternetExplorerResult;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function internetExplorerVersion() {
|
|
118
|
-
return isInternetExplorer() && internetExplorerVersionResult;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
91
|
let isEdgeResult;
|
|
122
92
|
let edgeVersionResult;
|
|
123
93
|
function isEdge() {
|
|
@@ -303,8 +273,7 @@ const FeatureDetection = {
|
|
|
303
273
|
safariVersion: safariVersion,
|
|
304
274
|
isWebkit: isWebkit,
|
|
305
275
|
webkitVersion: webkitVersion,
|
|
306
|
-
|
|
307
|
-
internetExplorerVersion: internetExplorerVersion,
|
|
276
|
+
|
|
308
277
|
isEdge: isEdge,
|
|
309
278
|
edgeVersion: edgeVersion,
|
|
310
279
|
isFirefox: isFirefox,
|
package/Source/Core/Geometry.js
CHANGED
|
@@ -41,7 +41,7 @@ import Transforms from "./Transforms.js";
|
|
|
41
41
|
* @see BoxGeometry
|
|
42
42
|
* @see EllipsoidGeometry
|
|
43
43
|
*
|
|
44
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
44
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=geometry-and-appearances|Geometry and Appearances Demo}
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* // Create geometry with a position attribute and indexed lines.
|
|
@@ -67,7 +67,7 @@ const scratchQVec = new Cartesian3();
|
|
|
67
67
|
/**
|
|
68
68
|
* Computes the intersection of a ray and a triangle as a parametric distance along the input ray. The result is negative when the triangle is behind the ray.
|
|
69
69
|
*
|
|
70
|
-
* Implements {@link https://cadxfem.org/inf/Fast
|
|
70
|
+
* Implements {@link https://cadxfem.org/inf/Fast MinimumStorage RayTriangle Intersection.pdf|
|
|
71
71
|
* Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
|
|
72
72
|
*
|
|
73
73
|
* @memberof IntersectionTests
|
|
@@ -167,7 +167,7 @@ IntersectionTests.rayTriangleParametric = function (
|
|
|
167
167
|
/**
|
|
168
168
|
* Computes the intersection of a ray and a triangle as a Cartesian3 coordinate.
|
|
169
169
|
*
|
|
170
|
-
* Implements {@link https://cadxfem.org/inf/Fast
|
|
170
|
+
* Implements {@link https://cadxfem.org/inf/Fast MinimumStorage RayTriangle Intersection.pdf|
|
|
171
171
|
* Fast Minimum Storage Ray/Triangle Intersection} by Tomas Moller and Ben Trumbore.
|
|
172
172
|
*
|
|
173
173
|
* @memberof IntersectionTests
|
package/Source/Core/Ion.js
CHANGED
|
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
7
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZWVkZjhjNC01NjdhLTQwNTctOTExMy02MThlYjIxM2U4OTkiLCJpZCI6MjU5LCJpYXQiOjE3NzAwNTUxOTV9.aJTRjsRlsJwPC0Nfcq4xscYc2lPJcGFku_PVxp1ZPyQ";
|
|
8
8
|
/**
|
|
9
9
|
* Default settings for accessing the Cesium ion API.
|
|
10
10
|
*
|
|
@@ -16,7 +16,7 @@ import writeTextToCanvas from "./writeTextToCanvas.js";
|
|
|
16
16
|
* @alias PinBuilder
|
|
17
17
|
* @constructor
|
|
18
18
|
*
|
|
19
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
19
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=map-pins|Cesium Sandcastle PinBuilder Demo}
|
|
20
20
|
*/
|
|
21
21
|
function PinBuilder() {
|
|
22
22
|
this._cache = {};
|
|
@@ -596,7 +596,7 @@ function createGeometryFromPositionsExtruded(
|
|
|
596
596
|
* @see PolygonGeometry#createGeometry
|
|
597
597
|
* @see PolygonGeometry#fromPositions
|
|
598
598
|
*
|
|
599
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
599
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=polygon|Cesium Sandcastle Polygon Demo}
|
|
600
600
|
*
|
|
601
601
|
* @example
|
|
602
602
|
* // 1. create a polygon from points
|
|
@@ -83,7 +83,7 @@ function interpolateColors(p0, p1, color0, color1, numPoints) {
|
|
|
83
83
|
*
|
|
84
84
|
* @see PolylineGeometry#createGeometry
|
|
85
85
|
*
|
|
86
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
86
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=polyline|Cesium Sandcastle Polyline Demo}
|
|
87
87
|
*
|
|
88
88
|
* @example
|
|
89
89
|
* // A polyline with two connected line segments
|
|
@@ -185,7 +185,7 @@ function computeAttributes(
|
|
|
185
185
|
*
|
|
186
186
|
* @see PolylineVolumeGeometry#createGeometry
|
|
187
187
|
*
|
|
188
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
188
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=polyline-volume|Cesium Sandcastle Polyline Volume Demo}
|
|
189
189
|
*
|
|
190
190
|
* @example
|
|
191
191
|
* function computeCircle(radius) {
|
|
@@ -993,7 +993,7 @@ function computeRectangle(rectangle, granularity, rotation, ellipsoid, result) {
|
|
|
993
993
|
*
|
|
994
994
|
* @see RectangleGeometry#createGeometry
|
|
995
995
|
*
|
|
996
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
996
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=rectangle|Cesium Sandcastle Rectangle Demo}
|
|
997
997
|
*
|
|
998
998
|
* @example
|
|
999
999
|
* // 1. create a rectangle
|
|
@@ -53,14 +53,10 @@ function registerListener(screenSpaceEventHandler, domType, element, callback) {
|
|
|
53
53
|
callback(screenSpaceEventHandler, e);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
capture: false,
|
|
61
|
-
passive: false,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
56
|
+
element.addEventListener(domType, listener, {
|
|
57
|
+
capture: false,
|
|
58
|
+
passive: false,
|
|
59
|
+
});
|
|
64
60
|
|
|
65
61
|
screenSpaceEventHandler._removalFunctions.push(function () {
|
|
66
62
|
element.removeEventListener(domType, listener, false);
|
|
@@ -179,10 +179,10 @@ function TerrainMesh(
|
|
|
179
179
|
this._transform = new Matrix4();
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
183
|
-
* @type {
|
|
182
|
+
* The scene mode used the last time a pick was performed on this terrain mesh.
|
|
183
|
+
* @type {SceneMode}
|
|
184
184
|
*/
|
|
185
|
-
this.
|
|
185
|
+
this._lastPickSceneMode = undefined;
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
188
|
* The terrain picker for this mesh, used for ray intersection tests.
|
|
@@ -199,10 +199,10 @@ function TerrainMesh(
|
|
|
199
199
|
* @private
|
|
200
200
|
*/
|
|
201
201
|
TerrainMesh.prototype.getTransform = function (mode, projection) {
|
|
202
|
-
if (
|
|
202
|
+
if (this._lastPickSceneMode === mode) {
|
|
203
203
|
return this._transform;
|
|
204
204
|
}
|
|
205
|
-
this.
|
|
205
|
+
this._terrainPicker.needsRebuild = true;
|
|
206
206
|
|
|
207
207
|
if (!defined(mode) || mode === SceneMode.SCENE3D) {
|
|
208
208
|
return computeTransform(this, this._transform);
|
|
@@ -322,13 +322,16 @@ function computeTransform2D(mesh, projection, result) {
|
|
|
322
322
|
* @private
|
|
323
323
|
*/
|
|
324
324
|
TerrainMesh.prototype.pick = function (ray, cullBackFaces, mode, projection) {
|
|
325
|
-
|
|
325
|
+
const intersection = this._terrainPicker.rayIntersect(
|
|
326
326
|
ray,
|
|
327
327
|
this.getTransform(mode, projection),
|
|
328
328
|
cullBackFaces,
|
|
329
329
|
mode,
|
|
330
330
|
projection,
|
|
331
331
|
);
|
|
332
|
+
|
|
333
|
+
this._lastPickSceneMode = mode;
|
|
334
|
+
return intersection;
|
|
332
335
|
};
|
|
333
336
|
|
|
334
337
|
/**
|
|
@@ -345,7 +348,7 @@ TerrainMesh.prototype.updateExaggeration = function (
|
|
|
345
348
|
// to trigger a rebuild on the terrain picker.
|
|
346
349
|
this._terrainPicker._vertices = this.vertices;
|
|
347
350
|
this._terrainPicker.needsRebuild = true;
|
|
348
|
-
this.
|
|
351
|
+
this._lastPickSceneMode = undefined;
|
|
349
352
|
};
|
|
350
353
|
|
|
351
354
|
/**
|
|
@@ -355,7 +358,7 @@ TerrainMesh.prototype.updateExaggeration = function (
|
|
|
355
358
|
*/
|
|
356
359
|
TerrainMesh.prototype.updateSceneMode = function (mode) {
|
|
357
360
|
this._terrainPicker.needsRebuild = true;
|
|
358
|
-
this.
|
|
361
|
+
this._lastPickSceneMode = undefined;
|
|
359
362
|
};
|
|
360
363
|
|
|
361
364
|
export default TerrainMesh;
|
|
@@ -10,6 +10,7 @@ import SceneMode from "../Scene/SceneMode.js";
|
|
|
10
10
|
import Interval from "./Interval.js";
|
|
11
11
|
import Check from "./Check.js";
|
|
12
12
|
import DeveloperError from "./DeveloperError.js";
|
|
13
|
+
import CesiumMath from "./Math.js";
|
|
13
14
|
|
|
14
15
|
// Terrain picker can be 4 levels deep (0-3)
|
|
15
16
|
const MAXIMUM_TERRAIN_PICKER_LEVEL = 3;
|
|
@@ -20,7 +21,7 @@ const MAXIMUM_TERRAIN_PICKER_LEVEL = 3;
|
|
|
20
21
|
* @alias TerrainPicker
|
|
21
22
|
* @constructor
|
|
22
23
|
*
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {Float64Array} vertices The terrain mesh's vertex buffer.
|
|
24
25
|
* @param {Uint8Array|Uint16Array|Uint32Array} indices The terrain mesh's index buffer.
|
|
25
26
|
* @param {TerrainEncoding} encoding The terrain mesh's vertex encoding.
|
|
26
27
|
*
|
|
@@ -35,7 +36,7 @@ function TerrainPicker(vertices, indices, encoding) {
|
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* The terrain mesh's vertex buffer.
|
|
38
|
-
* @type {
|
|
39
|
+
* @type {Float64Array}
|
|
39
40
|
*/
|
|
40
41
|
this._vertices = vertices;
|
|
41
42
|
/**
|
|
@@ -268,7 +269,7 @@ function createAABBForNode(x, y, level) {
|
|
|
268
269
|
/**
|
|
269
270
|
* Packs triangle vertex positions and index into provided buffers, for the worker to process.
|
|
270
271
|
* (The worker does tests to organize triangles into child nodes of the quadtree.)
|
|
271
|
-
* @param {
|
|
272
|
+
* @param {Float64Array} trianglePositionsBuffer The buffer to pack triangle vertex positions into.
|
|
272
273
|
* @param {Uint32Array} triangleIndicesBuffer The buffer to pack triangle indices into.
|
|
273
274
|
* @param {Cartesian3[]} trianglePositions The triangle's vertex positions.
|
|
274
275
|
* @param {number} triangleIndex The triangle's index in the overall tile's index buffer.
|
|
@@ -424,7 +425,7 @@ function getClosestTriangleInNode(
|
|
|
424
425
|
let triangleIndices;
|
|
425
426
|
if (shouldBuildChildren) {
|
|
426
427
|
// If the tree can be built deeper, prepare buffers to store triangle data for child nodes
|
|
427
|
-
trianglePositions = new
|
|
428
|
+
trianglePositions = new Float64Array(triangleCount * 9); // 3 vertices per triangle * 3 floats per vertex
|
|
428
429
|
triangleIndices = new Uint32Array(triangleCount);
|
|
429
430
|
}
|
|
430
431
|
|
|
@@ -434,6 +435,7 @@ function getClosestTriangleInNode(
|
|
|
434
435
|
encoding,
|
|
435
436
|
mode,
|
|
436
437
|
projection,
|
|
438
|
+
ray,
|
|
437
439
|
vertices,
|
|
438
440
|
indices[3 * triIndex],
|
|
439
441
|
scratchTrianglePoints[0],
|
|
@@ -442,6 +444,7 @@ function getClosestTriangleInNode(
|
|
|
442
444
|
encoding,
|
|
443
445
|
mode,
|
|
444
446
|
projection,
|
|
447
|
+
ray,
|
|
445
448
|
vertices,
|
|
446
449
|
indices[3 * triIndex + 1],
|
|
447
450
|
scratchTrianglePoints[1],
|
|
@@ -450,6 +453,7 @@ function getClosestTriangleInNode(
|
|
|
450
453
|
encoding,
|
|
451
454
|
mode,
|
|
452
455
|
projection,
|
|
456
|
+
ray,
|
|
453
457
|
vertices,
|
|
454
458
|
indices[3 * triIndex + 2],
|
|
455
459
|
scratchTrianglePoints[2],
|
|
@@ -502,7 +506,8 @@ const scratchCartographic = new Cartographic();
|
|
|
502
506
|
* @param {TerrainEncoding} encoding The terrain encoding.
|
|
503
507
|
* @param {SceneMode} mode The scene mode (2D/3D/Columbus View).
|
|
504
508
|
* @param {MapProjection} projection The map projection.
|
|
505
|
-
* @param {
|
|
509
|
+
* @param {Ray} ray The pick ray being tested (used here as a reference to resolve antimeridian wrapping in 2D/Columbus View).
|
|
510
|
+
* @param {Float64Array} vertices The terrain mesh's vertex buffer.
|
|
506
511
|
* @param {Number} index The index of the vertex to get.
|
|
507
512
|
* @param {Cartesian3} result The decoded, exaggerated, and possibly projected vertex position.
|
|
508
513
|
* @returns {Cartesian3} The result vertex position.
|
|
@@ -512,6 +517,7 @@ function getVertexPosition(
|
|
|
512
517
|
encoding,
|
|
513
518
|
mode,
|
|
514
519
|
projection,
|
|
520
|
+
ray,
|
|
515
521
|
vertices,
|
|
516
522
|
index,
|
|
517
523
|
result,
|
|
@@ -535,6 +541,14 @@ function getVertexPosition(
|
|
|
535
541
|
result,
|
|
536
542
|
);
|
|
537
543
|
|
|
544
|
+
// Due to wrapping in 2D/CV modes, near the antimeridian, the vertex
|
|
545
|
+
// position may correspond to the other side of the world from the ray origin.
|
|
546
|
+
// Compare the vertex position to the ray origin and adjust it accordingly.
|
|
547
|
+
// A spherical approximation is sufficient for cylindrical projections,
|
|
548
|
+
// like mercator and geographic.
|
|
549
|
+
const worldWidth = CesiumMath.TWO_PI * projection.ellipsoid.maximumRadius;
|
|
550
|
+
const k = Math.round((ray.origin.y - position.y) / worldWidth);
|
|
551
|
+
position.y += k * worldWidth;
|
|
538
552
|
return position;
|
|
539
553
|
}
|
|
540
554
|
|
|
@@ -544,7 +558,7 @@ function getVertexPosition(
|
|
|
544
558
|
* @param {Matrix4} inverseTransform
|
|
545
559
|
* @param {TerrainNode} node
|
|
546
560
|
* @param {Uint32Array} triangleIndices
|
|
547
|
-
* @param {
|
|
561
|
+
* @param {Float64Array} trianglePositions
|
|
548
562
|
* @returns {Promise<void>} A promise that resolves when the triangles have been added to the child nodes.
|
|
549
563
|
* @private
|
|
550
564
|
*/
|
|
@@ -596,7 +610,10 @@ async function addTrianglesToChildrenNodes(
|
|
|
596
610
|
// Assign these to the child nodes
|
|
597
611
|
const result = await incrementallyBuildTerrainPickerPromise;
|
|
598
612
|
result.intersectingTrianglesArrays.forEach((buffer, index) => {
|
|
599
|
-
|
|
613
|
+
// Guard against case where tree is reset while waiting for worker
|
|
614
|
+
if (defined(node.children[index])) {
|
|
615
|
+
node.children[index].intersectingTriangles = new Uint32Array(buffer);
|
|
616
|
+
}
|
|
600
617
|
});
|
|
601
618
|
|
|
602
619
|
// The node's triangles have been distributed to its children
|
|
@@ -16,7 +16,7 @@ import JulianDate from "./JulianDate.js";
|
|
|
16
16
|
* @param {JulianDate} [options.epoch=Iso8601.MINIMUM_VALUE] The simulation time that marks the start of the video.
|
|
17
17
|
* @param {number} [options.tolerance=1.0] The maximum amount of time, in seconds, that the clock and video can diverge.
|
|
18
18
|
*
|
|
19
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
19
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=video|Video Material Demo}
|
|
20
20
|
*/
|
|
21
21
|
function VideoSynchronizer(options) {
|
|
22
22
|
options = options ?? Frozen.EMPTY_OBJECT;
|
|
@@ -46,7 +46,7 @@ const scratchNormal = new Cartesian3();
|
|
|
46
46
|
* @see WallGeometry#createGeometry
|
|
47
47
|
* @see WallGeometry#fromConstantHeight
|
|
48
48
|
*
|
|
49
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
49
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=wall|Cesium Sandcastle Wall Demo}
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* // create a wall that spans from ground level to 10000 meters
|
|
@@ -3,95 +3,41 @@ import Frozen from "./Frozen.js";
|
|
|
3
3
|
import defined from "./defined.js";
|
|
4
4
|
import DeveloperError from "./DeveloperError.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Computes dimensions for text, based on current canvas state.
|
|
8
|
+
*
|
|
9
|
+
* Rounds metrics, excluding width, to whole pixels. This is purely to minimize
|
|
10
|
+
* rendering differences with migration to in-browser measureText(), and may be
|
|
11
|
+
* revised in the future. See: github.com/CesiumGS/cesium/pull/13081
|
|
12
|
+
*/
|
|
13
|
+
function measureText(context2D, textString) {
|
|
7
14
|
const metrics = context2D.measureText(textString);
|
|
8
15
|
const isSpace = !/\S/.test(textString);
|
|
9
16
|
|
|
10
|
-
if (
|
|
11
|
-
const fontSize = document.defaultView
|
|
12
|
-
.getComputedStyle(context2D.canvas)
|
|
13
|
-
.getPropertyValue("font-size")
|
|
14
|
-
.replace("px", "");
|
|
15
|
-
const canvas = document.createElement("canvas");
|
|
16
|
-
const padding = 100;
|
|
17
|
-
const width = (metrics.width + padding) | 0;
|
|
18
|
-
const height = 3 * fontSize;
|
|
19
|
-
const baseline = height / 2;
|
|
20
|
-
canvas.width = width;
|
|
21
|
-
canvas.height = height;
|
|
22
|
-
|
|
23
|
-
const ctx = canvas.getContext("2d");
|
|
24
|
-
ctx.font = font;
|
|
25
|
-
ctx.fillStyle = "white";
|
|
26
|
-
ctx.fillRect(0, 0, canvas.width + 1, canvas.height + 1);
|
|
27
|
-
|
|
28
|
-
if (stroke) {
|
|
29
|
-
ctx.strokeStyle = "black";
|
|
30
|
-
ctx.lineWidth = context2D.lineWidth;
|
|
31
|
-
ctx.strokeText(textString, padding / 2, baseline);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (fill) {
|
|
35
|
-
ctx.fillStyle = "black";
|
|
36
|
-
ctx.fillText(textString, padding / 2, baseline);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Context image data has width * height * 4 elements, because
|
|
40
|
-
// each pixel's R, G, B and A are consecutive values in the array.
|
|
41
|
-
const pixelData = ctx.getImageData(0, 0, width, height).data;
|
|
42
|
-
const length = pixelData.length;
|
|
43
|
-
const width4 = width * 4;
|
|
44
|
-
let i, j;
|
|
45
|
-
|
|
46
|
-
let ascent, descent;
|
|
47
|
-
// Find the number of rows (from the top) until the first non-white pixel
|
|
48
|
-
for (i = 0; i < length; ++i) {
|
|
49
|
-
if (pixelData[i] !== 255) {
|
|
50
|
-
ascent = (i / width4) | 0;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Find the number of rows (from the bottom) until the first non-white pixel
|
|
56
|
-
for (i = length - 1; i >= 0; --i) {
|
|
57
|
-
if (pixelData[i] !== 255) {
|
|
58
|
-
descent = (i / width4) | 0;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let minx = -1;
|
|
64
|
-
// For each column, for each row, check for first non-white pixel
|
|
65
|
-
for (i = 0; i < width && minx === -1; ++i) {
|
|
66
|
-
for (j = 0; j < height; ++j) {
|
|
67
|
-
const pixelIndex = i * 4 + j * width4;
|
|
68
|
-
if (
|
|
69
|
-
pixelData[pixelIndex] !== 255 ||
|
|
70
|
-
pixelData[pixelIndex + 1] !== 255 ||
|
|
71
|
-
pixelData[pixelIndex + 2] !== 255 ||
|
|
72
|
-
pixelData[pixelIndex + 3] !== 255
|
|
73
|
-
) {
|
|
74
|
-
minx = i;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
17
|
+
if (isSpace) {
|
|
80
18
|
return {
|
|
81
19
|
width: metrics.width,
|
|
82
|
-
height:
|
|
83
|
-
ascent:
|
|
84
|
-
descent:
|
|
85
|
-
minx:
|
|
20
|
+
height: 0,
|
|
21
|
+
ascent: 0,
|
|
22
|
+
descent: 0,
|
|
23
|
+
minx: 0,
|
|
86
24
|
};
|
|
87
25
|
}
|
|
88
26
|
|
|
27
|
+
// Baseline alignment requires `height = ascent + descent`. Rounding (if any)
|
|
28
|
+
// must be done before summing, or glyph pairs like "ij" may be misaligned.
|
|
29
|
+
const ascent = Math.round(metrics.actualBoundingBoxAscent);
|
|
30
|
+
const descent = Math.round(metrics.actualBoundingBoxDescent);
|
|
31
|
+
|
|
32
|
+
// Characters like "_" may have height <0.5 at some sizes, don't round to zero.
|
|
33
|
+
const height = Math.max(ascent + descent, 1);
|
|
34
|
+
|
|
89
35
|
return {
|
|
90
36
|
width: metrics.width,
|
|
91
|
-
height
|
|
92
|
-
ascent
|
|
93
|
-
descent
|
|
94
|
-
minx:
|
|
37
|
+
height,
|
|
38
|
+
ascent,
|
|
39
|
+
descent,
|
|
40
|
+
minx: -Math.round(metrics.actualBoundingBoxLeft),
|
|
95
41
|
};
|
|
96
42
|
}
|
|
97
43
|
|
|
@@ -164,28 +110,36 @@ function writeTextToCanvas(text, options) {
|
|
|
164
110
|
canvas.style.visibility = "hidden";
|
|
165
111
|
document.body.appendChild(canvas);
|
|
166
112
|
|
|
167
|
-
const dimensions = measureText(context2D, text
|
|
168
|
-
|
|
113
|
+
const dimensions = measureText(context2D, text);
|
|
114
|
+
|
|
115
|
+
// Set canvas.dimensions to be accessed in LabelCollection. LabelCollection
|
|
116
|
+
// hard-codes strokeWidth=0, so dimensions should not include stroke padding.
|
|
169
117
|
canvas.dimensions = dimensions;
|
|
170
118
|
|
|
171
119
|
document.body.removeChild(canvas);
|
|
172
120
|
canvas.style.visibility = "";
|
|
173
121
|
|
|
122
|
+
// measureText does not account for stroke width, added here. LabelCollection
|
|
123
|
+
// calls writeTextToCanvas with hard-coded strokeWidth=0, so stroke padding
|
|
124
|
+
// matters only when calling `writeTextToCanvas` directly.
|
|
125
|
+
const isSpace = !/\S/.test(text);
|
|
126
|
+
const strokePadding = stroke && !isSpace ? Math.ceil(strokeWidth / 2) : 0;
|
|
127
|
+
const doubleStrokePadding = strokePadding * 2;
|
|
128
|
+
|
|
174
129
|
// Some characters, such as the letter j, have a non-zero starting position.
|
|
175
130
|
// This value is used for kerning later, but we need to take it into account
|
|
176
131
|
// now in order to draw the text completely on the canvas
|
|
177
|
-
const x = -dimensions.minx;
|
|
132
|
+
const x = -dimensions.minx + strokePadding;
|
|
178
133
|
|
|
179
134
|
// Expand the width to include the starting position.
|
|
180
|
-
const width = Math.ceil(dimensions.width) + x + doublePadding;
|
|
135
|
+
const width = Math.ceil(dimensions.width) + x + doublePadding + strokePadding;
|
|
181
136
|
|
|
182
137
|
// While the height of the letter is correct, we need to adjust
|
|
183
138
|
// where we start drawing it so that letters like j and y properly dip
|
|
184
139
|
// below the line.
|
|
185
140
|
|
|
186
|
-
const height = dimensions.height + doublePadding;
|
|
187
|
-
const
|
|
188
|
-
const y = height - baseline + doublePadding;
|
|
141
|
+
const height = dimensions.height + doublePadding + doubleStrokePadding;
|
|
142
|
+
const y = dimensions.ascent + padding + strokePadding;
|
|
189
143
|
|
|
190
144
|
canvas.width = width;
|
|
191
145
|
canvas.height = height;
|
|
@@ -46,7 +46,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
|
|
|
46
46
|
*
|
|
47
47
|
* @param {BillboardGraphics.ConstructorOptions} [options] Object describing initialization options
|
|
48
48
|
*
|
|
49
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
49
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=billboards|Cesium Sandcastle Billboard Demo}
|
|
50
50
|
*/
|
|
51
51
|
function BillboardGraphics(options) {
|
|
52
52
|
this._definitionChanged = new Event();
|
|
@@ -31,7 +31,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
|
|
|
31
31
|
*
|
|
32
32
|
* @param {BoxGraphics.ConstructorOptions} [options] Object describing initialization options
|
|
33
33
|
*
|
|
34
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
34
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=box|Cesium Sandcastle Box Demo}
|
|
35
35
|
*/
|
|
36
36
|
function BoxGraphics(options) {
|
|
37
37
|
this._definitionChanged = new Event();
|
|
@@ -15,7 +15,7 @@ import PositionProperty from "./PositionProperty.js";
|
|
|
15
15
|
* @param {boolean} isConstant <code>true</code> when the callback function returns the same value every time, <code>false</code> if the value will change.
|
|
16
16
|
* @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined.
|
|
17
17
|
*
|
|
18
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
18
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=callback-position-property|Cesium Sandcastle Callback Position Property Demo}
|
|
19
19
|
*/
|
|
20
20
|
function CallbackPositionProperty(callback, isConstant, referenceFrame) {
|
|
21
21
|
this._callback = undefined;
|
|
@@ -41,7 +41,7 @@ import createPropertyDescriptor from "./createPropertyDescriptor.js";
|
|
|
41
41
|
* @param {CorridorGraphics.ConstructorOptions} [options] Object describing initialization options
|
|
42
42
|
*
|
|
43
43
|
* @see Entity
|
|
44
|
-
* @demo {@link https://sandcastle.cesium.com/index.html?
|
|
44
|
+
* @demo {@link https://sandcastle.cesium.com/index.html?id=corridor|Cesium Sandcastle Corridor Demo}
|
|
45
45
|
*/
|
|
46
46
|
function CorridorGraphics(options) {
|
|
47
47
|
this._definitionChanged = new Event();
|