Zoom/center the page map so that all locations are in view

This commit is contained in:
Volker Krause
2023-06-18 11:08:03 +02:00
parent a3b8168744
commit 64a1316f9b
5 changed files with 79 additions and 0 deletions

View File

@@ -23,8 +23,15 @@ Kirigami.Page {
anchors.fill: parent
plugin: OsmLocationPlugin.plugin
center: {
let c = LocationHelper.center(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox));
return QtPositioning.coordinate(c.y, c.x);
}
zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), map.width, map.height)
MapItemView {
model: LocationsModel {
id: locationsModel
room: locationsPage.room
}
delegate: LocationMapItem {
@@ -34,6 +41,7 @@ Kirigami.Page {
MapItemView {
model: LiveLocationsModel {
id: liveLocationsModel
room: locationsPage.room
}
delegate: LocationMapItem {}