Vue2leaflet: Widget options

Created on 18 May 2017  路  15Comments  路  Source: vue-leaflet/Vue2Leaflet

How to set original Leaflet widget zoom, navigation, scale options like position, attributes, etc?

enhancement help wanted

All 15 comments

If I understand you correctly,

Refer to https://github.com/KoRiGaN/Vue2Leaflet/issues/46

You can get the map object from there and use that to set whatever options you need.

If the answer not correct, please give an example of what you are trying to achieve.

I'm trying to override the default widget options in http://leafletjs.com/reference-1.0.3.html#control and http://leafletjs.com/reference-1.0.3.html#control-zoom, like 'position': 'top-right', for example.

Would the following help?

// inside mounted(), find the map object
// refer to https://github.com/KoRiGaN/Vue2Leaflet/issues/46
// do the following...
...
map.zoomControl.remove()
L.control.zoom({ position:'topright' }).addTo(map);

Yes, it helps indeed! I guess it's reasonable to do so, but in the future those widget options should be customizable using :props, don't you think?

Thank you for your help.

You may be right, but this Vue library is still pretty new to me so I can't make a good opinion on this.

The author of this library may be in a better position to explain why things are done in a certain way, but so far I do see this library being improved actively.

Hi @fergardi,

Zoom and Scale Controls in Leaflet are not implemented yet as I didn't have time to do it.

You will be able to modified Attributions via a prop on each TileLayer in the v0.0.50 thanks to @EyMaddis pull request.
Layers Control only works for WMSLayers at the moment thanks to @nikos pull request. More work will be requiered to make it a generic layer control.

Micka毛l

It's nice to know. Thanks for your work!

So, is it not possible to disactivate zoomControl?

You can remove the control this way :
map.zoomControl.remove()

YEAH, perfect!

Hi @fergardi, @ais-one, @ItsLhoudini,

Controls are now implemented in v1.0.1.

Let me know if it solves your issue.

Micka

ok, time to update package...

@KoRiGaN

Thanks for the notice, I have updated my code base (vue2-leaflet-tracksymbol v1.0.11) to work on Vue2Leaflet v1.0.1 in my develop branch, seems to be working fine.

https://github.com/ais-one/vue2-leaflet-tracksymbol/tree/develop

Will push it to master once further testing is done.

@KoRiGaN

Done its on master branch now.

Closing as no comments for 3 weeks.
Please reopen this issue if it not solved yet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlmjohnson picture carlmjohnson  路  4Comments

mnboos picture mnboos  路  3Comments

martinwithyou picture martinwithyou  路  4Comments

lusman20 picture lusman20  路  4Comments

shtw picture shtw  路  5Comments