cesium-xs-sdk 1.0.17 → 1.0.19
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/cesium-xs-sdk.cjs.js +289 -24
- package/dist/cesium-xs-sdk.cjs.js.map +1 -1
- package/dist/cesium-xs-sdk.esm.js +289 -24
- package/dist/cesium-xs-sdk.esm.js.map +1 -1
- package/dist/cesium-xs-sdk.umd.js +1 -1
- package/dist/cesium-xs-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/controls/LocationBar.js +7 -10
- package/src/controls/Zoom.js +259 -14
- package/src/index.d.ts +6 -0
- package/src/modules/EditorModule.js +6 -0
- package/src/modules/SceneModule.js +18 -0
|
@@ -845,6 +845,24 @@ class SceneModule {
|
|
|
845
845
|
}
|
|
846
846
|
});
|
|
847
847
|
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* 是否开启南北极轴约束
|
|
851
|
+
* 开启时(Cesium 默认行为)鼠标旋转/缩放无法让相机越过南北极点;
|
|
852
|
+
* 关闭时(viewer.camera.constrainedAxis = undefined)相机可穿越极点。
|
|
853
|
+
* @param {boolean} [enabled=true] true 开启约束,false 关闭约束
|
|
854
|
+
*/
|
|
855
|
+
setPolarAxisConstraint(enabled = true) {
|
|
856
|
+
this.viewer.camera.constrainedAxis = enabled ? Cesium$h.Cartesian3.UNIT_Z : undefined;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* 查询南北极轴约束是否开启
|
|
861
|
+
* @returns {boolean} true 已开启(相机不可穿越极点),false 已关闭
|
|
862
|
+
*/
|
|
863
|
+
isPolarAxisConstraintEnabled() {
|
|
864
|
+
return Cesium$h.defined(this.viewer.camera.constrainedAxis);
|
|
865
|
+
}
|
|
848
866
|
}
|
|
849
867
|
|
|
850
868
|
const Cesium$g = getCesium();
|
|
@@ -9088,6 +9106,9 @@ class EditorModule {
|
|
|
9088
9106
|
this.currentToolName = name;
|
|
9089
9107
|
this.currentTool.activate();
|
|
9090
9108
|
this._isActive = true;
|
|
9109
|
+
// 供其他组件(如 Zoom 双击缩放)感知"编辑器工具激活中",
|
|
9110
|
+
// 工具激活期间双击/右键有工具自身语义,缩放等全局交互应让行
|
|
9111
|
+
this.viewer.xs3dEditorActive = true;
|
|
9091
9112
|
|
|
9092
9113
|
console.log(`工具 ${name} 已激活`);
|
|
9093
9114
|
return this;
|
|
@@ -9104,6 +9125,9 @@ class EditorModule {
|
|
|
9104
9125
|
this.currentTool = null;
|
|
9105
9126
|
this.currentToolName = null;
|
|
9106
9127
|
this._isActive = false;
|
|
9128
|
+
if (this.viewer) {
|
|
9129
|
+
this.viewer.xs3dEditorActive = false;
|
|
9130
|
+
}
|
|
9107
9131
|
|
|
9108
9132
|
return this;
|
|
9109
9133
|
}
|
|
@@ -9734,10 +9758,13 @@ class LocationBar extends BaseControl {
|
|
|
9734
9758
|
// 鼠标移动:更新鼠标位置信息
|
|
9735
9759
|
const canvas = this._viewer.scene.canvas;
|
|
9736
9760
|
this._addDomEvent(canvas, 'mousemove', this._onMouseMove.bind(this));
|
|
9737
|
-
|
|
9761
|
+
// 鼠标移出画布不再重置为 '-':保留最后拾取的坐标(见 _onMouseMove 说明)
|
|
9738
9762
|
|
|
9739
9763
|
// 相机变化:更新方向/俯仰/视高/层级
|
|
9740
9764
|
this._addCesiumHandler(this._viewer.camera.changed, this._onCameraChanged.bind(this));
|
|
9765
|
+
// flyTo 动画尾段每帧位移小于 percentageChanged 阈值后 changed 不再触发,
|
|
9766
|
+
// 信息栏会滞后一级;相机停止移动时强制刷新一次
|
|
9767
|
+
this._addCesiumHandler(this._viewer.camera.moveEnd, this._onCameraChanged.bind(this));
|
|
9741
9768
|
|
|
9742
9769
|
// FPS
|
|
9743
9770
|
if (this._showFPS) {
|
|
@@ -9776,16 +9803,10 @@ class LocationBar extends BaseControl {
|
|
|
9776
9803
|
lat: Cesium$6.Math.toDegrees(cartographic.latitude).toFixed(this._latDecimal),
|
|
9777
9804
|
alt: cartographic.height.toFixed(2)
|
|
9778
9805
|
};
|
|
9779
|
-
|
|
9780
|
-
this._lastMouseData = { lng: '-', lat: '-', alt: '-' };
|
|
9806
|
+
this._updateContent();
|
|
9781
9807
|
}
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
}
|
|
9785
|
-
|
|
9786
|
-
_onMouseLeave() {
|
|
9787
|
-
this._lastMouseData = { lng: '-', lat: '-', alt: '-' };
|
|
9788
|
-
this._updateContent();
|
|
9808
|
+
// 拾取不到(鼠标指向太空/地球未加载等)时不刷新,
|
|
9809
|
+
// 保留最后一次成功拾取的坐标,避免信息栏闪现"-"
|
|
9789
9810
|
}
|
|
9790
9811
|
|
|
9791
9812
|
_onCameraChanged() {
|
|
@@ -9867,6 +9888,8 @@ class Zoom extends BaseControl {
|
|
|
9867
9888
|
/**
|
|
9868
9889
|
* @param {object} options
|
|
9869
9890
|
* @param {number} [options.duration=0.5] 缩放动画时长(秒)
|
|
9891
|
+
* @param {boolean} [options.doubleClickZoomIn=false] 左键双击放大一级(桌面端)
|
|
9892
|
+
* @param {boolean} [options.doubleClickZoomOut=false] 右键双击缩小一级(桌面端)
|
|
9870
9893
|
*/
|
|
9871
9894
|
constructor(options = {}) {
|
|
9872
9895
|
super({
|
|
@@ -9875,6 +9898,19 @@ class Zoom extends BaseControl {
|
|
|
9875
9898
|
});
|
|
9876
9899
|
|
|
9877
9900
|
this._duration = options.duration ?? 0.5;
|
|
9901
|
+
// 本控件发起的缩放飞行目标层级;飞行进行中(含动画尾段)点击按钮时,
|
|
9902
|
+
// 以它而不是相机瞬时位置作为基准层级
|
|
9903
|
+
this._pendingLevel = null;
|
|
9904
|
+
// 双击缩放(默认关闭;开启后会替换 Cesium Viewer 默认的左键双击动作)
|
|
9905
|
+
this._doubleClickZoomIn = options.doubleClickZoomIn ?? false;
|
|
9906
|
+
this._doubleClickZoomOut = options.doubleClickZoomOut ?? false;
|
|
9907
|
+
this._doubleClickEnabled = this._doubleClickZoomIn || this._doubleClickZoomOut;
|
|
9908
|
+
this._doubleClickInstalled = false;
|
|
9909
|
+
this._savedDoubleClickActions = null;
|
|
9910
|
+
// 右键双击判定器:Cesium 的 RIGHT_DOUBLE_CLICK 在桌面端没有任何触发源
|
|
9911
|
+
// (ScreenSpaceEventHandler 的 dblclick 监听只映射左键),
|
|
9912
|
+
// 因此右键双击在 RIGHT_CLICK 流水上自维护(复用工具的 DoubleClickDetector)
|
|
9913
|
+
this._rightDoubleClickDetector = new DoubleClickDetector();
|
|
9878
9914
|
}
|
|
9879
9915
|
|
|
9880
9916
|
_createContainer() {
|
|
@@ -9935,42 +9971,242 @@ class Zoom extends BaseControl {
|
|
|
9935
9971
|
e.stopPropagation();
|
|
9936
9972
|
this._zoomOut();
|
|
9937
9973
|
});
|
|
9974
|
+
|
|
9975
|
+
// 双击缩放注册到 viewer.screenSpaceEventHandler(而不是 DOM 事件):
|
|
9976
|
+
// 绘制/量测工具激活时会保存-移除-恢复当前的左键双击动作,
|
|
9977
|
+
// 注册在这里可以让工具自动接管,无需额外协调
|
|
9978
|
+
if (this._doubleClickEnabled) {
|
|
9979
|
+
this._installDoubleClickZoom();
|
|
9980
|
+
}
|
|
9938
9981
|
}
|
|
9939
9982
|
|
|
9940
|
-
|
|
9941
|
-
|
|
9983
|
+
/**
|
|
9984
|
+
* 开启双击缩放(运行期可随时调用,只切换内部开关,不重建事件)
|
|
9985
|
+
* 若初始化时未指定任何方向(两个选项均 false),默认只开左键双击放大
|
|
9986
|
+
* @returns {Zoom}
|
|
9987
|
+
*/
|
|
9988
|
+
enableDoubleClickZoom() {
|
|
9989
|
+
this._doubleClickEnabled = true;
|
|
9990
|
+
if (!this._doubleClickZoomIn && !this._doubleClickZoomOut) {
|
|
9991
|
+
this._doubleClickZoomIn = true;
|
|
9992
|
+
}
|
|
9993
|
+
// 初始化时未安装过(选项均为 false)则补注册;
|
|
9994
|
+
// 编辑器工具激活期间不抢占工具的左键双击,等工具结束恢复动作后即可用
|
|
9995
|
+
if (!this._doubleClickInstalled && this._viewer && !this._viewer.xs3dEditorActive) {
|
|
9996
|
+
this._installDoubleClickZoom();
|
|
9997
|
+
}
|
|
9998
|
+
return this;
|
|
9942
9999
|
}
|
|
9943
10000
|
|
|
9944
|
-
|
|
9945
|
-
|
|
10001
|
+
/**
|
|
10002
|
+
* 关闭双击缩放(运行期可随时调用;放大/缩小按钮不受影响)
|
|
10003
|
+
* @returns {Zoom}
|
|
10004
|
+
*/
|
|
10005
|
+
disableDoubleClickZoom() {
|
|
10006
|
+
this._doubleClickEnabled = false;
|
|
10007
|
+
return this;
|
|
9946
10008
|
}
|
|
9947
10009
|
|
|
9948
10010
|
/**
|
|
9949
|
-
*
|
|
9950
|
-
*
|
|
10011
|
+
* 安装左键双击 / 右键双击缩放的输入动作,并保存被替换的原始动作供移除时恢复。
|
|
10012
|
+
* 左键走 Cesium 的 LEFT_DOUBLE_CLICK(桌面端 DOM dblclick);
|
|
10013
|
+
* 右键 Cesium 无 RIGHT_DOUBLE_CLICK 触发源,改在 RIGHT_CLICK 上用
|
|
10014
|
+
* DoubleClickDetector 自维护判定(连续两次右键间隔 < 300ms 且位移 < 10px)。
|
|
9951
10015
|
*/
|
|
9952
|
-
|
|
10016
|
+
_installDoubleClickZoom() {
|
|
10017
|
+
if (this._doubleClickInstalled || !this._viewer) return;
|
|
10018
|
+
const handler = this._viewer.screenSpaceEventHandler;
|
|
10019
|
+
if (!handler) return;
|
|
10020
|
+
|
|
10021
|
+
const EventType = Cesium$5.ScreenSpaceEventType;
|
|
10022
|
+
const saved = {};
|
|
10023
|
+
if (this._doubleClickZoomIn) {
|
|
10024
|
+
saved.left = handler.getInputAction(EventType.LEFT_DOUBLE_CLICK);
|
|
10025
|
+
handler.setInputAction(
|
|
10026
|
+
(movement) => this._onDoubleClickZoom(1, movement),
|
|
10027
|
+
EventType.LEFT_DOUBLE_CLICK
|
|
10028
|
+
);
|
|
10029
|
+
}
|
|
10030
|
+
if (this._doubleClickZoomOut) {
|
|
10031
|
+
saved.right = handler.getInputAction(EventType.RIGHT_CLICK);
|
|
10032
|
+
handler.setInputAction(
|
|
10033
|
+
(movement) => this._onRightClickForDoubleClick(movement),
|
|
10034
|
+
EventType.RIGHT_CLICK
|
|
10035
|
+
);
|
|
10036
|
+
}
|
|
10037
|
+
this._savedDoubleClickActions = saved;
|
|
10038
|
+
this._doubleClickInstalled = true;
|
|
10039
|
+
}
|
|
10040
|
+
|
|
10041
|
+
/**
|
|
10042
|
+
* 右键单击喂入双击判定器,构成双击时缩小一级
|
|
10043
|
+
* @param {object} movement Cesium 右键事件对象
|
|
10044
|
+
*/
|
|
10045
|
+
_onRightClickForDoubleClick(movement) {
|
|
10046
|
+
if (!this._doubleClickEnabled || !this._viewer) return;
|
|
10047
|
+
// 编辑器工具激活期间:右键是工具的撤销/结束语义,清状态不喂入,
|
|
10048
|
+
// 避免把两次撤销误判成双击缩放,或把脏状态带到工具结束后
|
|
10049
|
+
if (this._viewer.xs3dEditorActive) {
|
|
10050
|
+
this._rightDoubleClickDetector.reset();
|
|
10051
|
+
return;
|
|
10052
|
+
}
|
|
10053
|
+
const pos = movement?.position;
|
|
10054
|
+
if (!pos) return;
|
|
10055
|
+
if (this._rightDoubleClickDetector.feed(performance.now(), { x: pos.x, y: pos.y })) {
|
|
10056
|
+
this._rightDoubleClickDetector.reset();
|
|
10057
|
+
this._onDoubleClickZoom(-1, movement);
|
|
10058
|
+
}
|
|
10059
|
+
}
|
|
10060
|
+
|
|
10061
|
+
/**
|
|
10062
|
+
* 双击缩放处理:以双击拾取位置为中心步进一级
|
|
10063
|
+
* @param {number} levelDelta +1 放大一级,-1 缩小一级
|
|
10064
|
+
* @param {object} movement Cesium 双击事件对象
|
|
10065
|
+
*/
|
|
10066
|
+
_onDoubleClickZoom(levelDelta, movement) {
|
|
10067
|
+
if (!this._doubleClickEnabled || !this._viewer) return;
|
|
10068
|
+
// 绘制/量测/编辑工具激活期间禁用:左键双击是工具的收尾语义,
|
|
10069
|
+
// 右键单击是工具的撤销/结束语义,右键双击不能叠加缩放
|
|
10070
|
+
if (this._viewer.xs3dEditorActive) return;
|
|
10071
|
+
|
|
9953
10072
|
const camera = this._viewer.camera;
|
|
9954
|
-
|
|
9955
|
-
|
|
10073
|
+
// 以双击位置拾取到的地表点为缩放中心;拾取不到退回相机正下方
|
|
10074
|
+
let cartographic = camera.positionCartographic;
|
|
10075
|
+
// 锚点缩放需要"点击像素的视线方向":保持这条视线不变,
|
|
10076
|
+
// 锚点缩放后才仍投影在光标下方(相机中轴方向只在点击点恰为中心时成立)
|
|
10077
|
+
let rayDirection = camera.direction;
|
|
10078
|
+
if (movement?.position && this._viewer.scene?.globe) {
|
|
10079
|
+
const ray = camera.getPickRay(movement.position);
|
|
10080
|
+
const cartesian = ray ? this._viewer.scene.globe.pick(ray, this._viewer.scene) : null;
|
|
10081
|
+
if (ray) {
|
|
10082
|
+
rayDirection = ray.direction;
|
|
10083
|
+
}
|
|
10084
|
+
if (cartesian) {
|
|
10085
|
+
cartographic = Cesium$5.Cartographic.fromCartesian(cartesian);
|
|
10086
|
+
}
|
|
10087
|
+
}
|
|
10088
|
+
|
|
10089
|
+
const currentLevel = this._pendingLevel ?? this._getZoomLevel();
|
|
9956
10090
|
const targetLevel = Math.max(0, Math.min(24, currentLevel + levelDelta));
|
|
10091
|
+
this._flyToLevelKeepScreenPoint(targetLevel, cartographic, rayDirection);
|
|
10092
|
+
}
|
|
10093
|
+
|
|
10094
|
+
/**
|
|
10095
|
+
* 飞到指定层级,且保持 cartographic 对应的地面点在原屏幕位置(锚点缩放)。
|
|
10096
|
+
*
|
|
10097
|
+
* 与 _flyToLevel(以点为中心)不同:这里把相机沿"点击像素的视线方向"反方向
|
|
10098
|
+
* 退到目标高度——同一像素的视线方向只取决于相机姿态、与位置无关,因此相机
|
|
10099
|
+
* 沿该方向移动后,锚点仍投影在双击位置(光标下方),而不是被搬到屏幕中心。
|
|
10100
|
+
* 视线几乎水平(点击靠近地平线/天空)时退化为居中模式。
|
|
10101
|
+
*
|
|
10102
|
+
* @param {number} targetLevel 目标层级
|
|
10103
|
+
* @param {Cesium.Cartographic} cartographic 锚点(双击拾取的地面点)
|
|
10104
|
+
* @param {Cesium.Cartesian3} rayDirection 点击像素的视线方向(ECEF 单位向量)
|
|
10105
|
+
*/
|
|
10106
|
+
_flyToLevelKeepScreenPoint(targetLevel, cartographic, rayDirection) {
|
|
10107
|
+
const camera = this._viewer.camera;
|
|
9957
10108
|
const targetHeight = this._getHeightByZoomLevel(targetLevel);
|
|
10109
|
+
const pitch = camera.pitch;
|
|
10110
|
+
|
|
10111
|
+
let destination = null;
|
|
10112
|
+
// 相机俯角至少 ~60° 才做锚点缩放;更平时后退距离发散,观感也差,退化为中心模式
|
|
10113
|
+
const minPitch = Cesium$5.Math.toRadians(-60);
|
|
10114
|
+
if (pitch <= minPitch && rayDirection) {
|
|
10115
|
+
// 锚点处的本地"上"方向(ECEF)
|
|
10116
|
+
const cosLat = Math.cos(cartographic.latitude);
|
|
10117
|
+
const up = new Cesium$5.Cartesian3(
|
|
10118
|
+
cosLat * Math.cos(cartographic.longitude),
|
|
10119
|
+
cosLat * Math.sin(cartographic.longitude),
|
|
10120
|
+
Math.sin(cartographic.latitude)
|
|
10121
|
+
);
|
|
10122
|
+
// 视线向下的分量
|
|
10123
|
+
const rayUp = Cesium$5.Cartesian3.dot(rayDirection, up);
|
|
10124
|
+
// 相机沿视线到锚点的距离:垂直落差 / 视线向下分量
|
|
10125
|
+
const s = (targetHeight - cartographic.height) / (-rayUp);
|
|
10126
|
+
if (rayUp < -0.05 && Number.isFinite(s) && s > 0) {
|
|
10127
|
+
const anchor = Cesium$5.Cartesian3.fromRadians(
|
|
10128
|
+
cartographic.longitude,
|
|
10129
|
+
cartographic.latitude,
|
|
10130
|
+
cartographic.height
|
|
10131
|
+
);
|
|
10132
|
+
destination = Cesium$5.Cartesian3.add(
|
|
10133
|
+
anchor,
|
|
10134
|
+
Cesium$5.Cartesian3.multiplyByScalar(rayDirection, -s, new Cesium$5.Cartesian3()),
|
|
10135
|
+
new Cesium$5.Cartesian3()
|
|
10136
|
+
);
|
|
10137
|
+
}
|
|
10138
|
+
}
|
|
9958
10139
|
|
|
9959
|
-
|
|
9960
|
-
destination
|
|
10140
|
+
if (!destination) {
|
|
10141
|
+
destination = Cesium$5.Cartesian3.fromRadians(
|
|
9961
10142
|
cartographic.longitude,
|
|
9962
10143
|
cartographic.latitude,
|
|
9963
10144
|
targetHeight
|
|
9964
|
-
)
|
|
10145
|
+
);
|
|
10146
|
+
}
|
|
10147
|
+
this._flyToDestination(targetLevel, destination);
|
|
10148
|
+
}
|
|
10149
|
+
|
|
10150
|
+
/**
|
|
10151
|
+
* 飞到指定层级的目的地(目的地构造交给调用方),并记录 _pendingLevel
|
|
10152
|
+
* @param {number} targetLevel 目标层级
|
|
10153
|
+
* @param {Cesium.Cartesian3} destination 相机最终位置
|
|
10154
|
+
*/
|
|
10155
|
+
_flyToDestination(targetLevel, destination) {
|
|
10156
|
+
const camera = this._viewer.camera;
|
|
10157
|
+
|
|
10158
|
+
this._pendingLevel = targetLevel;
|
|
10159
|
+
camera.flyTo({
|
|
10160
|
+
destination,
|
|
9965
10161
|
orientation: {
|
|
9966
10162
|
heading: camera.heading,
|
|
9967
10163
|
pitch: camera.pitch,
|
|
9968
10164
|
roll: camera.roll
|
|
9969
10165
|
},
|
|
9970
|
-
duration: this._duration
|
|
10166
|
+
duration: this._duration,
|
|
10167
|
+
complete: () => {
|
|
10168
|
+
if (this._pendingLevel === targetLevel) this._pendingLevel = null;
|
|
10169
|
+
},
|
|
10170
|
+
cancel: () => {
|
|
10171
|
+
if (this._pendingLevel === targetLevel) this._pendingLevel = null;
|
|
10172
|
+
}
|
|
9971
10173
|
});
|
|
9972
10174
|
}
|
|
9973
10175
|
|
|
10176
|
+
_zoomIn() {
|
|
10177
|
+
this._zoomBy(1);
|
|
10178
|
+
}
|
|
10179
|
+
|
|
10180
|
+
_zoomOut() {
|
|
10181
|
+
this._zoomBy(-1);
|
|
10182
|
+
}
|
|
10183
|
+
|
|
10184
|
+
/**
|
|
10185
|
+
* 按地图层级步进缩放
|
|
10186
|
+
* @param {number} levelDelta 层级变化量,+1 放大一级,-1 缩小一级
|
|
10187
|
+
*/
|
|
10188
|
+
_zoomBy(levelDelta) {
|
|
10189
|
+
const currentLevel = this._pendingLevel ?? this._getZoomLevel();
|
|
10190
|
+
const targetLevel = Math.max(0, Math.min(24, currentLevel + levelDelta));
|
|
10191
|
+
this._flyToLevel(targetLevel, this._viewer.camera.positionCartographic);
|
|
10192
|
+
}
|
|
10193
|
+
|
|
10194
|
+
/**
|
|
10195
|
+
* 飞到指定层级(以给定经纬度为正下方中心),并记录 _pendingLevel
|
|
10196
|
+
* @param {number} targetLevel 目标层级
|
|
10197
|
+
* @param {Cesium.Cartographic} cartographic 目的地中心
|
|
10198
|
+
*/
|
|
10199
|
+
_flyToLevel(targetLevel, cartographic) {
|
|
10200
|
+
this._flyToDestination(
|
|
10201
|
+
targetLevel,
|
|
10202
|
+
Cesium$5.Cartesian3.fromRadians(
|
|
10203
|
+
cartographic.longitude,
|
|
10204
|
+
cartographic.latitude,
|
|
10205
|
+
this._getHeightByZoomLevel(targetLevel)
|
|
10206
|
+
)
|
|
10207
|
+
);
|
|
10208
|
+
}
|
|
10209
|
+
|
|
9974
10210
|
_getZoomLevel() {
|
|
9975
10211
|
const positionCartographic = this._viewer.camera.positionCartographic;
|
|
9976
10212
|
const surfaceCartesian = Cesium$5.Cartesian3.fromRadians(
|
|
@@ -9986,7 +10222,36 @@ class Zoom extends BaseControl {
|
|
|
9986
10222
|
|
|
9987
10223
|
_getHeightByZoomLevel(level) {
|
|
9988
10224
|
const equatorCircumference = 6378137 * 2 * Math.PI;
|
|
9989
|
-
|
|
10225
|
+
// 取层级几何带中心(C / 2^(L-0.5)),而不是分界线高度 C / 2^(L-1):
|
|
10226
|
+
// 分界线上浮点误差会导致层级反推差一级(实测约 1/3 经纬度位置),
|
|
10227
|
+
// 且动画尾段相机 changed 事件不再触发,信息栏会滞后一级显示。
|
|
10228
|
+
return equatorCircumference / Math.pow(2, Math.max(0, level - 0.5));
|
|
10229
|
+
}
|
|
10230
|
+
|
|
10231
|
+
/**
|
|
10232
|
+
* 销毁:恢复安装双击缩放前的输入动作
|
|
10233
|
+
* 编辑器工具激活期间不恢复(当前动作归工具所有,由工具的恢复链处理;
|
|
10234
|
+
* 工具结束后会放回本控件的 handler,其中 _viewer 已置空,调用即 no-op)
|
|
10235
|
+
*/
|
|
10236
|
+
_destroy() {
|
|
10237
|
+
if (this._doubleClickInstalled && this._viewer?.screenSpaceEventHandler) {
|
|
10238
|
+
const handler = this._viewer.screenSpaceEventHandler;
|
|
10239
|
+
const EventType = Cesium$5.ScreenSpaceEventType;
|
|
10240
|
+
const saved = this._savedDoubleClickActions || {};
|
|
10241
|
+
[
|
|
10242
|
+
['left', EventType.LEFT_DOUBLE_CLICK],
|
|
10243
|
+
['right', EventType.RIGHT_CLICK]
|
|
10244
|
+
].forEach(([key, eventType]) => {
|
|
10245
|
+
if (!(key in saved)) return;
|
|
10246
|
+
if (typeof saved[key] === 'function') {
|
|
10247
|
+
handler.setInputAction(saved[key], eventType);
|
|
10248
|
+
} else {
|
|
10249
|
+
handler.removeInputAction(eventType);
|
|
10250
|
+
}
|
|
10251
|
+
});
|
|
10252
|
+
}
|
|
10253
|
+
this._doubleClickInstalled = false;
|
|
10254
|
+
this._savedDoubleClickActions = null;
|
|
9990
10255
|
}
|
|
9991
10256
|
}
|
|
9992
10257
|
|