forked from MapComplete/MapComplete
Scalebar: add option to set scalebar, don't show scalebar if not set
This commit is contained in:
parent
3088c829c5
commit
6cacd50817
2 changed files with 31 additions and 4 deletions
|
@ -692,15 +692,17 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
if (!map) {
|
||||
return
|
||||
}
|
||||
if (!showScale && this.scaleControl) {
|
||||
map.removeControl(this.scaleControl)
|
||||
if (!showScale) {
|
||||
if(this.scaleControl){
|
||||
map.removeControl(this.scaleControl)
|
||||
this.scaleControl = undefined
|
||||
}
|
||||
return
|
||||
}
|
||||
console.log("Adding scale")
|
||||
if (this.scaleControl === undefined) {
|
||||
|
||||
this.scaleControl = new ScaleControl({
|
||||
maxWidth: 80,
|
||||
maxWidth: 100,
|
||||
unit: "metric"
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue