[gnome-maps/wip/mlundblad/attribution-logo-ltr: 2/2] mapSource: Adjust attribution logo padding for RTL
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/attribution-logo-ltr: 2/2] mapSource: Adjust attribution logo padding for RTL
- Date: Mon, 29 Jun 2020 20:52:03 +0000 (UTC)
commit d458be52151f3b753a5750ea8db8c042b97fb18f
Author: Marcus Lundblad <ml update uu se>
Date: Mon Jun 29 22:44:36 2020 +0200
mapSource: Adjust attribution logo padding for RTL
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.
src/mapSource.js | 16 +++++++++++++---
1 file 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);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]