pasichnykvasyl / Leaflet.BigImage

A leaflet plugin that allows users to receive a large map area and download it.
https://pasichnykvasyl.github.io/Leaflet.BigImage/
MIT License
80 stars 27 forks source link

Several problems in code #6

Open vagran opened 3 years ago

vagran commented 3 years ago

Hello, I tried to adopt your code for my needs and found several problems.

https://github.com/pasichnykvasyl/Leaflet.BigImage/blob/b02e8f08783eb3f0ce9c9f11dd1c61bd44eb11d1/src/Leaflet.BigImage.js#L327

this.ctx.scale

https://github.com/pasichnykvasyl/Leaflet.BigImage/blob/b02e8f08783eb3f0ce9c9f11dd1c61bd44eb11d1/src/Leaflet.BigImage.js#L217 This assumes only one tile is drawn at the given index. It is incorrect when you have overlay with semi-transparent or non-square tiles (masked by transparency channel). Probably best approach is just to draw all tiles in z-order. Also check your order, seems base tile is always preferred over overlay.

https://github.com/pasichnykvasyl/Leaflet.BigImage/blob/b02e8f08783eb3f0ce9c9f11dd1c61bd44eb11d1/src/Leaflet.BigImage.js#L242 https://github.com/pasichnykvasyl/Leaflet.BigImage/blob/b02e8f08783eb3f0ce9c9f11dd1c61bd44eb11d1/src/Leaflet.BigImage.js#L216 onerror should be set as well, otherwise failing to load at least one image will hang whole the process.

Here is my version of export plugin (pure programmatic way, no controls).

folknor commented 3 years ago

I'm also maintaining my own fork in a project, mostly for the z-order and scale issues OP mentioned in this ticket.