Yeah, that does sound like a tricky problem if you can't get the offsetHeight from the DOM. Even though you know the line-height, I don't know how you could tell how many lines the input takes up.
On Thu, Dec 22, 2016 at 9:14 AM, Fabrice Marchal <[email protected]> wrote: > Another example where I don't see how to avoid reading the DOM: to edit an > SVG text, we put on top a non-resizeable textarea that grows in height as > the user types. I do that by reading the offsetHeight of the textarea on > each key 'input' and adjust the svg. One could compute the text size from > the font, etc but it feels like re-inventing the wheel :/ > > On Thursday, December 22, 2016 at 5:44:26 PM UTC+1, Nick H wrote: >> >> Yes, I agree with Rex. The DOM is write-only by design. Going forward, I >> don't expect there ever to be a generic way to read the DOM... if specific >> problems come up that absolutely require it, they will be solved by >> specific APIs, such as in elm-lang/window and elm-lang/dom. >> >> On Thu, Dec 22, 2016 at 5:57 AM, Rex van der Spuy <[email protected]> >> wrote: >> >>> >>> Currently the solution seems to be 1) compute the bounding box manually >>>> inside the update function whenever the selection <g> is modified, 2) keep >>>> the bounding box data in the model and 3) use the bounding box from the >>>> model when the update function performs other operations on the model (e.g. >>>> detect if a click is inside). >>>> >>> >>> That's how us game developers do it: all the geometry and position data >>> is in the model. That data is then used to blindly draw the shapes in the >>> view. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Elm Discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
