Skip to content

Commit

Permalink
add option to search around pinned place
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Oct 13, 2023
1 parent 5d3e2f8 commit 7ea071f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
43 changes: 43 additions & 0 deletions gui/controls2_509/MapView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ MapPage {
},
State {
name: "locationInfo"
PropertyChanges { target: searchAroundPlace; visible: true; }
PropertyChanges { target: addFavorite; visible: true; }
PropertyChanges { target: goThere; visible: true; }
},
Expand Down Expand Up @@ -586,6 +587,48 @@ MapPage {
}
}
}
// Search around place. The button is visible in state 'locationInfo'
MapIcon {
id: searchAroundPlace
visible: false
z: 1
anchors.bottom: parent.bottom
anchors.left: addFavorite.right
anchors.margins: units.gu(1)
source: "qrc:/images/trip/search.svg"
color: "black"
backgroundColor: "white"
borderPadding: units.gu(1.0)
opacity: 0.7
height: units.gu(6)
onClicked: {
var page = stackView.push("qrc:/controls2/SearchPlace.qml", {
"searchCenterLat": popLocationInfo.placeLat,
"searchCenterLon": popLocationInfo.placeLon,
"acceptLabel": qsTr("Go"),
"acceptIcon" : "qrc:/images/trip/navigator.svg",
"showPositionEnabled": true
});
ToolBox.connectOnce(page.selectLocation, function(location, lat, lon, label){
if (lat !== NaN && lon !== NaN && label !== "") {
popRouting.goTo(lat, lon, label);
}
});
ToolBox.connectOnce(page.showPosition, function(lat, lon){
if (lat !== NaN && lon !== NaN) {
map.showCoordinatesInstantly(lat, lon);
mark.showOverlay = true;
mark.lat = lat;
mark.lon = lon;
mark.screenX = map.width / 2;
mark.screenY = map.height / 2;
if (navigation)
navigation = false;
popLocationInfo.show();
}
});
}
}


////////////////////////////////////////////////////////////////////////////
Expand Down
43 changes: 43 additions & 0 deletions gui/controls2_515/MapView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ MapPage {
},
State {
name: "locationInfo"
PropertyChanges { target: searchAroundPlace; visible: true; }
PropertyChanges { target: addFavorite; visible: true; }
PropertyChanges { target: goThere; visible: true; }
},
Expand Down Expand Up @@ -586,6 +587,48 @@ MapPage {
}
}
}
// Search around place. The button is visible in state 'locationInfo'
MapIcon {
id: searchAroundPlace
visible: false
z: 1
anchors.bottom: parent.bottom
anchors.left: addFavorite.right
anchors.margins: units.gu(1)
source: "qrc:/images/trip/search.svg"
color: "black"
backgroundColor: "white"
borderPadding: units.gu(1.0)
opacity: 0.7
height: units.gu(6)
onClicked: {
var page = stackView.push("qrc:/controls2/SearchPlace.qml", {
"searchCenterLat": popLocationInfo.placeLat,
"searchCenterLon": popLocationInfo.placeLon,
"acceptLabel": qsTr("Go"),
"acceptIcon" : "qrc:/images/trip/navigator.svg",
"showPositionEnabled": true
});
ToolBox.connectOnce(page.selectLocation, function(location, lat, lon, label){
if (lat !== NaN && lon !== NaN && label !== "") {
popRouting.goTo(lat, lon, label);
}
});
ToolBox.connectOnce(page.showPosition, function(lat, lon){
if (lat !== NaN && lon !== NaN) {
map.showCoordinatesInstantly(lat, lon);
mark.showOverlay = true;
mark.lat = lat;
mark.lon = lon;
mark.screenX = map.width / 2;
mark.screenY = map.height / 2;
if (navigation)
navigation = false;
popLocationInfo.show();
}
});
}
}


////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7ea071f

Please sign in to comment.