jtextor / dagitty

Graphical analysis of structural causal models / graphical causal models.
GNU General Public License v2.0
255 stars 47 forks source link

Use offsetX/Y to allow embedding in scrollable elements and improve performance #64

Closed krassowski closed 1 year ago

krassowski commented 2 years ago

offsetX and offsetY give directly the offset which so far was calculated in a multi-step process; these properties of mouse event have a very good support in browsers (see https://caniuse.com/mdn-api_mouseevent_offsetx - 97% coverage).

By delegating this to the browser, you get a better performance and correctness (previous code was not working when dagitty is placed inside an absolutely positioned or scrollable element).

jtextor commented 1 year ago

Looks great, thanks for the contribution!