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

Tiles not loading after setView on mobile #3659

Closed
Trufi opened this issue Jul 23, 2015 · 7 comments
Closed

Tiles not loading after setView on mobile #3659

Trufi opened this issue Jul 23, 2015 · 7 comments
Assignees
Labels
Milestone

Comments

@Trufi
Copy link
Contributor

Trufi commented Jul 23, 2015

Tiles not loading If you open the following code to the mobile phone:

var map = L.map('map', {
    center: [54.980206086231, 82.898068362003],
    zoom: 5
});

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

map.setZoom(9, {animate: false});
@mourner
Copy link
Member

mourner commented Jul 23, 2015

Will look into it, thanks!

@Trufi
Copy link
Contributor Author

Trufi commented Jul 29, 2015

@mourner can you explain why condition is necessary in this line? https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/GridLayer.js#L359

if remove if statement and apply this._update(center, tileZoom); on mobile, the problem go away.

@osro
Copy link

osro commented Aug 3, 2015

Yep, this seems to happen on mobile devices and also on desktop Chrome when you enable "device mode" from the developer tools.

@yohanboniface
Copy link
Member

@mourner can you explain why condition is necessary in this line? https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/GridLayer.js#L359

Part of the answer is here: 142e066

@yohanboniface
Copy link
Member

Should be fixed by #3815.

@Nikitozz13
Copy link

Hi @mourner. I have a similar bug on mobile devices (iPhone 7 for example).

Initializing map with a specific zoom gets the following:
img_0664

I can workaround it with:

setTimeout( function() {
    map.setView(coordinates, endZoom);
}, 200);

Also I noticed that marker size and anchor options ignoring on mobile devices so marker presentation on desktop and mobile devices differs.
Desktop:
2018-04-09 14 50 25
Mobile device:
img_0665
I can workaround it only with className attribute and css.

Any thoughts?

@ghybs
Copy link
Collaborator

ghybs commented Apr 10, 2018

Hi @Nikitozz13, great to hear that you find Leaflet useful!

If you are really sure that this is a bug in Leaflet, please open a new issue rather than commenting a closed very old ticket.
Make sure to provide all the information requested in the issue template.

For questions on using Leaflet, please use Stack Overflow or GIS Stack Exchange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants