hookehuyr

✨ feat(别院地图首页): 点击景点时,把景点居中操作定位偏移到相应比例位置

<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-06 10:53:45
* @LastEditTime: 2024-11-06 11:28:00
* @FilePath: /map-demo/src/views/bieyuan/map.vue
* @Description: 公众地图主体页面
-->
......@@ -385,7 +385,15 @@ export default {
$('.van-floating-panel').css('boxShadow', '0 0 15px black');
// 定位到当前位置中心
// this.map.setZoomAndCenter(this.zoom, this.itemInfo.position);
this.map.setZoomAndCenter(this.zoom, this.itemInfo.position);
// 获取地图容器的高度
const mapHeight = this.map.getSize().height;
// 计算需要向上移动的像素值,比如向上移动地图高度的一半左右
const offsetY = -mapHeight / 3.5;
// 使用 panBy 方法进行视图偏移
this.map.panBy(0, offsetY);
})
}
// TODO: 获取详情定位信息用来导航
......