点击标记平移居中,不再重置缩放
This commit is contained in:
@@ -7,9 +7,6 @@ const IMAGERY_URL =
|
|||||||
const TERRAIN_URL =
|
const TERRAIN_URL =
|
||||||
'https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer';
|
'https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer';
|
||||||
|
|
||||||
// 点击标记后飞到的目标高度(米,与初始视图一致,保证左键拖拽始终是“整球旋转”)
|
|
||||||
const FLY_TO_HEIGHT = 7.2e6;
|
|
||||||
|
|
||||||
// 标记便签的离地高度(米):抬到高空,使其 bounding 球比城市/国家名更靠相机,
|
// 标记便签的离地高度(米):抬到高空,使其 bounding 球比城市/国家名更靠相机,
|
||||||
// 从而在透明通道的深度排序中始终后绘制(盖在标签上层)。
|
// 从而在透明通道的深度排序中始终后绘制(盖在标签上层)。
|
||||||
const MARKER_ALTITUDE = 50000;
|
const MARKER_ALTITUDE = 50000;
|
||||||
@@ -288,8 +285,10 @@ export class CesiumGlobe {
|
|||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (this._lastFly && now - this._lastFly < 400) return; // 双击/连点去抖,避免重复飞
|
if (this._lastFly && now - this._lastFly < 400) return; // 双击/连点去抖,避免重复飞
|
||||||
this._lastFly = now;
|
this._lastFly = now;
|
||||||
this.viewer.camera.flyTo({
|
const camera = this.viewer.camera;
|
||||||
destination: Cesium.Cartesian3.fromDegrees(entry.lng, entry.lat, FLY_TO_HEIGHT),
|
const height = camera.positionCartographic.height; // 保持当前缩放,平移过去
|
||||||
|
camera.flyTo({
|
||||||
|
destination: Cesium.Cartesian3.fromDegrees(entry.lng, entry.lat, height),
|
||||||
orientation: {
|
orientation: {
|
||||||
heading: 0,
|
heading: 0,
|
||||||
pitch: Cesium.Math.toRadians(-90),
|
pitch: Cesium.Math.toRadians(-90),
|
||||||
|
|||||||
Reference in New Issue
Block a user