mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +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 defaultCenter: QtPositioning.coordinate(0, 0)
|
||||||
readonly property var defaultZoomIn: 17.0
|
readonly property var defaultZoomIn: 17.0
|
||||||
|
readonly property var defaultZoomOut: 2.0
|
||||||
property var newCenter: defaultCenter
|
property var newCenter: defaultCenter
|
||||||
property var newZoom: 1.0
|
property var newZoom: 1.0
|
||||||
|
|
||||||
|
@ -86,11 +87,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerOnMapLocation(mapLocation) {
|
function animateMapTo(coord, zoom) {
|
||||||
map.newCenter = mapLocation.coordinate
|
map.newCenter = coord
|
||||||
map.zoomLevel = 2
|
map.newZoom = zoom
|
||||||
map.newZoom = map.defaultZoomIn
|
|
||||||
mapAnimation.restart()
|
mapAnimation.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
function centerOnMapLocation(mapLocation) {
|
||||||
|
map.zoomLevel = map.defaultZoomOut
|
||||||
|
animateMapTo(mapLocation.coordinate, map.defaultZoomIn);
|
||||||
mapHelper.model.selectedUuid = mapLocation.uuid
|
mapHelper.model.selectedUuid = mapLocation.uuid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue