Send X-Error-Format workaround on OAuth PUT too
[potlatch2.git] / net / systemeD / halcyon / Elastic.as
old mode 100755 (executable)
new mode 100644 (file)
index 134ea6d..f0daa9d
@@ -12,6 +12,7 @@ package net.systemeD.halcyon {
        import net.systemeD.halcyon.styleparser.*;
     import net.systemeD.halcyon.connection.*;
 
+       /** The elastic is a visual indication of a way that the user is currently in the process of drawing. */
        public class Elastic {
 
                public var map:Map;                                                     // reference to parent map
@@ -19,6 +20,7 @@ package net.systemeD.halcyon {
         private var _start:Point;
         private var _end:Point;
 
+               /** Create and draw the elastic. */
                public function Elastic(map:Map, start:Point, end:Point) {
                        this.map = map;
                        this._start = start;
@@ -44,49 +46,35 @@ package net.systemeD.halcyon {
                    return _end;
                }
                
+               /** Remove all currently existing sprites */
                public function removeSprites():void {
-                       // Remove all currently existing sprites
+                       
                        while (sprites.length>0) {
                                var d:DisplayObject=sprites.pop(); d.parent.removeChild(d);
                        }
         }
         
+               /** Draws the elastic - a dashed line on the highest paint layer. */
                public function redraw():void {
                    removeSprites();
 
-                       // Iterate through each sublayer, drawing any styles on that layer
-                       var p0:Point = start;
-                       var p1:Point = end;
-
                        // Create stroke object
                        var stroke:Shape = new Shape();
             stroke.graphics.lineStyle(1, 0xff0000, 1, false, "normal", CapsStyle.ROUND, JointStyle.ROUND);
-                       addToLayer(stroke,3);
+
+                       var l:DisplayObject=map.paint.getPaintSpriteAt(map.paint.maxlayer);
+                       var o:DisplayObject=Sprite(l).getChildAt(3);    // names layer
+                       (o as Sprite).addChild(stroke);
+                       sprites.push(stroke);
+
                        dashedLine(stroke.graphics, [2,2]);
-                       
-                       var nodes:Sprite = new Sprite();
-            drawNodes(nodes.graphics);
-            addToLayer(nodes, 3);
+
 
                }
                
                // ------------------------------------------------------------------------------------------
                // Drawing support functions
 
-               private function drawNodes(g:Graphics):void {
-            g.lineStyle(1, 0xff0000, 1, false, "normal", CapsStyle.ROUND, JointStyle.ROUND);
-                       for (var i:uint = 0; i < 1; i++) {
-                var p:Point = i == 0 ? start : end;
-                var x:Number = map.lon2coord(p.x);
-                var y:Number = map.latp2coord(p.y);
-                g.moveTo(x-2, y-2);
-                g.lineTo(x+2, y-2);
-                g.lineTo(x+2, y+2);
-                g.lineTo(x-2, y+2);
-                g.lineTo(x-2, y-2);
-                       }
-               }
-
                // Draw dashed polyline
                
                private function dashedLine(g:Graphics,dashes:Array):void {
@@ -135,19 +123,5 @@ package net.systemeD.halcyon {
                                 else { g.moveTo(x,y); }
                }
 
-               
-               // Add object (stroke/fill/roadname) to layer sprite
-               
-               private function addToLayer(s:DisplayObject,t:uint,sublayer:int=-1):void {
-                       var l:DisplayObject=Map(map).getChildAt(map.WAYSPRITE+5);
-                       var o:DisplayObject=Sprite(l).getChildAt(t);
-                       if (sublayer!=-1) { o=Sprite(o).getChildAt(sublayer); }
-                       Sprite(o).addChild(s);
-                       sprites.push(s);
-            if ( s is Sprite ) {
-                Sprite(s).mouseEnabled = false;
-                Sprite(s).mouseChildren = false;
-            }
-               }
        }
 }