[gnome-maps] placeBar: Hide on tapping the map
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] placeBar: Hide on tapping the map
- Date: Tue, 9 Feb 2021 20:56:57 +0000 (UTC)
commit 6132b3560532a500ab0efcd3102ca2e6aaff2485
Author: James Westman <james flyingpimonster net>
Date: Sat Jan 9 20:09:31 2021 -0600
placeBar: Hide on tapping the map
When you tap (not drag) the map outside the marker, the place bar is hidden.
This only works for touch events, not mouse.
src/placeBar.js | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/src/placeBar.js b/src/placeBar.js
index 72aae6e2..e3ee3529 100644
--- a/src/placeBar.js
+++ b/src/placeBar.js
@@ -19,6 +19,7 @@
* Author: James Westman <james flyingpimonster net>
*/
+const Clutter = imports.gi.Clutter;
const Gdk = imports.gi.Gdk;
const Geocode = imports.gi.GeocodeGlib;
const GObject = imports.gi.GObject;
@@ -64,6 +65,8 @@ var PlaceBar = GObject.registerClass({
Application.application.connect('notify::adaptive-mode', this._updateVisibility.bind(this));
this.connect('notify::place', this._updatePlace.bind(this));
+
+ this._mapView.view.connect('touch-event', this._onMapClickEvent.bind(this));
}
_updatePlace() {
@@ -114,4 +117,22 @@ var PlaceBar = GObject.registerClass({
_onPlaceEdited() {
_updatePlace();
}
+
+ _onMapClickEvent(view, event) {
+ switch (event.type()) {
+ case Clutter.EventType.TOUCH_BEGIN:
+ this._tapped = true;
+ break;
+ case Clutter.EventType.TOUCH_UPDATE:
+ this._tapped = false;
+ case Clutter.EventType.TOUCH_END:
+ case Clutter.EventType.TOUCH_CANCEL:
+ if (this._tapped) {
+ Application.application.selected_place = null;
+ }
+ break;
+ }
+
+ return Clutter.EVENT_PROPAGATE;
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]