[gnome-maps/goto-fixes: 1/2] mapLocation: Wait for ensureVisible animation to complete
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/goto-fixes: 1/2] mapLocation: Wait for ensureVisible animation to complete
- Date: Wed, 17 Apr 2013 16:19:32 +0000 (UTC)
commit c187368be29b2e565380595764d53002fa86b135
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Apr 17 18:50:37 2013 +0300
mapLocation: Wait for ensureVisible animation to complete
This fixes the weird glitch of map going to some random location. This
requires my patch to libchamplain:
https://bugzilla.gnome.org/show_bug.cgi?id=698213
src/mapLocation.js | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/mapLocation.js b/src/mapLocation.js
index ac9c326..ee19c6e 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -65,20 +65,24 @@ const MapLocation = new Lang.Class({
locations[0] = new Geocode.Location({ latitude: this._view.get_center_latitude(),
longitude: this._view.get_center_longitude() });
locations[1] = this;
- this._mapView.ensureVisible(locations);
- let animCompletedId = this._view.connect("animation-completed::go-to", Lang.bind(this,
+ let animCompletedId = this._view.connect("animation-completed", Lang.bind(this,
function() {
- // Apparently the signal is called before animation is really complete so if we don't
- // zoom in idle, we get a crash. Perhaps a bug in libchamplain?
- Mainloop.idle_add(Lang.bind(this,
+ this._view.disconnect(animCompletedId);
+ animCompletedId = this._view.connect("animation-completed::go-to", Lang.bind(this,
function() {
- this._view.set_zoom_level(zoom);
- this.emit('gone-to');
+ // Apparently the signal is called before animation is really complete so if we don't
+ // zoom in idle, we get a crash. Perhaps a bug in libchamplain?
+ Mainloop.idle_add(Lang.bind(this,
+ function() {
+ this._view.set_zoom_level(zoom);
+ this.emit('gone-to');
+ }));
+ this._view.disconnect(animCompletedId);
}));
- this._view.disconnect(animCompletedId);
+ this._view.go_to(this.latitude, this.longitude);
}));
- this._view.go_to(this.latitude, this.longitude);
+ this._mapView.ensureVisible(locations);
},
show: function(layer) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]