mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
mapwidget.qml: add the animateMapTo() helper function
To be used to center the map on a dive location or reset the map if a dive from the dive list doesn't have GPS coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
033eec9500
commit
a8f6c99fc0
1 changed files with 9 additions and 4 deletions
|
@ -25,6 +25,7 @@ Item {
|
|||
|
||||
readonly property var defaultCenter: QtPositioning.coordinate(0, 0)
|
||||
readonly property var defaultZoomIn: 17.0
|
||||
readonly property var defaultZoomOut: 2.0
|
||||
property var newCenter: defaultCenter
|
||||
property var newZoom: 1.0
|
||||
|
||||
|
@ -86,11 +87,15 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function centerOnMapLocation(mapLocation) {
|
||||
map.newCenter = mapLocation.coordinate
|
||||
map.zoomLevel = 2
|
||||
map.newZoom = map.defaultZoomIn
|
||||
function animateMapTo(coord, zoom) {
|
||||
map.newCenter = coord
|
||||
map.newZoom = zoom
|
||||
mapAnimation.restart()
|
||||
}
|
||||
|
||||
function centerOnMapLocation(mapLocation) {
|
||||
map.zoomLevel = map.defaultZoomOut
|
||||
animateMapTo(mapLocation.coordinate, map.defaultZoomIn);
|
||||
mapHelper.model.selectedUuid = mapLocation.uuid
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue