Fixed Stuff
authorRichard Fairhurst <richard@systemed.net>
Tue, 31 Aug 2010 16:26:02 +0000 (16:26 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 31 Aug 2010 16:26:02 +0000 (16:26 +0000)
halcyon_viewer.as
net/systemeD/halcyon/DebugURLRequest.as
net/systemeD/halcyon/Map.as
net/systemeD/potlatch2/controller/ControllerState.as
net/systemeD/potlatch2/controller/NoSelection.as
potlatch2.mxml

index 11f8fa8..3b01b9e 100755 (executable)
@@ -27,6 +27,7 @@ package {
             theMap.updateSize(stage.stageWidth, stage.stageHeight);
                        addChild(theMap);
                        Globals.vars.root=theMap;
+                       Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';
 
                        // add debug field
                        var t:TextField=new TextField();
index 3eabbc3..8aa038b 100644 (file)
@@ -3,18 +3,21 @@ package net.systemeD.halcyon {
        /*
                === DebugURLRequest ===
 
-               If this is running under a Flash debug player, this will make the URLRequest using POST 
-               rather than GET - thereby preventing FP from caching it
+               If nocache has been set to 'true' via FlashVars, this will make the URLRequest using 
+               POST rather than GET - thereby preventing FP from caching it
                (see http://www.ultrashock.com/forums/actionscript/force-reload-files-only-using-as3-123408.html).
                
                Sadly we can't just subclass URLRequest, which is defined as final. So you need to create your 
                new DebugURLRequest, then refer to its .request property.
+               
+               We use an evil Global because we don't know where loaderInfo.parameters will be.
 
        */
 
        import flash.net.URLRequest;
        import flash.net.URLRequestMethod;
        import flash.system.Capabilities;
+       import net.systemeD.halcyon.Globals;
 
        public class DebugURLRequest {
 
@@ -22,7 +25,7 @@ package net.systemeD.halcyon {
 
                public function DebugURLRequest(url:String=null) {
                        request=new URLRequest(url);
-                       if (Capabilities.isDebugger) {
+                       if (Globals.vars.hasOwnProperty('nocache') && Globals.vars.nocache) {
                                request.method=URLRequestMethod.POST;
                                request.data=true;
                        }
index 833c656..2f71a52 100755 (executable)
@@ -428,11 +428,10 @@ package net.systemeD.halcyon {
                // Miscellaneous events
                
                public function keyUpHandler(event:KeyboardEvent):void {
-                       if ( !event.ctrlKey ) return;
                        addDebug("pressed "+event.keyCode);
-                       if (event.keyCode==73) { zoomIn(); }                    // I - zoom in
-                       if (event.keyCode==79) { zoomOut(); }                   // O - zoom out
-                       if (event.keyCode==76) { reportPosition(); }    // L - report lat/long
+                       if (event.keyCode==33) { zoomIn(); }                    // Page Up - zoom in
+                       if (event.keyCode==34) { zoomOut(); }                   // Page Down - zoom out
+//                     if (event.keyCode==76) { reportPosition(); }    // L - report lat/long
                }
 
                public function connectionError(err:Object=null): void {
index b1a6121..4a2d433 100644 (file)
@@ -64,12 +64,13 @@ package net.systemeD.potlatch2.controller {
 
                        if ( paint && paint.isBackground ) {
                                if ( event.type == MouseEvent.MOUSE_DOWN && ((event.shiftKey && event.ctrlKey) || event.altKey) ) {
-                                       // pull data out of vector background layer
+                                       // alt-click to pull data out of vector background layer
                                        var newEntity:Entity=paint.findSource().pullThrough(entity,controller.connection);
                                        if (entity is Way) { return new SelectedWay(newEntity as Way); }
                                        else if (entity is Node) { return new SelectedPOINode(newEntity as Node); }
-                               }
-                               return (this is NoSelection) ? this : new NoSelection();
+                               } else if ( event.type == MouseEvent.MOUSE_UP ) { 
+                                       return (this is NoSelection) ? null : new NoSelection();
+                               } else { return null; }
                        }
 
                        if ( event.type == MouseEvent.MOUSE_DOWN ) {
@@ -89,8 +90,8 @@ package net.systemeD.potlatch2.controller {
                                        // drag map
                                        return new DragBackground(event);
                                }
-                       } else if ( event.type == MouseEvent.MOUSE_UP && focus == null && map.dragstate!=map.DRAGGING ) {
-                               return new NoSelection();
+                       } else if ( event.type == MouseEvent.MOUSE_UP && focus == null && map.dragstate!=map.DRAGGING) {
+                               return (this is NoSelection) ? null : new NoSelection();
                        } else if ( event.type == MouseEvent.ROLL_OVER ) {
                                controller.map.setHighlight(focus, { hover: true });
                        } else if ( event.type == MouseEvent.MOUSE_OUT ) {
index dcbdf85..8737de1 100644 (file)
@@ -18,9 +18,13 @@ package net.systemeD.potlatch2.controller {
                }
                
                override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
+                       var cs:ControllerState = sharedMouseEvents(event, entity);
+                       if (cs) return cs;
+
+                       var paint:MapPaint = getMapPaint(DisplayObject(event.target));
                        var focus:Entity = getTopLevelFocusEntity(entity);
 
-                       if (event.type==MouseEvent.MOUSE_UP && focus==null && map.dragstate!=map.DRAGGING) {
+                       if (event.type==MouseEvent.MOUSE_UP && (focus==null || (paint && paint.isBackground)) && map.dragstate!=map.DRAGGING) {
                                map.dragstate=map.NOT_DRAGGING;
                                var undo:CompositeUndoableAction = new BeginWayAction();
                                var startNode:Node = controller.connection.createNode(
@@ -31,8 +35,7 @@ package net.systemeD.potlatch2.controller {
                                MainUndoStack.getGlobalStack().addAction(undo);
                                return new DrawWay(way, true, false);
                        }
-                       var cs:ControllerState = sharedMouseEvents(event, entity);
-                       return cs ? cs : this;
+                       return this;
                }
                
                override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
index cdfcdb9..b5b91bb 100755 (executable)
                        Globals.vars.map_area = map_area;
                        Globals.vars.root = map_area.rawChildren;                       // set up global reference to root level
                        var _root:IChildList = map_area.rawChildren;            // convenient local shorthand
+                       Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';
 
                        // populate sharedObject with loaderInfo parameters if supplied
                        var obj:SharedObject = SharedObject.getLocal("user_state");