[gnome-maps/wip/mlundblad/location-marker-fixes: 2/3] userLocationMarker: Restrict accuracy circle to both widh and height
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/location-marker-fixes: 2/3] userLocationMarker: Restrict accuracy circle to both widh and height
- Date: Fri, 29 May 2020 19:39:30 +0000 (UTC)
commit 98719957ca39ced4dd1f5aa2f8185083ade5ad4e
Author: Marcus Lundblad <ml update uu se>
Date: Mon May 25 22:10:38 2020 +0200
userLocationMarker: Restrict accuracy circle to both widh and height
Only show the accuracy circle when both the view height
and width would fit it. Also update the visibilty when
the view size changes, not just the zoom level.
src/userLocationMarker.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/userLocationMarker.js b/src/userLocationMarker.js
index cb4b4189..be5d69eb 100644
--- a/src/userLocationMarker.js
+++ b/src/userLocationMarker.js
@@ -55,7 +55,7 @@ class AccuracyCirleMarker extends Champlain.Point {
this.longitude);
let size = this.place.location.accuracy * 2 / metersPerPixel;
- if (size > view.width && size > view.height)
+ if (size > view.width || size > view.height)
this.hide();
else {
this.size = size;
@@ -73,9 +73,13 @@ class UserLocationMarker extends MapMarker.MapMarker {
this._accuracyMarker = new AccuracyCircleMarker({ place: this.place });
this.connect('notify::view-zoom-level',
() => this._accuracyMarker.refreshGeometry(this._view));
- this._accuracyMarker.refreshGeometry(this._view);
+ this._view.connect('notify::width',
+ () => this._accuracyMarker.refreshGeometry(this._view));
+ this._view.connect('notify::height',
+ () => this._accuracyMarker.refreshGeometry(this._view));
+ this._accuracyMarker.refreshGeometry(this._view);
- this.place.connect('notify::location', this._updateLocation.bind(this));
+ this.place.connect('notify::location', () => this._updateLocation());
this._updateLocation();
this.connect('notify::visible', this._updateAccuracyCircle.bind(this));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]