右键按下时取消左键惯性余力,避免叠加旋转
This commit is contained in:
@@ -390,6 +390,17 @@ export class CesiumGlobe {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handler.setInputAction((movement) => {
|
handler.setInputAction((movement) => {
|
||||||
|
// 取消左键旋转/缩放/倾斜的惯性余力,避免右键拖动时叠加成“又转又倾斜”
|
||||||
|
const ctrl = scene.screenSpaceCameraController;
|
||||||
|
const inertiaStates = [
|
||||||
|
'_lastInertiaSpinMovement',
|
||||||
|
'_lastInertiaZoomMovement',
|
||||||
|
'_lastInertiaTiltMovement',
|
||||||
|
];
|
||||||
|
for (let i = 0; i < inertiaStates.length; i++) {
|
||||||
|
const st = ctrl[inertiaStates[i]];
|
||||||
|
if (st) st.inertiaEnabled = false;
|
||||||
|
}
|
||||||
// 旋转中心 = 相机当前注视的屏幕中心点(地形表面),而不是点击点
|
// 旋转中心 = 相机当前注视的屏幕中心点(地形表面),而不是点击点
|
||||||
const canvas = scene.canvas;
|
const canvas = scene.canvas;
|
||||||
const center = Cesium.Cartesian2.fromElements(
|
const center = Cesium.Cartesian2.fromElements(
|
||||||
|
|||||||
Reference in New Issue
Block a user