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

MouseWheel count wrong (backwards?) in P2D and P3D #3840

Closed
tillnagel opened this Issue Sep 21, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@tillnagel

tillnagel commented Sep 21, 2015

In the documentation it says it should return "positive values when the mouse wheel is rotated down". This is true only for JAVA2D. In other renderers the values are negative.

It happens on mouseWheel as well as when registering to mouseEvents.

void setup() {
  size(400, 400, JAVA2D); // switch to P2D for testing
  registerMethod("mouseEvent", this);
}

void draw() {
}

void mouseWheel(MouseEvent e) {
  println("mouseWheel.c:" + e.getCount());
}

public void mouseEvent(MouseEvent e) {
  if (e.getAction() == MouseEvent.WHEEL) {
    println("mouseEvent.c:" + e.getCount());
  }
}

Possibly related to #3828.

@tillnagel

This comment has been minimized.

Show comment
Hide comment
@tillnagel

tillnagel Sep 22, 2015

On further investigation I believe it is due to the direct use of the AWT and the JOGL implementation values which are opposite to each other.

PSurfaceAWT uses getWheelRotation() which, according to Oracles's Javadoc, returns "positive values if the mouse wheel was rotated down/ towards the user."

PSurfaceJOGL, however, uses getRotation() which, according to JOGL's Javadoc, returns values "< 0.0f" when "vertical rotation [...] is down."

tillnagel commented Sep 22, 2015

On further investigation I believe it is due to the direct use of the AWT and the JOGL implementation values which are opposite to each other.

PSurfaceAWT uses getWheelRotation() which, according to Oracles's Javadoc, returns "positive values if the mouse wheel was rotated down/ towards the user."

PSurfaceJOGL, however, uses getRotation() which, according to JOGL's Javadoc, returns values "< 0.0f" when "vertical rotation [...] is down."

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 22, 2015

Member

@codeanticode Haven't you solved this one before?

Member

benfry commented Sep 22, 2015

@codeanticode Haven't you solved this one before?

@benfry benfry added android opengl and removed android labels Sep 22, 2015

@benfry benfry added this to the 3.0 final milestone Sep 22, 2015

@benfry benfry changed the title from MouseWheel count wrong in OpenGL based rendered. to MouseWheel count wrong (backwards?) in P2D and P3D Sep 22, 2015

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Sep 22, 2015

Member

I don't remember, if I did it was quite a while ago, at least since we first implemented NEWT support...

I just committed c09ef8e, which fixes the issue. Tested on OS X.

Member

codeanticode commented Sep 22, 2015

I don't remember, if I did it was quite a while ago, at least since we first implemented NEWT support...

I just committed c09ef8e, which fixes the issue. Tested on OS X.

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Sep 22, 2015

Member

Just confirming that wheel count is consistent between JAVA2D and P2D/P3D on Windows as well.

Member

codeanticode commented Sep 22, 2015

Just confirming that wheel count is consistent between JAVA2D and P2D/P3D on Windows as well.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 22, 2015

Member

Cool, thanks.

Member

benfry commented Sep 22, 2015

Cool, thanks.

@tillnagel

This comment has been minimized.

Show comment
Hide comment
@tillnagel

tillnagel Sep 23, 2015

Great, thanks.

Just as a side note, while the direction are aligned now, the values still differ. With a Apple Magic Mouse in P2D I can get values up to 1000 and more, while in JAVA2D I cannot get values higher than 200. (No idea if those are the actual max values, just jerking over the mouse's surface.) Didn't notice before, and surely not important, IMO, just to mention.

tillnagel commented Sep 23, 2015

Great, thanks.

Just as a side note, while the direction are aligned now, the values still differ. With a Apple Magic Mouse in P2D I can get values up to 1000 and more, while in JAVA2D I cannot get values higher than 200. (No idea if those are the actual max values, just jerking over the mouse's surface.) Didn't notice before, and surely not important, IMO, just to mention.

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