Comment #2 on issue 177 by allain.lalonde: When deleting a selected node using the keyboard <DEL> a selection change is not fired
http://code.google.com/p/piccolo2d/issues/detail?id=177

Two changes need to be made in order for this to be a fix.

#1 addition of postSelectionChanged
#2 Pressing delete on an empty selection shouldn't fire event

Following patch ensures thsoe things:



Index: src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java
===================================================================
--- src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java (revision
1016)
+++ src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java (working
copy)
@@ -783,13 +783,14 @@
      * @param e the key press event
      */
     public void keyPressed(final PInputEvent e) {
-        if (e.getKeyCode() == KeyEvent.VK_DELETE && deleteKeyActive) {
+        if (e.getKeyCode() == KeyEvent.VK_DELETE && deleteKeyActive &&
!selection.isEmpty()) {
             final Iterator selectionEn = selection.keySet().iterator();
             while (selectionEn.hasNext()) {
                 final PNode node = (PNode) selectionEn.next();
                 node.removeFromParent();
             }
             selection.clear();
+            postSelectionChanged();
         }
     }



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to