[gnome-shell-extensions] screenshot-window-sizer: Rearrange calculation



commit 579a290bae8c0553154c3d2d1c88e61204cb422f
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 7 05:05:53 2019 +0200

    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 0f87b36..4c1d1bb 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]