]> gitweb.michael.orlitzky.com - charm-bypass.git/commitdiff
index.html.in: intermediate variables for the client_to_svg ratio
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 10 Sep 2025 13:54:56 +0000 (09:54 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 10 Sep 2025 13:55:30 +0000 (09:55 -0400)
This just makes things a little easier to read.

index.html.in

index 76e808d7bfa0467e361e46a8f21e1ef6b234364f..3cea85430510903f7b5a8fc510d70f38113a6c27 100644 (file)
          * element's client rect. Since the size of the background is
          * fixed, this should give us a multiplier that turns client rect
          * distances (what we have) into SVG distances (what we want) */
-        const client_to_svg = parseFloat(bg.getAttribute("width"))/r1.width;
+        const svg_width = parseFloat(bg.getAttribute("width"));
+        const client_width = r1.width;
+        const client_to_svg = svg_width / client_width;
 
         /* Convert hdelta from client rect to SVG coordinates */
         const svg_hdelta = hdelta * client_to_svg;