From 0869cccfe8507b33cb3cca7e1369e62d81ed26c3 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Tue, 31 Aug 2010 16:26:02 +0000 Subject: [PATCH] Fixed Stuff --- halcyon_viewer.as | 1 + net/systemeD/halcyon/DebugURLRequest.as | 9 ++++++--- net/systemeD/halcyon/Map.as | 7 +++---- net/systemeD/potlatch2/controller/ControllerState.as | 11 ++++++----- net/systemeD/potlatch2/controller/NoSelection.as | 9 ++++++--- potlatch2.mxml | 1 + 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/halcyon_viewer.as b/halcyon_viewer.as index 11f8fa87..3b01b9e9 100755 --- a/halcyon_viewer.as +++ b/halcyon_viewer.as @@ -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(); diff --git a/net/systemeD/halcyon/DebugURLRequest.as b/net/systemeD/halcyon/DebugURLRequest.as index 3eabbc37..8aa038bb 100644 --- a/net/systemeD/halcyon/DebugURLRequest.as +++ b/net/systemeD/halcyon/DebugURLRequest.as @@ -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; } diff --git a/net/systemeD/halcyon/Map.as b/net/systemeD/halcyon/Map.as index 833c6563..2f71a52a 100755 --- a/net/systemeD/halcyon/Map.as +++ b/net/systemeD/halcyon/Map.as @@ -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 { diff --git a/net/systemeD/potlatch2/controller/ControllerState.as b/net/systemeD/potlatch2/controller/ControllerState.as index b1a6121a..4a2d4335 100644 --- a/net/systemeD/potlatch2/controller/ControllerState.as +++ b/net/systemeD/potlatch2/controller/ControllerState.as @@ -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 ) { diff --git a/net/systemeD/potlatch2/controller/NoSelection.as b/net/systemeD/potlatch2/controller/NoSelection.as index dcbdf85c..8737de17 100644 --- a/net/systemeD/potlatch2/controller/NoSelection.as +++ b/net/systemeD/potlatch2/controller/NoSelection.as @@ -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 { diff --git a/potlatch2.mxml b/potlatch2.mxml index cdfcdb93..b5b91bb4 100755 --- a/potlatch2.mxml +++ b/potlatch2.mxml @@ -100,6 +100,7 @@ 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"); -- 2.37.0