From a641f5cf7c4eedc24e93d2fe37535cdfeebfab70 Mon Sep 17 00:00:00 2001 From: zouyaoji <370681295@qq.com> Date: Mon, 13 Feb 2023 23:59:20 +0800 Subject: [PATCH] fix: zoom-in and zoom-out function of the `navigation-sm` not work --- .../controls/navigation-sm/use-zoom-control.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/components/controls/navigation-sm/use-zoom-control.ts b/packages/components/controls/navigation-sm/use-zoom-control.ts index 34cc21192..1fc666c7d 100644 --- a/packages/components/controls/navigation-sm/use-zoom-control.ts +++ b/packages/components/controls/navigation-sm/use-zoom-control.ts @@ -33,6 +33,7 @@ export default function (props, { emit }, vcInstance: VcComponentInternalInstanc // methods const handleZoomInMouseDown = e => { + console.log('handleZoomInMouseDown') const { defined, getTimestamp, SceneMode, ScreenSpaceEventType } = Cesium const { viewer } = $services $(zoomInTooltipRef)?.hide() @@ -47,7 +48,7 @@ export default function (props, { emit }, vcInstance: VcComponentInternalInstanc const scene = viewer.scene const camera = scene.camera zoominTickFunction = () => { - viewer.scene.mode === SceneMode.COLUMBUS_VIEW ? camera.zoomIn() : handlezoom(1) + viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D ? camera.zoomIn() : handlezoom(1) } zoominMouseUpFunction = () => { @@ -77,7 +78,7 @@ export default function (props, { emit }, vcInstance: VcComponentInternalInstanc const scene = viewer.scene const camera = scene.camera zoomoutTickFunction = () => { - viewer.scene.mode === SceneMode.COLUMBUS_VIEW ? camera.zoomOut() : handlezoom(-1) + viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D ? camera.zoomOut() : handlezoom(-1) } zoomoutMouseUpFunction = () => { @@ -112,13 +113,13 @@ export default function (props, { emit }, vcInstance: VcComponentInternalInstanc zoombarTickFunction = () => { const zoomOffset = zoombarTop.value - 65 if (zoomOffset > 0) { - if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW) { + if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D) { camera.zoomOut() } else { handlezoom(-1) } } else if (zoomOffset < 0) { - if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW) { + if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D) { camera.zoomIn() } else { handlezoom(1) @@ -140,13 +141,13 @@ export default function (props, { emit }, vcInstance: VcComponentInternalInstanc const zoomFlag = zoombarTop.value - zoombarTopMove if (zoomFlag > 0) { - if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW) { + if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D) { camera.zoomOut() } else { handlezoom(-1) } } else { - if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW) { + if (viewer.scene.mode === SceneMode.COLUMBUS_VIEW || viewer.scene.mode === SceneMode.SCENE2D) { camera.zoomIn() } else { handlezoom(1)