manubb / Leaflet.PixiOverlay

Bring Pixi.js power to Leaflet maps
MIT License
463 stars 85 forks source link

No layer update during flyTo #27

Closed maxel-inc closed 5 years ago

maxel-inc commented 5 years ago

When map.flyTo or map.flyToBounds pixi scene updated only on last frame. During "flying" no animation at all. The same problem with fast zoom scrolling.

Why?

manubb commented 5 years ago

The pixi scene is updated on moveend by default so this is expected behavior. You can try to add this listener:

map.on('move', pixiLayer._update, pixiLayer);

However, ideally, the listener should only be added during the flyTo animation. I do not understand what you mean:

The same problem with fast zoom scrolling.

Can you clarify, please?

manubb commented 5 years ago

Update: you can filter move events in the following way:

map.on('move', (e) => {
  if (e && e.flyTo) {pixiLayer._update(e);}
});

Can you tell if this is working correctly? (If so, i will consider adding this to the lib as default behavior.)

manubb commented 5 years ago

I've added support for redraws during flyTo animation in v1.8.0:

var pixiOverlay = L.pixiOverlay(drawCb, pixiContainer, {
  shouldRedrawOnMove: e => e.flyTo
});

I do not think that anything can be done for refreshing during fast mousewheel scroll.