New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse.position's initial value is (0, 0) #91

Closed
thSoft opened this Issue Jan 10, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@thSoft
Contributor

thSoft commented Jan 10, 2015

The initial value of Mouse.position is (0, 0) regardless of the actual position of the mouse until it is moved. Example to reproduce: http://share-elm.com/sprout/54b129a6e4b05f9c59b24f3a
Elm version: 0.14.1

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 10, 2015

Contributor

That comes from this line: https://github.com/elm-lang/core/blob/master/src/Native/Mouse.js#L14

You would have to replace the Utils.Tuple2(0,0) in there by the current mouse position at program start. However, when that line of code is run, the "page" with respect to which you want the mouse position most likely doesn't even exist yet.

Contributor

jvoigtlaender commented Jan 10, 2015

That comes from this line: https://github.com/elm-lang/core/blob/master/src/Native/Mouse.js#L14

You would have to replace the Utils.Tuple2(0,0) in there by the current mouse position at program start. However, when that line of code is run, the "page" with respect to which you want the mouse position most likely doesn't even exist yet.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 10, 2015

Contributor

In other words, this issue is unlikely to get fixed unless the runtime (in particular the way the signal graph is built and initialized, and when the actual "graphics display" is created) were restructured somewhat considerably.

Contributor

jvoigtlaender commented Jan 10, 2015

In other words, this issue is unlikely to get fixed unless the runtime (in particular the way the signal graph is built and initialized, and when the actual "graphics display" is created) were restructured somewhat considerably.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jan 10, 2015

Member

I don't think it is possible to ask any browser for the mouse position, so my understanding is that this is not possible. If you can find a way to synchronously detect the mouse position in JS, we can do this. If you cannot, we should close this issue.

Member

evancz commented Jan 10, 2015

I don't think it is possible to ask any browser for the mouse position, so my understanding is that this is not possible. If you can find a way to synchronously detect the mouse position in JS, we can do this. If you cannot, we should close this issue.

@thSoft

This comment has been minimized.

Show comment
Hide comment
@thSoft

thSoft Jan 10, 2015

Contributor

Aha, I see. That's a pity...

Contributor

thSoft commented Jan 10, 2015

Aha, I see. That's a pity...

@thSoft thSoft closed this Jan 10, 2015

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 10, 2015

Contributor

Oh, so it's even worse, there is nothing to replace the Utils.Tuple2(0,0) in the first place. Learned something.

Contributor

jvoigtlaender commented Jan 10, 2015

Oh, so it's even worse, there is nothing to replace the Utils.Tuple2(0,0) in the first place. Learned something.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jan 10, 2015

Member

Yeah, I was surprised when I learned this as well. I'd like to do it nicer, but given that it has been impossible for 20+ years, I don't have tons of hope :P

Member

evancz commented Jan 10, 2015

Yeah, I was surprised when I learned this as well. I'd like to do it nicer, but given that it has been impossible for 20+ years, I don't have tons of hope :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment