Vue2leaflet: fitBounds() function with padding

Created on 21 Oct 2019  路  1Comment  路  Source: vue-leaflet/Vue2Leaflet

How to use the fitBounds() function with a padding option?

I tried this.$refs.leafmap.fitBounds(this.initbounds,{ padding: [20, 20] })

but it isn鈥檛 working that way.

I tried to set a :padding on the LMap component too. But it seems the map doesn't recognize the value. I tried this with number arrays like [50,50] or [50,50,50,50]

Thanks!

Most helpful comment

solved it by using the mapObject function.

this.$refs.leafmap.mapObject.fitBounds(this.initbounds, { padding: [30, 30] });

>All comments

solved it by using the mapObject function.

this.$refs.leafmap.mapObject.fitBounds(this.initbounds, { padding: [30, 30] });

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharlesOkwuagwu picture CharlesOkwuagwu  路  5Comments

Abdelaziz18003 picture Abdelaziz18003  路  4Comments

mawieutc picture mawieutc  路  4Comments

rSammy picture rSammy  路  3Comments

digEmAll picture digEmAll  路  4Comments