Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-11-06 11:29:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd4e775e7c627014e6ae1a64595d3e18aad565b6
dd4e775e
1 parent
33848062
✨ feat(别院地图首页): 点击景点时,把景点居中操作定位偏移到相应比例位置
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
src/views/bieyuan/map.vue
src/views/bieyuan/map.vue
View file @
dd4e775
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-06 1
0:53:45
* @LastEditTime: 2024-11-06 1
1: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: 获取详情定位信息用来导航
...
...
Please
register
or
login
to post a comment