On Wednesday, February 1, 2017 at 5:04:11 PM UTC, [email protected] wrote: > > I'm trying to create a simple SVG app (rectangle, text, arrow), but can't > seem to align them properly without getBBox (not even with monospaced > fonts). > Is there really no way to get back any information from the browser > without a proper event? >
The problem with just encoding a getBBox or getDimensions or getSize function in Elm is that it could return different values when called multiple times, so it is not really a function. However, you could use a port to ask for a size, and a subscription to get the result. I have a similar issue where I want to get the size of a div, and have now worked out a solution using MutationObserver to watch for changes to the div and report its new size on every change. So these kinds of queries do fit within the Elm model. Perhaps we could start asking for a proper 'effect' module to support these and other related queries. -- 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.
