This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Brandon Souba
Posted Jun 16 - Read on Facebook

I'm trying to get the x & y position of the mouse when it hovers over an object. Any tips?

6 Comments

Josh Puckett

Use an event, probably?

Brandon Souba

Ah yeah I got that part, but how do you pass the mouseX back from the event?

Buck Wilson

event.clientX & .clientY will return the values you need, though they'll be relative to the document (or is it window? I can't remember) object, so you'll have to normalize for the canvas if you're using a device wrapper.

Brian Williams

myLayer.myEvent (event, sender) ->
debugger

(I think its that way round in framer)

edit: I should have specified in my sleepy daze.

event: has all the event data on it (like where the mouse position is relative to a bunch of things, screen, client, the current layer etc

sender: is the layer that the event came from so in this case "myLayer"

Josh Puckett

No one got that I was trolling Brandon here?? :D

Jonas Treub
Read the entire post on Facebook