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
This commit is contained in:
Florian Müllner 2019-08-20 04:10:46 +02:00
parent e44b7df078
commit 2546445884

View File

@ -451,15 +451,11 @@ var Magnifier = class Magnifier {
* @clip: Flag to indicate whether to clip the crosshairs. * @clip: Flag to indicate whether to clip the crosshairs.
*/ */
setCrosshairsClip(clip) { setCrosshairsClip(clip) {
if (clip) { if (!this._crossHairs)
if (this._crossHairs) return;
this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
} else { // Setting no clipping on crosshairs means a zero sized clip rectangle.
// Setting no clipping on crosshairs means a zero sized clip this._crossHairs.setClip(clip ? CROSSHAIRS_CLIP_SIZE : [0, 0]);
// rectangle.
if (this._crossHairs)
this._crossHairs.setClip([0, 0]);
}
} }
/** /**