Merge remote-tracking branch 'gravitystorm/i18n' into staging
[potlatch2.git] / potlatch2.mxml
index 74e434d98372e819d08656624e597be32771c630..fbf700e56f28d06f559188ed520809e240d8f6ba 100644 (file)
         <mx:PopUpButton id="styleButton" label="Map Style" openAlways="true" styleName="appBarButton"
             creationComplete="styleButton.popUp = new StyleSelector();"/>
                <mx:PopUpMenuButton id="gpsButton" styleName="appBarButton"
-                   itemClick="if (event.index==0) { trackLoader.load(); } else { new MyGpxDialog().init(); }">
+                   itemClick="if (event.index==0) { trackLoader.load(); } 
+                         else if (event.index==1) { new MyGpxDialog().init(); } 
+                                             else { mx.controls.Menu(gpsButton.popUp).selectedIndex=0; 
+                                                    mx.controls.Menu(gpsButton.popUp).selectedIndex=0; /* Yes, we do need to call it twice */
+                                                    theMap.removeVectorLayer(theMap.findVectorLayer('GPS tracks')); }">
                        <mx:dataProvider>
                                <mx:Array>
                                        <mx:Object label="GPS data" id="gpsData" />
                                        <mx:Object label="My tracks" id="myTracks" />
+                                       <mx:Object label="Clear" id="clearGps" />
                                </mx:Array>
                        </mx:dataProvider>
                </mx:PopUpMenuButton>
 
                        // Get the tags
             var tags:Array = event.dragSource.dataForFormat('tags') as Array;
-            var mapLoc:Point = Globals.vars.root.globalToLocal(new Point(event.stageX, event.stageY));
+
+            // If you dnd quick enough, this exposes a flex bug and event.stageX/Y become negative.
+            // Take the mouse positions from a displayObject's stage for consistent results.
+            var mapLoc:Point = Globals.vars.root.globalToLocal(new Point(event.target.stage.mouseX, event.target.stage.mouseY));
             var lat:Number = Globals.vars.root.coord2lat(mapLoc.y);
             var lon:Number = Globals.vars.root.coord2lon(mapLoc.x);