gluonhq / maps

https://gluonhq.com/labs/maps/
GNU General Public License v3.0
137 stars 34 forks source link

layoutLayer ceases to be called when MapView is wrapped by another container #49

Open jperedadnr opened 4 years ago

jperedadnr commented 4 years ago

A layer (PoiLayer) added to MapView gets synchronized with the underlying map (translation and zoom). However, when the MapView is child of another container, at some point the layoutLayer call ceases and the PoiLayer is not synced for a while.

jperedadnr commented 4 years ago

Possible fix in MapView:

protected void markDirty() {
        dirty = true;
        Parent p = this;
        while (p != null) {
            p.setNeedsLayout(true);
            p = p.getParent();
        }
    }

however Parent::setNeedsLayout is protected.

This works in any case:

protected void markDirty() {
        dirty = true;
        this.requestLayout();
    }
ctipper commented 2 years ago

I've run into this with a MapView not updating BaseMap whilst panning inside a container. I really don't understand what is going on, but something to do with layoutChildren not being called until a call to MapView.getLayoutBounds.