Sfoglia il codice sorgente

add padding on leaflet map 'fitBounds' execution

Olivier Massot 4 anni fa
parent
commit
4f92b3585f
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      components/Ui/Map/Structures.vue

+ 1 - 1
components/Ui/Map/Structures.vue

@@ -140,7 +140,7 @@ export default Vue.extend({
       this.map.addLayer(clusters)
     },
     setMapBounds (bounds: L.LatLngBoundsExpression): void {
-      this.map.fitBounds(bounds) // << without this, the new bounds may not be properly set when the current view overlaps the new bounds.
+      this.map.fitBounds(bounds, { padding: [100, 60] }) // << without this, the new bounds may not be properly set when the current view overlaps the new bounds.
     },
     resetBounds (): void {
       this.setMapBounds(this.defaultBounds)