Background: I need to show a mathematical expression and allow user to select (single click or rectangle selection via mouse down/move/mouse up) elements of it. There are some good systems (mathjax, codeblock, ...) to convert a math expression to html, they produce an html composed mainly of a set of div or span blocks. If necessary, custom render could be implemented.
Assume a html5 page that contains several nested or sequenced div and/or span tags. The user must be allowed to choice with their mouse one of these elements or several of them inside a selection rectangle. Any advice about how implement it ?.
The activity could be decomposed in two steps:
- the drawing and control of the selection rectangle
- given a rectangle, an easy and portable way to know which div or span fails inside the selection