mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mapwidget.qml: add double click on zoom
Double clicking a marker or the newly added MouseArea now performs a +2 zoom-in over a period of 500ms and centers on that clicked coordinate. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
f1020a02ce
commit
38d9759198
1 changed files with 25 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue