From 8ddcfd310d47b10c1b8d846958ab4ecbb030ac63 Mon Sep 17 00:00:00 2001
From: cbwu <504-wuchengbo@htsdfp.com>
Date: Tue, 26 Mar 2024 13:30:27 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=B9=B3=E6=BB=91?=
=?UTF-8?q?=E7=BC=A9=E6=94=BE=EF=BC=8C=E7=A7=BB=E9=99=A4=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?entity=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 6 +-----
src/components/map/SceneViewer.vue | 1 +
src/utils/map/sceneViewer.ts | 16 ++++++++++++++++
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/index.html b/index.html
index 4d7aa22..23a9f5e 100644
--- a/index.html
+++ b/index.html
@@ -13,6 +13,7 @@
@@ -41,11 +42,6 @@
cesium="true"
src="https://api.tianditu.gov.cn/cdn/plugins/cesium/protobuf.min.js"
>
-
diff --git a/src/components/map/SceneViewer.vue b/src/components/map/SceneViewer.vue
index fbd4216..5a99579 100644
--- a/src/components/map/SceneViewer.vue
+++ b/src/components/map/SceneViewer.vue
@@ -17,6 +17,7 @@ import { initViewer, perfViewer } from '@/utils/map/sceneViewer'
import { flyToChina } from '@/utils/map/camera'
const viewerDivRef = ref()
let viewer: Viewer
+
window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
// window.CESIUM_BASE_URL = 'libs/cesium/' //打包部署
diff --git a/src/utils/map/sceneViewer.ts b/src/utils/map/sceneViewer.ts
index 0ea76d1..3144858 100644
--- a/src/utils/map/sceneViewer.ts
+++ b/src/utils/map/sceneViewer.ts
@@ -1,3 +1,10 @@
+/*
+ * @Author: cbwu 504-wuchengbo@htsdfp.com
+ * @Date: 2024-03-13 09:32:21
+ * @LastEditors: cbwu
+ * @LastEditTime: 2024-03-26 13:27:27
+ * @Description:
+ */
// Viewer初始化
import {
Viewer,
@@ -44,9 +51,18 @@ function initViewer(container: string | Element): Viewer {
creditContainer.style.display = 'none'
// 水雾特效
viewer.scene.globe.showGroundAtmosphere = true
+ // 设置更高的缩放惯性以使缩放操作更平滑
+ viewer.scene.screenSpaceCameraController.inertiaZoom = 0.9
// 限制相机缩放
viewer.scene.screenSpaceCameraController.minimumZoomDistance = 200 //相机的高度的最小值
viewer.scene.screenSpaceCameraController.maximumZoomDistance = 20000000 //相机高度的最大值
+ // 去掉entity的点击事件(双击、单击)
+ viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
+ Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
+ )
+ viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
+ Cesium.ScreenSpaceEventType.LEFT_CLICK,
+ )
return viewer
}