From 2546445884d7c01a35775df5b7e22de6f07a176d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 20 Aug 2019 04:10:46 +0200 Subject: [PATCH] magnifier: Simplify some code We don't need nested if blocks to set or unset the crosshairs' clip size. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731 --- js/ui/magnifier.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 9d3ad6473..73522586f 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -451,15 +451,11 @@ var Magnifier = class Magnifier { * @clip: Flag to indicate whether to clip the crosshairs. */ setCrosshairsClip(clip) { - if (clip) { - if (this._crossHairs) - this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE); - } else { - // Setting no clipping on crosshairs means a zero sized clip - // rectangle. - if (this._crossHairs) - this._crossHairs.setClip([0, 0]); - } + if (!this._crossHairs) + return; + + // Setting no clipping on crosshairs means a zero sized clip rectangle. + this._crossHairs.setClip(clip ? CROSSHAIRS_CLIP_SIZE : [0, 0]); } /**