fix coord transport for the bitmap sprites
authorDave Stubbs <osm@randomjunk.co.uk>
Sat, 10 Oct 2009 16:14:52 +0000 (16:14 +0000)
committerDave Stubbs <osm@randomjunk.co.uk>
Sat, 10 Oct 2009 16:14:52 +0000 (16:14 +0000)
net/systemeD/halcyon/POI.as
net/systemeD/potlatch2/EditController.as

index b139fa896daf22023fefef32f748da0a79a53611..6ff1bb896e32abf67c880733023fc84f9df932b8 100644 (file)
@@ -7,6 +7,7 @@ package net.systemeD.halcyon {
        import flash.text.TextField;
        import flash.text.TextFormat;
     import net.systemeD.halcyon.connection.Node;
+    import net.systemeD.halcyon.connection.Connection;
        import net.systemeD.halcyon.styleparser.*;
        
        public class POI extends Object {
@@ -30,6 +31,11 @@ package net.systemeD.halcyon {
                        this.map = map;
                        this.node = node;
                        redraw(sl);
+                       node.addEventListener(Connection.NODE_MOVED, nodeMoved);
+               }
+               
+               public function nodeMoved(event:Event):void {
+                   updatePosition();
                }
                
                public function redraw(sl:StyleList=null):Boolean {
@@ -88,6 +94,12 @@ package net.systemeD.halcyon {
                        updatePosition();
 
             icon.addEventListener(MouseEvent.CLICK, mouseEvent);
+            icon.addEventListener(MouseEvent.DOUBLE_CLICK, mouseEvent);
+            icon.addEventListener(MouseEvent.MOUSE_OVER, mouseEvent);
+            icon.addEventListener(MouseEvent.MOUSE_OUT, mouseEvent);
+            icon.addEventListener(MouseEvent.MOUSE_DOWN, mouseEvent);
+            icon.addEventListener(MouseEvent.MOUSE_UP, mouseEvent);
+            icon.addEventListener(MouseEvent.MOUSE_MOVE, mouseEvent);
             icon.buttonMode = true;
             icon.mouseEnabled = true;
 
index fa903c62295f4d717380b477757a3ee9c5a01a08..6e83229bd5f29f8dbe8a1a5c1ccc171e5c383abb 100644 (file)
@@ -70,6 +70,10 @@ package net.systemeD.potlatch2 {
             //if ( event.type == MouseEvent.MOUSE_DOWN )
             event.stopPropagation();
                 
+            var mapLoc:Point = map.globalToLocal(new Point(event.stageX, event.stageY));
+            event.localX = mapLoc.x;
+            event.localY = mapLoc.y;
+
             var newState:ControllerState = state.processMouseEvent(event, entity);
             setState(newState);
         }