angular-ui / ui-leaflet

AngularJS directive to embed an interact with maps managed by Leaflet library
http://angular-ui.github.io/ui-leaflet
Other
314 stars 134 forks source link

Slow performance when calling getMap().then(function(){}); but not getMap(); #167

Open nmccready opened 9 years ago

nmccready commented 9 years ago

From @facultymatt on September 26, 2014 3:8

I'm tracking down a performance critter. I use $interval to constantly center the map. Seems that getMap().then(function() {}) causes a performance hit while getMap() does not. The code is below.

function centerOnTrip(data, mapName) {
      if(!data) {
        return;
      };
      leafletData.getMap(mapName).then(function doCenter(map) {
        console.timeEnd('get map');
      });
}

Copied from original issue: tombatossals/angular-leaflet-directive#483

nmccready commented 9 years ago

From @facultymatt on September 26, 2014 3:53

This is likely related to https://github.com/tombatossals/angular-leaflet-directive/issues/424

I tried removing the ID and removing all other maps on the page and the performance bug appeared gone...

nmccready commented 9 years ago

@facultymatt is this still an issue? If so can you make an example? Or a spec.