* 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 <text> element has an "x" attribute it's easier for
* us to shift that than it is to mess with the "left" style. */