diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-20 00:22:52 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | a8f6c99fc0f519760c0632626b4d52eac8d2410d (patch) | |
tree | 564d51f22b9adb191cc2f48bab3e5e111e64251a /mobile-widgets | |
parent | 033eec9500975f1482b03b8706359d733482beec (diff) | |
download | subsurface-a8f6c99fc0f519760c0632626b4d52eac8d2410d.tar.gz |
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>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/MapWidget.qml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml index 17b93c773..83ed48c4a 100644 --- a/mobile-widgets/qml/MapWidget.qml +++ b/mobile-widgets/qml/MapWidget.qml @@ -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 } } |