Skip to content

Conversation

fastrde
Copy link
Contributor

@fastrde fastrde commented Aug 17, 2013

Hello,

here is the chain that produces the error in Issue #1904.

_onViewReset() 
-> L.Map.latLngToLayerPoint() 
-> L.Map.getPixelOrigin() 
-> L.Map._checkIfLoaded() 
-> BOOM

now the call of _onViewReset() is event-based and waits for the map to get ready ('load' event). That fixes Issue #1904 and should work as well for Issue #1831

jsfiddle with (manuelly) patched src.
http://jsfiddle.net/fastrde/2AuE7/8/

lg

fastrde

@mourner
Copy link
Member

mourner commented Aug 17, 2013

Thanks Fabian!
It seems that this would fail if map.dragging.enable() is called after the map is initialized.
Perhaps replace the changed line with a call to map.whenReady(this._onViewReset, this)?

@mourner
Copy link
Member

mourner commented Aug 17, 2013

It would also be great to cover this race condition with a test so that we don't run into regression in fugure.

@fastrde
Copy link
Contributor Author

fastrde commented Aug 17, 2013

you're right. I doesn't think about that case. fixed and test added.

@mourner
Copy link
Member

mourner commented Aug 17, 2013

I meant automatic test in the spec folder :)

@fastrde
Copy link
Contributor Author

fastrde commented Aug 18, 2013

Hi Vladimir,

please have a close look at the test, it's my first mocha testcase.

lg

fastrde

@mourner
Copy link
Member

mourner commented Aug 18, 2013

Looks good, congrats on your first test. :)

mourner added a commit that referenced this pull request Aug 18, 2013
Fix worldCopyJump set Center and Zoom first
@mourner mourner merged commit 1f6533d into Leaflet:master Aug 18, 2013
@fastrde fastrde deleted the FixworldCopyJump branch August 18, 2013 11:22
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.

2 participants