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>
This commit is contained in:
Florian Müllner 2021-07-29 22:17:54 +02:00 committed by Marge Bot
parent 77b175e763
commit 8f42053b5f

View File

@ -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();
}
/**