GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

Hierarchical Input Events #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently input events follow the Swing component model of opacity where
entering a child component exits the parent.  It is very useful for ZUIs to
have a hierarchical event model where entering the child does not exit the
parent so you can drill in without keeping state.

This is inspired by a post from Florian (aka shneif) on the dev mailing list:

The Piccolo mouse system behaves very similarly to Swing in that if you 
have a hierarchical containment of nodes (call them L1, L2, and L3) you 
will receive the following events:

   1. you will first get a mouse entered event on L1
   2. as the cursor moves over L2 you will get a mouse exited event on
      L1 and a mouse entered event on L2
   3. as the cursor moves over L3 you will get a mouse exited event on
      L2 and a mouse entered event for L3

(The same would be true of nested JPanels in Swing).

Knowing this, you can simulate a hierarchical mouse controller by 
looking at events on your children and ignoring a mouse exitted event on 
yourself (L1) if it is immediately followed by a mouse entered event on 
your child (L2).  This is not perfect, because you are waiting for a 
second event to know if you should do anything on the first; fortunately 
they both occur on the event thread, so you can hack around this by 
scheduling a post processor using SwingUtilities.invokeLater().

As you probably guessed, I ran into the same issue and agree that having 
an option to receive hierarchical events would be very useful.  Please 
file an enhancement request for this in our issue tracker, and I will 
see about fixing this:
http://code.google.com/p/piccolo2d/issues/list

I think adding the feature in for hierarchical mouse events is much 
better than exposing the previousMouseOver field, because it is an 
internal field that is subject to change at any time.  For instance, I 
have a fix for another mouse event issue that requires a change to how 
previousMouseOver gets set in some corner cases.
http://code.google.com/p/piccolo2d/issues/detail?id=30&sort=-id&colspec=ID%20Typ
e%20Status%20Priority%20Milestone%20Owner%20Toolkit%20Component%20Summary

<http://code.google.com/p/piccolo2d/issues/detail?id=30&sort=-id&colspec=ID%20Ty
pe%20Status%20Priority%20Milestone%20Owner%20Toolkit%20Component%20Summary>

I hope this helps.

Cheers,
--Steve

schnief wrote:
> > Hi Steve,
> >
> > i want to implement a kind of "hierachical" mouse-in/out.
> > if the new mouse-over node is a decendent of the previouse one, there
> > should be no MOUSE_EXITED event.
> > and vice versa there should not be a MOUSE_ENTERED event, if the new
> > mouse-over is an ancester of the previouse one.
> >
> > the easiest way to give the possibility to grant access to the
> > variouse PPickPath fields, would be to make them protected, so
> > everyone is able to derive its own PInputManager
> >
> > regards,
> > florian
> >
> > (please excuse my bad english)
>> > >
> >   

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Original issue reported on code.google.com by steveonjava on 5 Aug 2008 at 5:49

GoogleCodeExporter commented 9 years ago
Reverting back to New status

Original comment by heue...@gmail.com on 31 Aug 2012 at 8:19

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 31 Aug 2012 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 31 Aug 2012 at 8:22

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 11:22