hookehuyr

特殊处理边界问题-Bob需要展示例子

<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-11 15:12:46
* @LastEditTime: 2024-07-12 14:59:31
* @FilePath: /map-demo/src/views/index.vue
* @Description: 公众地图主体页面
-->
......@@ -900,26 +900,27 @@ export default {
// TODO: 暂时屏蔽等待数据设置字段
// 只显示相应区域,移动会回到选定范围
// this.lockMapBounds()
const id = this.$route.query.id;
if (id === '1759271') { // 定制开发
this.lockMapBounds()
}
},
// 限制地图范围
lockMapBounds() {
// var bounds = this.map.getBounds();
var myBounds = new AMap.Bounds(
// [120.58626,31.316141],
// [120.588357,31.313204]
[117.052221,26.834886],
[117.046739,26.838553]
[117.045587,26.838764],
[117.051081,26.8345723]
);
this.map.setLimitBounds(myBounds);
let list =[
[120.585097,31.316144],
[120.588264,31.316373],
[120.588712,31.313162],
[120.58609,31.313013]
[117.045598,26.838764],
[117.051075,26.838779],
[117.051075,26.835107],
[117.045598,26.835107]
]
// 隐藏边界以外的区域
......