summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <[email protected]>2015-09-07 15:12:36 +0200
committerDennis Nienhüser <[email protected]>2015-09-08 12:31:22 +0200
commit38ff5081075df3edd0f10a5cfe97f13b3cb993cc (patch)
tree775b61e308ab72428640db120a047b93ce029405
parent55021356489e6a56a44b12b41f5df85e06960aac (diff)
Center on waypoints when selecting them
-rw-r--r--src/apps/marble-maps/RouteEditor.qml7
-rw-r--r--src/lib/marble/declarative/MarbleQuickItem.cpp5
-rw-r--r--src/lib/marble/declarative/MarbleQuickItem.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/src/apps/marble-maps/RouteEditor.qml b/src/apps/marble-maps/RouteEditor.qml
index 01c49dd..d1a9c2d 100644
--- a/src/apps/marble-maps/RouteEditor.qml
+++ b/src/apps/marble-maps/RouteEditor.qml
@@ -110,7 +110,12 @@ Item {
id: touchArea
anchors.fill: parent
onClicked: {
- waypointList.currentIndex = index === waypointList.currentIndex ? -1 : index;
+ if (index === waypointList.currentIndex) {
+ waypointList.currentIndex = -1
+ } else {
+ waypointList.currentIndex = index
+ marbleMaps.centerOn(longitude, latitude)
+ }
}
}
diff --git a/src/lib/marble/declarative/MarbleQuickItem.cpp b/src/lib/marble/declarative/MarbleQuickItem.cpp
index a7dd17f..f0a412b 100644
--- a/src/lib/marble/declarative/MarbleQuickItem.cpp
+++ b/src/lib/marble/declarative/MarbleQuickItem.cpp
@@ -440,6 +440,11 @@ namespace Marble
d->flyTo(target, Automatic);
}
+ void MarbleQuickItem::centerOn(qreal longitude, qreal latitude)
+ {
+ d->centerOn(longitude, latitude);
+ }
+
void MarbleQuickItem::centerOnCurrentPosition()
{
GeoDataCoordinates coordinates = d->model()->positionTracking()->currentLocation();
diff --git a/src/lib/marble/declarative/MarbleQuickItem.h b/src/lib/marble/declarative/MarbleQuickItem.h
index f56dfef..fd0aaad 100644
--- a/src/lib/marble/declarative/MarbleQuickItem.h
+++ b/src/lib/marble/declarative/MarbleQuickItem.h
@@ -80,6 +80,7 @@ namespace Marble
void centerOn(const GeoDataPlacemark& placemark, bool animated = false);
void centerOn(const GeoDataLatLonBox& box, bool animated = false);
void centerOn(const GeoDataCoordinates& coordinate);
+ void centerOn(qreal longitude, qreal latitude);
Q_INVOKABLE void centerOnCurrentPosition();
void zoomIn(FlyToMode mode = Automatic);