From: Michael Orlitzky Date: Thu, 11 Sep 2025 03:33:55 +0000 (-0400) Subject: index.html.in: use svg_to_client() in center_text() X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=0523202e0e8a5fa80e674c430dda758f56ba0d47;p=charm-bypass.git index.html.in: use svg_to_client() in center_text() The center_text() function was the first place that a coordinate change was needed, though it was in the other direction, client to SVG. Now that we have the svg_to_client() factor, we divide by it to get the client_to_svg factor. --- diff --git a/index.html.in b/index.html.in index a9e7c9b..ad58d23 100644 --- a/index.html.in +++ b/index.html.in @@ -736,13 +736,10 @@ * element and compare it to the width of the background * 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 svg_width = parseFloat(bg.getAttribute("width")); - const client_width = r1.width; - const client_to_svg = svg_width / client_width; + * distances (what we have) into SVG distances (what we want). */ /* Convert hdelta from client rect to SVG coordinates */ - const svg_hdelta = hdelta * client_to_svg; + const svg_hdelta = hdelta / svg_to_client(); /* Since this element has an "x" attribute it's easier for * us to shift that than it is to mess with the "left" style. */