reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
Casey 2020-08-10T11:57:49.160200Z

Is there a straightforward way to get a reference to the dom element of a component inside an event handler? It's dirty I know... I have a component wrapping an <svg> and am implementing pan and zoom events on the svg. Mouse events performed on children of the svg (such as shapes in the image) have a e.target value of the child, not the parent svg element. But I need a handle on the svg dom element to call getBoundingClientRect()

2020-08-10T13:20:27.160900Z

@ramblurr e.target.parentElement

2020-08-10T13:58:42.161Z

I’ve solved this and a have working solution. If someone interested -> PM

Casey 2020-08-10T14:06:27.162Z

@selfsame that assumes the target is a direct descendent of the svg, which it often isn't. I suppose I could just walk up the elements until landing on svg, but I figure there might be a cleaner way

2020-08-10T14:33:06.162800Z

ah then you'll have to walk the tree or use a :ref

1👍
2020-08-10T15:06:38.162900Z

ah right makes sense thanks