[gnome-shell/gnome-42] padOsd: Figure out label/edition UI positions from unchanged fonts
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-42] padOsd: Figure out label/edition UI positions from unchanged fonts
- Date: Sat, 17 Sep 2022 17:44:29 +0000 (UTC)
commit 26d82091262df1fe5f76f653e23da98d0308a93f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Apr 30 14:09:37 2022 +0200
padOsd: Figure out label/edition UI positions from unchanged fonts
We can figure out the position to render the text without resorting to
font sizes that make the whole text element sub-pixel size. As the
original labels in the SVG are themed invisible anyway, calculate the
button/ring/strip label and configuration UI position from their
unchanged
size/location.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5415
Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2288>
(cherry picked from commit a89d2aed841618f826316db3a5767bffc9bc7c43)
data/theme/pad-osd.css | 1 -
js/ui/padOsd.js | 18 +++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/data/theme/pad-osd.css b/data/theme/pad-osd.css
index 31c2377228..e0c904847a 100644
--- a/data/theme/pad-osd.css
+++ b/data/theme/pad-osd.css
@@ -19,7 +19,6 @@
.Label {
stroke: none !important;
stroke-width: .1 !important;
- font-size: .1 !important;
fill: transparent !important;
}
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index b273b0ce87..a4125424ab 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -485,23 +485,23 @@ var PadDiagram = GObject.registerClass({
if (this._handle == null)
return [false];
- let leaderPos, leaderSize, pos;
- let found, direction;
-
- [found, pos] = this._handle.get_position_sub(`#${labelName}`);
- if (!found)
+ const [labelFound, labelPos] = this._handle.get_position_sub(`#${labelName}`);
+ const [, labelSize] = this._handle.get_dimensions_sub(`#${labelName}`);
+ if (!labelFound)
return [false];
- [found, leaderPos] = this._handle.get_position_sub(`#${leaderName}`);
- [found, leaderSize] = this._handle.get_dimensions_sub(`#${leaderName}`);
- if (!found)
+ const [leaderFound, leaderPos] = this._handle.get_position_sub(`#${leaderName}`);
+ const [, leaderSize] = this._handle.get_dimensions_sub(`#${leaderName}`);
+ if (!leaderFound)
return [false];
- if (pos.x > leaderPos.x + leaderSize.width)
+ let direction;
+ if (labelPos.x > leaderPos.x + leaderSize.width)
direction = LTR;
else
direction = RTL;
+ let pos = { x: labelPos.x, y: labelPos.y + labelSize.height };
if (this.leftHanded) {
direction = 1 - direction;
pos.x = this._imageWidth - pos.x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]