添加自动缩放选项
This commit is contained in:
parent
712e9afcf3
commit
5c7ee289ca
@ -12,7 +12,7 @@
|
||||
label="显示所有路径点"
|
||||
v-model="options.showMarker"
|
||||
color="primary"
|
||||
@update:model-value="redrawMap"
|
||||
@update:model-value="toggleShowMarker"
|
||||
keep-color
|
||||
/>
|
||||
|
||||
@ -24,6 +24,14 @@
|
||||
keep-color
|
||||
/>
|
||||
|
||||
<q-toggle
|
||||
label="自动缩放"
|
||||
v-model="options.autoScaling"
|
||||
color="primary"
|
||||
@update:model-value="redrawMap"
|
||||
keep-color
|
||||
/>
|
||||
|
||||
<q-toggle
|
||||
label="卫星地图"
|
||||
v-model="layers.satellite.show"
|
||||
@ -129,6 +137,7 @@ const layers = reactive({
|
||||
const options = reactive({
|
||||
useHighAccuracyLocation: true,
|
||||
showMarker: false,
|
||||
autoScaling: true,
|
||||
})
|
||||
|
||||
const authModel = reactive({
|
||||
@ -160,6 +169,13 @@ function login(){
|
||||
})
|
||||
}
|
||||
|
||||
function toggleShowMarker(v){
|
||||
if(v){
|
||||
options.autoScaling = false
|
||||
}
|
||||
redrawMap()
|
||||
}
|
||||
|
||||
function redrawMap(){
|
||||
clearMap()
|
||||
drawMap()
|
||||
@ -431,6 +447,9 @@ function drawMap(){
|
||||
// })
|
||||
map.add(data.polylines)
|
||||
setTimeout(()=>{
|
||||
if(!options.autoScaling){
|
||||
return
|
||||
}
|
||||
if (data.polylines.length > 0) {
|
||||
map.setFitView()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user