[gnome-maps/gnome-3-28] mapMarker: Enable selecting markers with touch
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/gnome-3-28] mapMarker: Enable selecting markers with touch
- Date: Wed, 11 Apr 2018 21:28:06 +0000 (UTC)
commit d3dae3b70d90ef8d4233d574aec72f6980f8825e
Author: Marcus Lundblad <ml update uu se>
Date: Wed Apr 11 23:18:39 2018 +0200
mapMarker: Enable selecting markers with touch
Make markers selectable by touch. Also make touch events
(panning) on the background map view de-select them to
be consistence with the normal behaviour with mouse-based
events.
Closes #11
src/mapMarker.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/src/mapMarker.js b/src/mapMarker.js
index f73fc91..3e61473 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -72,6 +72,7 @@ var MapMarker = GObject.registerClass({
this._view = this._mapView.view;
this.connect('notify::selected', this._onMarkerSelected.bind(this));
this.connect('button-press', this._onButtonPress.bind(this));
+ this.connect('touch-event', this._onTouchEvent.bind(this));
// Some markers are draggable, we want to sync the marker location and
// the location saved in the GeocodePlace
@@ -158,6 +159,13 @@ var MapMarker = GObject.registerClass({
}
}
+ _onTouchEvent(marker, event) {
+ if (event.type() == Clutter.EventType.TOUCH_BEGIN)
+ this.selected = true;
+
+ return Clutter.EVENT_STOP;
+ }
+
_translateMarkerPosition() {
this.set_translation(-this.anchor.x, -this.anchor.y, 0);
}
@@ -270,6 +278,9 @@ var MapMarker = GObject.registerClass({
this.selected = false;
});
+ let viewTouchEventSignalId =
+ this._view.connect('touch-event', () => this.set_selected(false));
+
let goingToSignalId = this._mapView.connect('going-to', () => {
this.set_selected(false);
});
@@ -288,6 +299,7 @@ var MapMarker = GObject.registerClass({
this._mapView.disconnect(markerSelectedSignalId);
this._mapView.disconnect(goingToSignalId);
this._view.disconnect(buttonPressSignalId);
+ this._view.disconnect(viewTouchEventSignalId);
this.disconnect(parentSetSignalId);
this.disconnect(dragMotionSignalId);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]