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
'hideControlContainer' and 'hideClasses' not working with multiple instances #109
Comments
I only have a single Leaflet map container, however the hideClasses option doesn't seem to work at all. I have a map with a scale so I don't want to hide the entire control container as I want users to be able to export a map image with a scale as well. However, I don't want the zoom buttons to show up on the final map. So I have:
However, when I export images I see all the control containers (zoom, scale, overlay panel, attributions). I think the user in issue #66 may have had the same problem but I can't see a solution. |
Is there any update on this? I also am having issues with hideClasses. See code below (from the plugin index file). After setting my options to exclude the div class 'leaflet-control-zoom', it still appears on the map when exported. <title>Leaflet easyPrint plugin Demo</title>
Welcome to the Leaflet easyPrint demoAll this text will be hidden when I print my map. <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
|
I've modified bundle.js to force the hideClasses option array to work. At: At: I added the following function at the end: Below is the modified content of bundle.js |
It´s not that it´s not working, but it hides the specified classes from the wrong map container:
So EasyPrint tries to find the specified container using a general selector
document.getElementsByClassName("leaflet-control-container")[0]
which will retrieve the wrong container if you have multiple Leaflet instances initiated.What I did was to change the selector to its own map class container to be searched:
var mapContainer = this._map.getContainer();
, so toggleClasses() code will look like:Does somebody passed through this?
The text was updated successfully, but these errors were encountered: