'0' to remove all tags (P1-style)
authorRichard Fairhurst <richard@systemeD.net>
Sun, 5 Feb 2012 20:28:20 +0000 (20:28 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Sun, 5 Feb 2012 20:28:20 +0000 (20:28 +0000)
net/systemeD/potlatch2/controller/ControllerState.as

index d34f0949b5d6e944197092cb0c1a5d89794167e8..2ef4fb3384bc8415345b42f754db3b42094e98fc 100644 (file)
@@ -75,6 +75,7 @@ package net.systemeD.potlatch2.controller {
                protected function sharedKeyboardEvents(event:KeyboardEvent):ControllerState {
                        var editableLayer:MapPaint=controller.map.editableLayer;                                                                // shorthand for this method
                        switch (event.keyCode) {
+                               case 48:        removeTags(); break;                                                                                                    // 0 - remove all tags
                                case 66:        setSourceTag(); break;                                                                                                  // B - set source tag for current object
                                case 67:        editableLayer.connection.closeChangeset(); break;                                               // C - close changeset
                                case 68:        editableLayer.alpha=1.3-editableLayer.alpha; return null;                               // D - dim
@@ -201,6 +202,20 @@ package net.systemeD.potlatch2.controller {
 
 
                }
+               
+               /** Remove all tags from current selection. */
+               protected function removeTags():void {
+                       if (selectCount==0) return;
+                       var undo:CompositeUndoableAction = new CompositeUndoableAction("Remove tags");
+                       for each (var item:Entity in _selection) {
+                               item.suspend();
+                               var tags:Array=item.getTagArray();
+                               for each (var tag:Tag in tags) item.setTag(tag.key,null,undo.push);
+                       }
+                       MainUndoStack.getGlobalStack().addAction(undo);
+                       controller.updateSelectionUI();
+                       for each (item in _selection) item.resume();
+               }
 
                /** Create an action to add "source=*" tag to current entity based on background imagery. This is a convenient shorthand for users. */
                protected function setSourceTag():void {