Author: heuermh
Date: Tue Oct 7 13:42:38 2008
New Revision: 395
Modified:
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java
Log:
Issue 19 ; added reference to PCamera as PInputEvent input source in cases
where path is null
Modified:
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java
==============================================================================
---
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java
(original)
+++
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PInputManager.java
Tue Oct 7 13:42:38 2008
@@ -86,10 +86,10 @@
}
/**
- * Set the node that should recive key events.
+ * Set the node that should receive key events.
*/
public void setKeyboardFocus(PInputEventListener eventHandler) {
- PInputEvent focusEvent = new PInputEvent(this, null);
+ PInputEvent focusEvent = new PInputEvent(this, null, null);
if (keyboardFocus != null) {
dispatchEventToListener(focusEvent, FocusEvent.FOCUS_LOST,
keyboardFocus);
@@ -228,7 +228,7 @@
if (nextInput == null)
return;
- PInputEvent e = new PInputEvent(this, nextInput);
+ PInputEvent e = new PInputEvent(this, nextInput, nextInputSource);
Point2D newCurrentCanvasPosition = null;
Point2D newLastCanvasPosition = null;
Modified:
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java
==============================================================================
---
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java
(original)
+++
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/event/PInputEvent.java
Tue Oct 7 13:42:38 2008
@@ -64,12 +64,14 @@
private InputEvent inputEvent;
private PPickPath pickPath;
private PInputManager inputManager;
+ private PCamera inputSource;
private boolean handled;
- public PInputEvent(PInputManager inputManager, InputEvent event) {
+ public PInputEvent(PInputManager inputManager, InputEvent event,
PCamera inputSource) {
super();
inputEvent = event;
this.inputManager = inputManager;
+ this.inputSource = inputSource;
}
public void pushCursor(Cursor cursor) {
@@ -100,15 +102,15 @@
* getTopCamera.
*/
public PCamera getCamera() {
- return getPath().getBottomCamera();
+ return (getPath() == null) ? inputSource :
getPath().getBottomCamera();
}
/**
- * Return the topmost camera this is painting. This is the camera
assocaited
+ * Return the topmost camera this is painting. This is the camera
associated
* with the PCanvas that requested the current repaint.
*/
public PCamera getTopCamera() {
- return getPath().getTopCamera();
+ return (getPath() == null) ? inputSource :
getPath().getTopCamera();
}
/**
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---