Skip to content

Conversation

danzel
Copy link
Member

@danzel danzel commented Jun 13, 2012

If you zoom in or out twice quickly (before new tiles can load) you will be given a blank map.
These changes make us consider whether we should use the existing background (zoomed) layer or re-use the foreground layer instead.
If the current foreground doesn't have enough tiles loaded we'll keep the current background instead (and zoom it in).

Fixes CloudMade/Leaflet#7 (The second oldest open issue on leaflet!)

Happy to change _getLoadedTilesPercentage if there is a better way to do it.

danzel added 4 commits June 13, 2012 14:19
… and the current background layer does, keep the current background layer rather than swapping in the current foreground. Makes continuous zooming look more awesome, rather than going blank after 2 quick zooms. (Has a big of debug output to be cleaned up later)
…d. Previously the bg would get moved to the wrong location, now it moves to the correct location
@jacobtoye
Copy link
Member

Awesome. @mourner can we get this pulled!

@mourner
Copy link
Member

mourner commented Jun 15, 2012

Wow, honestly I failed to implement this back then, getting very weird behaviour on some browsers (when trying to scale an already scaled tile container), and decided to give up for some time. If this patch works in all browser/OS combinations including iPad and Android, this is really awesome! Did you test it extensively?

@danzel
Copy link
Member Author

danzel commented Jun 15, 2012

I've tested Chrome, Firefox, iPad, IE9 (where you don't get the zoom animation at all).
Can probably test android and Safari (mac) on Monday. It might not work on android as there are a few hacks for android in the zoom code already, we'll be able to disable it on android if so.

@danzel
Copy link
Member Author

danzel commented Jun 17, 2012

Doesn't work on android, which should be expected as android doesn't support double-translate. So I've made this disable itself on android for now, Tested on 2.3.5.

@danzel
Copy link
Member Author

danzel commented Jun 17, 2012

opera 12 works too :)

mourner added a commit that referenced this pull request Jun 18, 2012
Fix rapid zooming giving a blank map
@mourner mourner merged commit 32e6860 into Leaflet:master Jun 18, 2012
mourner added a commit that referenced this pull request Jun 18, 2012
@mourner
Copy link
Member

mourner commented Jun 18, 2012

@danzel, thanks for a great contribution! I guess the zoom animation code is quite confusing at the moment, so was not very easy to figure out... Hopefully I'll refactor the thing into something more manageable in future.

@danzel
Copy link
Member Author

danzel commented Jun 18, 2012

@mourner thanks for merging this! If you think this was good, wait till you see tomorrows pull request ;-)

@mourner
Copy link
Member

mourner commented Jun 18, 2012

@danzel if it's the markers/vectors/popups zoom animation stuff I saw among your branches, can't wait to see it!

I worked on marker animation several weeks ago for some CloudMade mobile app demo, got it working nicely without much code on modern desktop browsers, but then got stuck with mobile Safari not handling simultaneous transforms very well (when touch-zooming, sometimes all markers animated well, and sometimes only some of them, while others stayed on the same position — not always apparent on the browser but constantly reproducible inside a UIWebView, weird stuff). Tried everything to fix it for 2 full-time days, thought my head was going to explode, but gave up eventually. :) Can't wait to see how you approached this.

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.

3 participants