中键回正改为天底+北朝上(不恢复原视角)
This commit is contained in:
@@ -400,7 +400,7 @@ export class CesiumGlobe {
|
|||||||
viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右键原生 tilt:按下记录相机状态;松开不回正。中键:回正(flyTo 动画飞回按下前状态)
|
// 右键原生 tilt:按下记录位置;松开不回正。中键:回正到“不倾斜不旋转”(天底 + 北朝上)
|
||||||
_setupRightRestore() {
|
_setupRightRestore() {
|
||||||
const scene = this.viewer.scene;
|
const scene = this.viewer.scene;
|
||||||
const camera = this.viewer.camera;
|
const camera = this.viewer.camera;
|
||||||
@@ -409,11 +409,7 @@ export class CesiumGlobe {
|
|||||||
|
|
||||||
handler.setInputAction(() => {
|
handler.setInputAction(() => {
|
||||||
camera.cancelFlight(); // 取消可能仍在进行的回正动画
|
camera.cancelFlight(); // 取消可能仍在进行的回正动画
|
||||||
this._rightHome = {
|
this._rightHome = Cesium.Cartesian3.clone(camera.position);
|
||||||
position: Cesium.Cartesian3.clone(camera.position),
|
|
||||||
direction: Cesium.Cartesian3.clone(camera.direction),
|
|
||||||
up: Cesium.Cartesian3.clone(camera.up),
|
|
||||||
};
|
|
||||||
}, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
|
}, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
|
||||||
|
|
||||||
handler.setInputAction(() => {
|
handler.setInputAction(() => {
|
||||||
@@ -423,13 +419,13 @@ export class CesiumGlobe {
|
|||||||
}, Cesium.ScreenSpaceEventType.RIGHT_UP);
|
}, Cesium.ScreenSpaceEventType.RIGHT_UP);
|
||||||
|
|
||||||
handler.setInputAction(() => {
|
handler.setInputAction(() => {
|
||||||
// 中键:回正(动画飞回)
|
// 中键:回正(天底 + 北朝上,保持原注视点)
|
||||||
if (!this._rightHome) return;
|
if (!this._rightHome) return;
|
||||||
const s = this._rightHome;
|
const pos = this._rightHome;
|
||||||
this._rightHome = null;
|
this._rightHome = null;
|
||||||
camera.flyTo({
|
camera.flyTo({
|
||||||
destination: s.position,
|
destination: pos,
|
||||||
orientation: { direction: s.direction, up: s.up },
|
orientation: { heading: 0, pitch: Cesium.Math.toRadians(-90), roll: 0 },
|
||||||
duration: 0.5,
|
duration: 0.5,
|
||||||
});
|
});
|
||||||
}, Cesium.ScreenSpaceEventType.MIDDLE_DOWN);
|
}, Cesium.ScreenSpaceEventType.MIDDLE_DOWN);
|
||||||
|
|||||||
Reference in New Issue
Block a user