Author: heuermh
Date: Tue Oct 7 13:23:08 2008
New Revision: 393
Modified:
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
Log:
Issue 15 ; properly consume mouse events in PSwing components
Modified:
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java
==============================================================================
---
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java
(original)
+++
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java
Tue Oct 7 13:23:08 2008
@@ -261,6 +261,9 @@
for (int j = 0; j < listeners.length; j++) {
PInputEventListener listener = (PInputEventListener)
listeners[j];
listener.processEvent(aEvent, type);
+ if (aEvent.isHandled()) {
+ return;
+ }
}
}
}
Modified:
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
==============================================================================
---
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
(original)
+++
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingEventHandler.java
Tue Oct 7 13:23:08 2008
@@ -251,7 +251,6 @@
PSwingMouseEvent e2 =
PSwingMouseEvent.createMouseEvent(e_temp.getID(), e_temp, aEvent);
dispatchEvent(comp, e2);
- pSwingMouseEvent.consume();
}
// Now we need to check if an exit or enter event needs to
@@ -268,10 +267,6 @@
dispatchEvent(prevComponent, e2);
prevComponent = null;
-
- if (pSwingMouseEvent.getID() == MouseEvent.MOUSE_EXITED) {
- pSwingMouseEvent.consume();
- }
}
// This means mouseExited prevComponent and mouseEntered comp
@@ -408,6 +403,9 @@
if (!recursing) {
recursing = true;
dispatchEvent(pSwingMouseEvent, aEvent);
+ if (pSwingMouseEvent.isConsumed()) {
+ aEvent.setHandled(true);
+ }
recursing = false;
}
}
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---