Skip to content

Commit

Permalink
fix: zoom-in and zoom-out function of the navigation-sm not work
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyaoji committed Feb 13, 2023
1 parent a84ec8c commit a641f5c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/components/controls/navigation-sm/use-zoom-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 = () => {
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit a641f5c

Please sign in to comment.