gluonhq / maps

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

MapView does not update prefCenter and prefZoom #69

Open ctipper opened 2 years ago

ctipper commented 2 years ago

In the course of trying to integrate this as a library it has become apparent that MapView updates BaseMap coordinate and zoom via the variables prefCenterLat, prefCenterLon and prefZoom exactly once and that these variables are never updated again as the user zooms and pans the MapView. Consequently a library user has no way of persisting the state of the map and it is not really suitable to be used as a library. There are other issues in particular the private InputEvent handlers which can be worked around with EventFilters, but currently this is not suitable for my purposes.

ctipper commented 2 years ago

The MapView.getMapPosition appears to return lon and lat but this is not clear from variable names. I might have to withdraw this issue, but it is frustrating that there is no access to underlying BaseMap from MapView, this would allow access to the BaseMap readOnlyProperties.

ctipper commented 2 years ago

MapView.getZoom returns BaseMap.prefZoom so still no way to retrieve last zoom level from MapView.

ctipper commented 2 years ago

I've examined the options and it seems I only need in MapView

public double getMapZoom() {
    return baseMap.zoom().get();
}

I don't know the likelihood of getting a PR accepted I've never done a pull request before.

ctipper commented 1 year ago

For the same project I've also had need of this function in MapView

public void moveMap(double x, double y) {
        baseMap.moveX(x);
        baseMap.moveY(y);
    }