[gnome-shell/gnome-40] magnifier: Small cleanup



commit 3a8dcec908fb6a5e554e999ee705e9a82331673d
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 29 22:17:54 2021 +0200

    magnifier: Small cleanup
    
    Use an early return instead of a big if() block to cut down on
    indentation.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>
    (cherry picked from commit 8f42053b5fde050dc98e459009eb476f86a86380)

 js/ui/magnifier.js | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index d5d93235a3..8334794f3f 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -232,20 +232,21 @@ var Magnifier = class Magnifier {
     scrollToMousePos() {
         let [xMouse, yMouse] = global.get_pointer();
 
-        if (xMouse != this.xMouse || yMouse != this.yMouse) {
-            this.xMouse = xMouse;
-            this.yMouse = yMouse;
-
-            let sysMouseOverAny = false;
-            this._zoomRegions.forEach(zoomRegion => {
-                if (zoomRegion.scrollToMousePos())
-                    sysMouseOverAny = true;
-            });
-            if (sysMouseOverAny)
-                this.hideSystemCursor();
-            else
-                this.showSystemCursor();
-        }
+        if (xMouse === this.xMouse && yMouse === this.yMouse)
+            return;
+
+        this.xMouse = xMouse;
+        this.yMouse = yMouse;
+
+        let sysMouseOverAny = false;
+        this._zoomRegions.forEach(zoomRegion => {
+            if (zoomRegion.scrollToMousePos())
+                sysMouseOverAny = true;
+        });
+        if (sysMouseOverAny)
+            this.hideSystemCursor();
+        else
+            this.showSystemCursor();
     }
 
     /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]