Igor-Vladyka / leaflet.browser.print

A leaflet plugin which allows users to print the map directly from the browser
https://igor-vladyka.github.io/leaflet.browser.print/
MIT License
154 stars 76 forks source link

Flag to enable event propagation #72

Closed nrakochy closed 4 years ago

nrakochy commented 4 years ago

Is your feature request related to a problem? Please describe. I have some HTML text labels that resize/re-center themselves on zoomend in normal mode. I am looking for a seam that I can enable this same functionality when in print mode.

Or to say it another way, if a user zooms on the map in print mode, the labels become skewed and off-centered of their space b/c the handler is disabled.

Describe the solution you'd like ~If a flag passed to the plugin prevented disableClickPropagation, would this re-activate the zoomend handlers on the clone?~

Update: enabling this does not pass along the click handlers from the clone, so I am still interested in having this functionality, just not sure what a viable solution is.

Describe alternatives you've considered I am looking at manually attaching the handlers or a deep-clone option, but those are outside of the context of this plugin and fraught with complexity. Any insight or suggestions would be appreciated. Thanks.

Igor-Vladyka commented 4 years ago

Hi,

So basically you are using custom logic to activate print functionaity, right? If that is the case:

If you need to attach logic that is depends on some map events, as in your example, you can duplicate it directly on print map within the browser-print-start event.

Example:

map.on(L.Control.BrowserPrint.Event.PrintStart, function(obj) {
                obj.map.on("zoomend", function(e){ ... });
            });
nrakochy commented 4 years ago

I think the PrintStart event might be the route I am looking for. Thank you for the follow-up.