summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2020-06-29 22:44:36 +0200
committerMarcus Lundblad <ml@update.uu.se>2020-06-29 22:50:17 +0200
commitd458be52151f3b753a5750ea8db8c042b97fb18f (patch)
treeb49f203c10734213154578296b3dbcc71d39ea4d
parent3aa9154d3150275a3b9361e71187a2db59d72545 (diff)
downloadgnome-maps-wip/mlundblad/attribution-logo-ltr.tar.gz
mapSource: Adjust attribution logo padding for RTLwip/mlundblad/attribution-logo-ltr
In RTL locales, the scale is on the right corner, where the attribution logo currently is rendered, interfering with it. Adjust the padding in this case to allow space for the scale.
-rw-r--r--src/mapSource.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mapSource.js b/src/mapSource.js
index 29671006..b653b42b 100644
--- a/src/mapSource.js
+++ b/src/mapSource.js
@@ -37,6 +37,8 @@ const _MEMORY_CACHE_SIZE_LIMIT = 100; /* number of tiles */
const _LOGO_PADDING_X = 10;
const _LOGO_PADDING_Y = 25;
+// extra pading below logo in RTL, where scale will be on the right side
+const _LOGO_PADDING_Y_RTL = 35;
var AttributionLogo = GObject.registerClass({},
class AttributionLogo extends GtkClutter.Actor {
@@ -49,6 +51,7 @@ class AttributionLogo extends GtkClutter.Actor {
else
return;
+ this._rtl = Gtk.get_locale_direction() === Gtk.TextDirection.RTL;
view.connect('notify::width', () => this._updatePosition(view));
view.connect('notify::height', () => this._updatePosition(view));
@@ -58,9 +61,16 @@ class AttributionLogo extends GtkClutter.Actor {
_updatePosition(view) {
let width = _attributionImage.pixbuf.width;
let height = _attributionImage.pixbuf.height;
-
- this.set_position(view.width - width - _LOGO_PADDING_X,
- view.height - height - _LOGO_PADDING_Y);
+ let x = view.width - width - _LOGO_PADDING_X;
+ /* TODO: ideally the attribution logo should be aligned to the left
+ * side in RTL locales, but I couldn't get that working with Clutter
+ * actor positioning, so adjust the padding to fit above the scale
+ * for now
+ */
+ let y = view.height - height -
+ (this._rtl ? _LOGO_PADDING_Y_RTL : _LOGO_PADDING_Y);
+
+ this.set_position(x, y);
}
});