diff options
Diffstat (limited to 'mobile-widgets/qml/MapWidget.qml')
-rw-r--r-- | mobile-widgets/qml/MapWidget.qml | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml index a8eb7550e..0f0bca05e 100644 --- a/mobile-widgets/qml/MapWidget.qml +++ b/mobile-widgets/qml/MapWidget.qml @@ -31,8 +31,10 @@ Item { readonly property var defaultCenter: QtPositioning.coordinate(0, 0) readonly property var defaultZoomIn: 17.0 readonly property var defaultZoomOut: 1.0 + readonly property var zoomStep: 2.0 property var newCenter: defaultCenter property var newZoom: 1.0 + property var clickCoord: QtPositioning.coordinate(0, 0); Component.onCompleted: { activeMapType = mapType.SATELLITE @@ -65,10 +67,8 @@ Item { MouseArea { anchors.fill: parent - onClicked: { - mapHelper.model.setSelectedUuid(model.uuid, true) - mapItemImageAnimation.restart() - } + onClicked: mapHelper.model.setSelectedUuid(model.uuid, true) + onDoubleClicked: map.doubleClickHandler(model.coordinate) } } } @@ -96,6 +96,27 @@ Item { } } + ParallelAnimation { + id: mapAnimationClick + CoordinateAnimation { + target: map; property: "center"; to: map.newCenter; duration: 500 + } + NumberAnimation { + target: map; property: "zoomLevel"; to: map.newZoom; duration: 500 + } + } + + MouseArea { + anchors.fill: parent + onDoubleClicked: map.doubleClickHandler(map.toCoordinate(Qt.point(mouseX, mouseY))) + } + + function doubleClickHandler(coord) { + newCenter = coord + newZoom = zoomLevel + zoomStep + mapAnimationClick.restart() + } + function animateMapZoomIn(coord) { zoomLevel = defaultZoomOut newCenter = coord |