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 b139fa8..6ff1bb8 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 fa903c6..6e83229 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);
         }