diff options
author | Arseniy Movshev <dodoradio@outlook.com> | 2022-11-27 12:38:32 +0000 |
---|---|---|
committer | Arseniy Movshev <dodoradio@outlook.com> | 2023-01-07 14:51:58 +0000 |
commit | de2b3d293d97eb85dc920e6facec684e79c69d43 (patch) | |
tree | cc71c7f5acc537d6b74b64535bdb7d72c51c2fa0 | |
parent | d6bd9347a59df2808676a549ba81df12ecfc2d3d (diff) |
Add functionality to center view button
Diffstat (limited to '')
-rw-r--r-- | src/DefaultMapControls.qml | 1 | ||||
-rw-r--r-- | src/MainMapView.qml | 6 | ||||
-rw-r--r-- | src/main.qml | 3 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/DefaultMapControls.qml b/src/DefaultMapControls.qml index b6a35de..9698d21 100644 --- a/src/DefaultMapControls.qml +++ b/src/DefaultMapControls.qml @@ -30,6 +30,7 @@ Item { width: height iconColor: "blue" z: 2 + onClicked: positionProvider.update() } IconButton { iconName: "ios-menu-outline" diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 39a4b8e..5042d24 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -36,6 +36,12 @@ Item { Component.onCompleted: { zoomLevel = mapZoom.value; center.latitude = mapCenterLat.value; center.longitude = mapCenterLong.value; console.log(mapCenterLat.value,mapCenterLong.value)} onZoomLevelChanged: mapZoom.value = zoomLevel onCenterChanged: {mapCenterLat.value = center.latitude; mapCenterLong.value = center.longitude; console.log(center)} + Connections { + target: positionProvider + function onPositionChanged() { + center = positionProvider.position.coordinate + } + } } DefaultMapControls { id: mapControls diff --git a/src/main.qml b/src/main.qml index 12ca9de..49abcb6 100644 --- a/src/main.qml +++ b/src/main.qml @@ -17,6 +17,9 @@ Application { id: mapProvider name: "osm" } + PositionSource { + id: positionProvider + } LayerStack { id: pageStack anchors.fill: parent |