mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
mapwidget.qml: implement some map animation
When calling centerOnCoordinates() the map will now animate over a period of 3 seconds the zoom level and over 2 seconds the center of the map. Can be tweaked and improved later on. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
5f2e60142a
commit
0678e5936c
1 changed files with 23 additions and 2 deletions
|
@ -23,13 +23,34 @@ Item {
|
|||
plugin: mapPlugin
|
||||
zoomLevel: 1
|
||||
|
||||
property var newCenter: QtPositioning.coordinate(0, 0);
|
||||
|
||||
Component.onCompleted: {
|
||||
map.activeMapType = map.supportedMapTypes[esriMapTypeIndexes.SATELLITE];
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
id: mapAnimation
|
||||
|
||||
CoordinateAnimation {
|
||||
target: map
|
||||
property: "center"
|
||||
to: map.newCenter
|
||||
duration: 2000
|
||||
}
|
||||
NumberAnimation {
|
||||
target: map
|
||||
property: "zoomLevel"
|
||||
to: 17
|
||||
duration: 3000
|
||||
easing.type: Easing.InCubic
|
||||
}
|
||||
}
|
||||
|
||||
function centerOnCoordinates(latitude, longitude) {
|
||||
map.center = QtPositioning.coordinate(latitude, longitude);
|
||||
map.zoomLevel = map.maximumZoomLevel * 0.9;
|
||||
map.newCenter = QtPositioning.coordinate(latitude, longitude);
|
||||
map.zoomLevel = 2;
|
||||
mapAnimation.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue