diff --git a/src/components/MapBox.vue b/src/components/MapBox.vue index fdbd0cf..fa51d9c 100644 --- a/src/components/MapBox.vue +++ b/src/components/MapBox.vue @@ -154,8 +154,8 @@ export default { projection: 'globe' }) // 地图控件 + this.map.addControl(new mapboxgl.NavigationControl(), 'top-right') this.map.addControl(new mapboxgl.ScaleControl(), 'top-right') - this.map.addControl(new mapboxgl.NavigationControl(), 'bottom-left') }, /** * @description: 清除地图上的航线 @@ -486,11 +486,12 @@ export default { }) }, /** - * @description: 屏幕横移 - * @param {*} val 正数向左移动 负数向右移动 + * @description: 屏幕横移 纵移 + * @param {*} x 正数向左移动 负数向右移动 + * @param {*} y 正数向上移动 负数向下移动 */ - mapXOffset (val) { - this.map.panBy([val, 0], { + mapXOffset (x, y) { + this.map.panBy([x, y], { duration: 333 // 过渡持续时间,以毫秒为单位 }) }