Skip to content

Instantly share code, notes, and snippets.

@otsaloma
Created March 17, 2018 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otsaloma/3cde281a48285480f946289c75ae4d8d to your computer and use it in GitHub Desktop.
Save otsaloma/3cde281a48285480f946289c75ae4d8d to your computer and use it in GitHub Desktop.
Fake position in WhoGo Maps for testing
diff --git a/qml/Map.qml b/qml/Map.qml
index edb95f3..8c74c35 100644
--- a/qml/Map.qml
+++ b/qml/Map.qml
@@ -138,7 +138,7 @@ MapboxMap {
}
onPositionChanged: {
- map.autoCenter && map.centerOnPosition();
+ // map.autoCenter && map.centerOnPosition();
}
function _addManeuver(maneuver) {
diff --git a/qml/NarrationTimer.qml b/qml/NarrationTimer.qml
index 23db615..563db47 100644
--- a/qml/NarrationTimer.qml
+++ b/qml/NarrationTimer.qml
@@ -37,7 +37,7 @@ Timer {
onTriggered: {
// Query maneuver narrative from Python and update status.
if (!py.ready) return;
- var coord = map.position.coordinate;
+ var coord = map.center;
if (coord.distanceTo(timer.coordPrev) < 10) return;
var accuracy = map.position.horizontalAccuracyValid ?
map.position.horizontalAccuracy : null;
diff --git a/qml/PositionMarker.qml b/qml/PositionMarker.qml
index 9898ae3..afbfeba 100644
--- a/qml/PositionMarker.qml
+++ b/qml/PositionMarker.qml
@@ -40,7 +40,7 @@ Item {
Connections {
target: map
onDirectionChanged: marker.updateDirection();
- onPositionChanged: map.updateSourcePoint(marker.source, map.position.coordinate);
+ onPositionChanged: map.updateSourcePoint(marker.source, map.center);
}
Component.onCompleted: {
@@ -63,7 +63,7 @@ Item {
}
function initLayers() {
- map.addSourcePoint(marker.source, map.position.coordinate);
+ map.addSourcePoint(marker.source, map.center);
map.addImagePath(marker.images.still, Qt.resolvedUrl(app.getIcon("icons/position")));
map.addImagePath(marker.images.moving, Qt.resolvedUrl(app.getIcon("icons/position-direction")));
map.addLayer(marker.layers.still, {"type": "symbol", "source": marker.source});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment