Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any Suggestions for Multiple layers #10

Open
AnujSengar opened this issue Oct 5, 2016 · 2 comments
Open

Any Suggestions for Multiple layers #10

AnujSengar opened this issue Oct 5, 2016 · 2 comments

Comments

@AnujSengar
Copy link

Hi,
I am quite new to Leaflet. I have used Magnifier plugin in my app which has many layers.
Can somebody tell me how to set and remove magnifier for multiple layers on the go? It will be great help.

Thanks,
Anuj

@jamieodonnell
Copy link

I would also be very interested in this!

I have some buttons that I would like to link to layers that can be switched in and out of the magnifying glass.

Any ideas on the specific commands for adding and removing layers @bbecquet ??

Thanks very much

@bbecquet
Copy link
Owner

Hi.
Double sorry, for letting this question unanswered for so long, and because it's just a matter of missing documentation.

There is no specific method to add/remove layers on magnifying glasses, it's simpler than that. Mag glass objects expose the getMap method, that you can use to access the L.Map instance that it contains. Then, you can do anything you would do on a "normal" Leaflet map object, as it is one.

var map = L.map(...); // the main map

var mg = L.magnifyingGlass(...); // the magnifying glass instance
map.addLayer(mg);

var miniMap = mg.getMap(); // the map instance contained in the magnifying glass
miniMap.addLayer(L.marker(...)); 

I'll add doc for it in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants