Leaflet/Leaflet.fullscreen

t.addTo is not a function

StefanBrand opened this issue · 9 comments

Hi, I tried map.addControl(L.Control.Fullscreen);, but Firefox console gives me t.addTo is not a function. The fullscreen button is not added to the map.

I cannot use the fullscreenControl: true option because I want to add the fullscreen button only in a specific case.

Can you please create a minimal self-contained example that demonstrates the issue?

Thanks for the fast reply! Wait a second

Edit: You can check it out here:

https://stefanbrand.github.io/fprsmap/

I added the line here.

Could you check it out?

I don't see any errors when I load that page. Do I need to do something to trigger the issue?

Ok, can you please set up a standalone demo that reproduces the issue, that's independent of your production deployment? I'd like to help you, but in return I'm asking for you to make it easy to do so.

It was quite easy for two days or so. ;-) I just wanted to make some progress, so I outcommented the lines there for now.

Here you go: https://stefanbrand.github.io/leafletfullscreentest/ (Repo is here: https://github.com/StefanBrand/leafletfullscreentest ). In the developer console of your browser (tested on Firefox 51.0.1) you can easily see the error message.

PS.: I was put off from setting up an own repo for this, but eventually it was easier than I had thought...

Thanks, now I see the issue: mymap.addControl(L.Control.Fullscreen);. This should be mymap.addControl(new L.Control.Fullscreen()); In 22141a4, I've clarified this in README.md.

Thank you! The README is very clear now! :)

Edit: The fullscreen button has returned and looks beautiful! 😍

See: https://stefanbrand.github.io/fprsmap/