[gnome-shell/wip/carlosg/magnifier-improvements: 6/11] magnifier: Transform a11y events' coordinates by scale factor
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/magnifier-improvements: 6/11] magnifier: Transform a11y events' coordinates by scale factor
- Date: Thu, 6 Feb 2020 14:26:34 +0000 (UTC)
commit 81b720719acde0ec8f4ee2befaa81eeb888d40f8
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Feb 6 10:59:20 2020 +0100
magnifier: Transform a11y events' coordinates by scale factor
We get those events in logical coordinates, which we have to transform
into actual pixels.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/984
js/ui/magnifier.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 2154effc92..850cb8a261 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -799,8 +799,9 @@ var ZoomRegion = class ZoomRegion {
return;
}
- let [xFocus, yFocus] = [extents.x + (extents.width / 2),
- extents.y + (extents.height / 2)];
+ let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+ let [xFocus, yFocus] = [(extents.x + (extents.width / 2)) * scaleFactor,
+ (extents.y + (extents.height / 2)) * scaleFactor];
if (this._xFocus != xFocus || this._yFocus != yFocus) {
[this._xFocus, this._yFocus] = [xFocus, yFocus];
@@ -820,7 +821,8 @@ var ZoomRegion = class ZoomRegion {
return;
}
- let [xCaret, yCaret] = [extents.x, extents.y];
+ let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+ let [xCaret, yCaret] = [extents.x * scaleFactor, extents.y * scaleFactor];
if (this._xCaret != xCaret || this._yCaret != yCaret) {
[this._xCaret, this._yCaret] = [xCaret, yCaret];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]