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

CSS Flexbox With Leaflet Map #950

Closed
esetnik opened this issue Sep 19, 2015 · 7 comments
Closed

CSS Flexbox With Leaflet Map #950

esetnik opened this issue Sep 19, 2015 · 7 comments

Comments

@esetnik
Copy link

esetnik commented Sep 19, 2015

When using display: flex in conjunction with angular-leaflet-map I get issues with the tiles not loading. Even when scrolling around the map it seems like the plugin believes that the viewport is a different size.

Has anyone encountered this before?

screen shot 2015-09-19 at 2 25 26 am

@cgat
Copy link
Contributor

cgat commented Sep 19, 2015

This isn't an angular-leaflet-directive issue. I have the same problem. I've gotten around this by adding:

leafletData.getMap().then(function (map) { map.invalidateSize(); });

in a $timeout (where the invalidateSize() call happens after your map has initially flexed to size)

@esetnik
Copy link
Author

esetnik commented Sep 19, 2015

@cgat thanks that works!

@sdebionne
Copy link

I have the same problem as well. I run the $timeout from run(), but is it the right solution ?

myApp.run(function($timeout, leafletData) {
    $timeout(function() {
      leafletData.getMap().then(function (map) { map.invalidateSize(); });
    });

Has this issue been reported to leaflet ? Shall we reopen Leaflet/Leaflet#3072 ?

@nmccready
Copy link
Contributor

@sdebionne good point I would report it/reopen.

@nmccready
Copy link
Contributor

But a valid MCVE against raw leaflet is what they will want.

@adam-s
Copy link

adam-s commented Mar 20, 2016

@sdebionne The $timeout for the function call to map.invalidateSize(); should be in the next tick after the promise is resolved.

    .run(function($timeout, leafletData) {
        leafletData.getMap().then(function (map) {
            $timeout(function() {map.invalidateSize()});
        });
    });

@esetnik
Copy link
Author

esetnik commented Apr 21, 2016

This isn't working for me. It seems that the timeout is occurring before the flex layout finishes. I can get it to work by increasing the timeout duration but obviously this isn't ideal because the layout duration is device dependent.

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

6 participants