move "show lat/long" from a keypress to an option. Slightly keen that P2 should not...
authorRichard Fairhurst <richard@systemed.net>
Sat, 19 Feb 2011 14:29:46 +0000 (14:29 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sat, 19 Feb 2011 14:29:46 +0000 (14:29 +0000)
net/systemeD/halcyon/Map.as
net/systemeD/halcyon/MapEvent.as
net/systemeD/potlatch2/options/OptionsDialog.mxml
potlatch2.mxml

index ab8a2b4..eb3b154 100644 (file)
@@ -92,9 +92,6 @@ package net.systemeD.halcyon {
                /** VectorLayer objects */
                public var vectorlayers:Object={};  
                
-               /** Should the position of mouse cursor be shown to the user? */
-               private var showingLatLon:Boolean=false;  
-               
                // ------------------------------------------------------------------------------------------
                /** Map constructor function */
         public function Map(initparams:Object) {
@@ -432,11 +429,6 @@ package net.systemeD.halcyon {
                        download();
                }
 
-        private function toggleReportPosition():void {
-            showingLatLon = !showingLatLon;
-            this.dispatchEvent(new MapEvent(MapEvent.TOGGLE_LATLON, {latlon: showingLatLon}));
-        }
-               
                /** Switch to new MapCSS. */
                public function setStyle(url:String):void {
                        styleurl=url;
@@ -523,7 +515,7 @@ package net.systemeD.halcyon {
                public function mouseMoveHandler(event:MouseEvent):void {
                        if (!_draggable) { return; }
                        if (dragstate==NOT_DRAGGING) { 
-                          this.dispatchEvent(new MapEvent(MapEvent.MOUSEOVER, { x: coord2lon(mouseX), y: coord2lat(mouseY) }));
+                          this.dispatchEvent(new MapEvent(MapEvent.MOUSE_MOVE, { x: coord2lon(mouseX), y: coord2lat(mouseY) }));
                return; 
             }
                        
@@ -561,7 +553,6 @@ package net.systemeD.halcyon {
                                case Keyboard.UP:       moveMap(0,mapheight/2); break;           // up cursor
                                case Keyboard.RIGHT:    moveMap(-mapwidth/2,0); break;   // right cursor
                                case Keyboard.DOWN:     moveMap(0,-mapheight/2); break;      // down cursor
-                               case 76:        toggleReportPosition(); break;                  // L - report lat/long
                        }
                }
 
index a51473f..3dfeeba 100644 (file)
@@ -19,8 +19,7 @@ package net.systemeD.halcyon {
         public static const INITIALISED:String = "initialized";
                /** Backrgound imagery has changed to one with attribution that must not be obscured. */
                public static const BUMP:String = "bump";
-               public static const MOUSEOVER:String="mouseover";
-               public static const TOGGLE_LATLON:String="toggle_latlon";
+               public static const MOUSE_MOVE:String="mouse_move";
                public static const ERROR:String = "error";                             // ** FIXME - this should be a dedicated ErrorEvent class
 
                /** Event-specific parameters. */
index b75c8fd..8771576 100644 (file)
@@ -20,6 +20,7 @@
         tbcheck.selected = Application.application.toolbox.visible;
         cursorcheck.selected = Application.application.theController.cursorsEnabled;
         tigercheck.selected = obj.data['tiger_highlighted'];
+        latlongcheck.selected = Application.application.coordsbox.visible;
     }
     
     private function optionsDialog_close(evt:CloseEvent):void {
@@ -46,6 +47,9 @@
     <mx:CheckBox width="100%" label="Highlight unedited TIGER (US roads)" selected="false" id="tigercheck"
         change="tigerToggle()" />
 
+       <mx:CheckBox width="100%" label="Show mouse latitude/longitude" selected="false" id="latlongcheck" 
+               change="Application.application.coordsbox.visible=latlongcheck.selected" />
+
   <mx:ControlBar>
     <mx:Spacer width="100%"/>
     <mx:Button label="Ok" click="PopUpManager.removePopUp(this);" styleName="titleWindowButton" />
index aeaa71d..200408a 100644 (file)
 
                        // keyboard event attached to stage
                        stage.addEventListener(KeyboardEvent.KEY_UP, theMap.keyUpHandler);
+            
+                       // mouse-position listener for co-ordinate display
+            theMap.addEventListener(MapEvent.MOUSE_MOVE, mouseoverHandler);
 
                        // position toolbox
                        toolbox=Toolbox(PopUpManager.createPopUp(this,Toolbox,false));
             theController = new EditController(theMap, tagViewer, toolbox);
             theController.setActive();
             
-            theMap.addEventListener(MapEvent.MOUSEOVER, mouseoverHandler);
-            theMap.addEventListener(MapEvent.TOGGLE_LATLON, togglelatlonHandler);
-            
             var conn:Connection = Connection.getConnectionInstance();
             conn.addEventListener(Connection.LOAD_STARTED, onDataStart);
             conn.addEventListener(Connection.LOAD_COMPLETED, onDataComplete);
             }
         }
 
-        private function togglelatlonHandler(e:MapEvent):void {
-            coordsbox.visible = e.params.latlon;
-        }
-
-
         private function onDataStart(event:Event):void {
                        switch (event.type) {
                                case Connection.LOAD_STARTED:   loadcount++; break;