This is one of my biggest sticking points with Elm; It's something I have 
had to do a number of times at work for things like infinite 
scrolling/manually laying things out based on container dimensions etc. I 
had the same idea of controlling the "big" layouts in Elm by deriving 
things based on window height/width, but when you want to make use of the 
growing number of useful CSS bits like flexbox and the upcoming grid stuff 
rather than reimplementing it partially in Elm, you hit a brick wall.

All that to say, I'll read the post with excitement!

On Sunday, 26 June 2016 17:21:44 UTC+1, Mark Hamburg wrote:
>
> Interesting. I've felt some tension around this as well. I've got an app 
> with a grid of photos that needs to run layout logic based on the width 
> available. Right now, I'm basically deriving that width from the window 
> width but that splits my page layout between Elm and CSS as processed by 
> the browser. If I were to do anything that depended on text measurement, I 
> couldn't do the layout in Elm and would have to get the values back from 
> the DOM. It would be nice to have standard Elm virtual DOM attributes for 
> receiving geometry and scroll position.
>
> Mark
>
> On Jun 24, 2016, at 4:52 AM, debois <[email protected] <javascript:>> 
> wrote:
>
> Dear all, 
>
> I just published a blog post on how to get geometry of rendered 
> elements—in particular calling getBoundingClientRect—by constructing JSON 
> decoders for use with Html.Events.on:
>
> https://medium.com/@debois/elm-the-dom-8c9883190d20#.pbwnl4bgl
>
> I needed this for elm-md <https://github.com/debois/elm-mdl>l. If you 
> have a similar need, you might like the post, and you might find the the 
> elm-dom 
> library <https://github.com/debois/elm-dom> useful. The latter provides 
> some ready-made encoders and a substitute for getBoundingClientRect.
>
> I'd appreciate any comments. 
>
> Obviously, the functionality of reading geometry off the DOM, including 
> calling getBoundingClientRect, should be provided by Core. It doesn't seem 
> to be on the roadmap for the immediate future, though, so in the meantime, 
> I thought you might find the above useful. 
>
> Cheers,
>
> Søren
>
> -- 
> 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] <javascript:>.
> 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.

Reply via email to