summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/DefaultMapControls.qml1
-rw-r--r--src/MainMapView.qml6
-rw-r--r--src/main.qml3
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