I ran into this exact yesterday problem, and solved it by calculating the 
relative offset in JavaScript, and then passing it into Elm on init via 
`Html.App.programWithFlags`. However, this is not a pure Elm solution, and 
it doesn't take into account window resize or scroll events.  I would love 
to hear of a single solution that cleanly solves both these issues, but I 
doubt it exists, at present.

On Thursday, May 19, 2016 at 3:01:20 PM UTC-7, Fernando Alegre wrote:
>
>
> I am trying to write a plotting program that will have some user 
> interaction. In particular, when the mouse enters a particular rectangle 
> (let's call it the "plotting area") I need to show the (x,y) coordinates 
> relative to the top left corner of that rectangle. Using "import Mouse" I 
> get absolute coordinates for the whole window, but I don't know how to 
> (easily) get the coordinates of the rectangle so that I can calculate the 
> relative offset. Any hint will be appreciated.
>
>
>

-- 
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