Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom level not being detected correctly #9

Open
pfeely opened this issue Jul 13, 2016 · 1 comment
Open

Zoom level not being detected correctly #9

pfeely opened this issue Jul 13, 2016 · 1 comment

Comments

@pfeely
Copy link

pfeely commented Jul 13, 2016

Not sure if this is related to a Leaflet version change (Using RC 1.0.0) or a bug in the plugin

The following function is assuming zoom as a second parameter

getTileUrl: function (tilePoint,zoom) { // (Point, Number) -> String

But zoom is undefined and not available.

Further down the code uses "zoom=map.getZoom();" - but this cannot be relied up because the getTileUrl function is fired before the zoom end event
So when you zoom in and out it uses the old zoom level and gets the tile calculation wrong - which can throw an error from the WMTS service

Solution:

getTileUrl: function (tilePoint) { var map = this._map; var zoom = tilePoint.z; //Next zoom level

@pfeely pfeely changed the title Zoom level not being detected correctly with Zoom level not being detected correctly Jul 13, 2016
@teriblus
Copy link

Just went through this bug as well, I fixed it differently:

var zoom = (typeof map._animateToZoom == 'undefined') ? map.getZoom() : map._animateToZoom;

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

No branches or pull requests

2 participants