Fix flex bug with dragEvent returning negative stageX/stageY. Fixes #3613
authorAndy Allan <andy@gravitystorm.co.uk>
Tue, 29 Mar 2011 13:49:12 +0000 (14:49 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Tue, 29 Mar 2011 13:49:12 +0000 (14:49 +0100)
potlatch2.mxml

index c8b210b..a00c46d 100644 (file)
 
                        // 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);