From 579a290bae8c0553154c3d2d1c88e61204cb422f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 7 Aug 2019 05:05:53 +0200 Subject: [PATCH] screenshot-window-sizer: Rearrange calculation eslint has a rule to prohibit unnecessary parentheses. While this is generally a good idea stylistically, the parentheses in a calculation of (a / b) * c add more clarity, as a / b * c lacks the unambiguity of proper math notation: a a --- * c vs ------- b b * c We can still follow the style rule by rearranging to the unambiguous c * a / b. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91 --- extensions/screenshot-window-sizer/extension.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index 0f87b363..4c1d1bb7 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -128,7 +128,7 @@ function cycleScreenshotSizes(display, window, binding) { // The new size might have been constrained by geometry hints (e.g. for // a terminal) - in that case, include the actual ratio to the message // we flash - let actualNumerator = (newOuterRect.width / newOuterRect.height) * 9; + let actualNumerator = 9 * newOuterRect.width / newOuterRect.height; if (Math.abs(actualNumerator - 16) > 0.01) message += ' (%.2f:9)'.format(actualNumerator);