We have a similar feature at 43Layers (e.g. [1]) and went through a couple iterations. Ours was made more complex because it has to mesh with a 3D canvas, so originally it was a combination of overlapping DOM elements, an SVG element, and a 3D canvas. We also use React, so movement of the selection box created events that generally had to flow through multiple react elements. Getting the coordinates of everything matching in all three contexts was an exercise in annoyance (given how simple it seems), especially for things like fonts which have bounding boxes which bear only a passing relationship with the actual bounding boxes of the text on screen.<p>Eventually, we ditched the SVG and moved more things into 3D, which made for a better design in the end. For example, now we calculate 3D geometry for the font from its curves and get an actual real bounding box for it.<p>Anyway, it&#x27;s interesting to read about how other people solved the same problem.<p>1: <a href="https:&#x2F;&#x2F;www.43layers.com&#x2F;products&#x2F;laser-cut-coasters&#x2F;Custom-17" rel="nofollow">https:&#x2F;&#x2F;www.43layers.com&#x2F;products&#x2F;laser-cut-coasters&#x2F;Custom-...</a>