From 8f42053b5fde050dc98e459009eb476f86a86380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 29 Jul 2021 22:17:54 +0200 Subject: [PATCH] magnifier: Small cleanup Use an early return instead of a big if() block to cut down on indentation. Part-of: --- js/ui/magnifier.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 57b32cb05..22581278d 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -232,20 +232,21 @@ var Magnifier = class Magnifier { scrollToMousePos(...args) { const [xMouse, yMouse] = args.length ? args : global.get_pointer(); - if (xMouse != this.xMouse || yMouse != this.yMouse) { - this.xMouse = xMouse; - this.yMouse = yMouse; + if (xMouse === this.xMouse && yMouse === this.yMouse) + return; - let sysMouseOverAny = false; - this._zoomRegions.forEach(zoomRegion => { - if (zoomRegion.scrollToMousePos()) - sysMouseOverAny = true; - }); - if (sysMouseOverAny) - this.hideSystemCursor(); - else - this.showSystemCursor(); - } + 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(); } /**