fredsa / playn

Cross platform game library for N≥4 platforms
0 stars 1 forks source link

MouseWheel and MouseMove events are not propagated to layers #180

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In archetype project, add mouse listener to both bgLayer and to the global 
PlayN.mouse().
2. In your mouse listener, log mousewheel events and mouse move events

What is the expected output? What do you see instead?

1) When you move the mouse you expect log output from both bgLayer and global 
listener.

You properly get event notifications from the global listener, but you don't 
get events from the layer listener, unless a button is pressed, turning it 
effectively in a mousedraglistener. 

2) When you use the scrollwheel, you you expect log output from both bgLayer 
and global listener.

In this case you only receive events on the global listener and never on the 
bgLayer listener.

What version of the product are you using? On what operating system?
PlayN 1.2 and PlayN 1.3.1 tested, only Java version tested
OS: WinXP

Please provide any additional information below.

Code that can be used to illustrate the problem is attached.

Original issue reported on code.google.com by tab...@broadinstitute.org on 30 May 2012 at 3:45

Attachments:

GoogleCodeExporter commented 9 years ago
This is by design. We do not want to have to run a (potentially expensive) hit 
test operation on every mouse move event because we would have to do it for any 
game regardless of whether it cared about mouse movement notifications. So we 
only hit test on mouse press and then dispatch movement events to the layer hit 
by the press until the mouse is released.

Mouse wheel events are also not supported by choice (and this is documented in 
Layer.addListener(Mouse.Listener)). We could do a hit test on every wheel event 
and dispatch the wheel event to the hit layer, so perhaps we can revisit this 
choice.

If you want to dispatch mouse move events to layers, you'll have to add a 
global mouse move listener and do the hit testing yourself.

Original comment by m...@samskivert.com on 30 May 2012 at 3:56