Skip to content

Conversation

tofferrosen
Copy link
Contributor

I was able to replicate this issue: #1797. The problem is that redraw does not call update and reset on the TileLayer, therefore causing the above issue. I am proposing simply doing it before calling drawTile. I built and tested it against the issue.

…lled.

I was able to replicate this issue: Leaflet#1797. The problem is that redraw does not call update and reset on the TileLayer, therefore causing the above issue. I am proposing simply doing it before calling drawTile. I built and tested it, and it does fix the issue.
@mourner
Copy link
Member

mourner commented Jul 2, 2013

@tofferrosen nice! could you also make a minimal JSFiddle test case so I could test out the fix?

@mourner
Copy link
Member

mourner commented Jul 2, 2013

It's just that I'm doing some TileLayer and TileLayer.Canvas refactoring now, so I'd like to make sure the fix is not lost after that...

@tofferrosen
Copy link
Contributor Author

Sure! Here is a small JSFiddle test that demonstrates the issue: http://jsfiddle.net/tofferrosen/6h6sC/4/. Just click the "New Heatmap" button.

Clicking it calls a function that will set new data for the heatmap, which calls redraw() on the TileLayer.Canvas layer after. The expectation is that we should only see the new heatmap drawing, but instead we see the previous one as well.

mourner added a commit that referenced this pull request Jul 10, 2013
Issue where the tile layer is not reset and updated when redraw is calle...
@mourner mourner merged commit 69c74a5 into Leaflet:master Jul 10, 2013
@panrafal
Copy link

Unfortunately, this recreates the canvases on every redraw.
In my case, i have a map with changeable settings. On every change i do a redraw. On 0.5 it was possible to make the transition smooth. With this patch though, on every change everything blinks and slows down, because everything has to be recreated.

I've created a PR which makes it optional: #1898

@TwistaTim
Copy link

I support @panrafal's pull request, I also deal with tile updates by dynamically wiping the canvas clean and then redrawing, Not removing the canvas element. This method reduces the browser locking and time in order to update.

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

Successfully merging this pull request may close these issues.

4 participants