Permalink
Browse files

fixed bug in wire bezier drawing

  • Loading branch information...
1 parent e309b80 commit 8cd7910926a7f0bf4bc29ab3cbbe53fb4967730a @joshtynjala committed Feb 24, 2011
@@ -3,7 +3,6 @@ package com.flextoolbox.jacksIntro.skins
import com.flextoolbox.controls.wireClasses.BaseWireRenderer;
import com.joshtynjala.utils.GraphicsUtil;
import com.yahoo.astra.utils.DisplayObjectUtil;
- import com.yahoo.astra.utils.GeomUtil;
import flash.display.CapsStyle;
import flash.events.MouseEvent;
@@ -82,18 +81,43 @@ package com.flextoolbox.jacksIntro.skins
var distance:Number = Math.min(100, Point.distance(start, end) / 2);
var controlPoints:Array = [c1, c2];
+
+ var controlPoints:Array = [c1, c2];
if(!isNaN(angle1))
{
- var d1:Point = Point.polar(distance, -GeomUtil.degreesToRadians(angle1));
+ var d1:Point = Point.polar(distance, angle1 * Math.PI / 180);
+ d1.y *= -1;
d1 = d1.add(start);
- controlPoints[0] = d1;
+ if(d1.x == c1.x)
+ {
+ c1.y = d1.y;
+ }
+ else if(d1.y == c1.y)
+ {
+ c1.x = d1.x;
+ }
+ else
+ {
+ controlPoints[0] = d1;
+ }
}
if(!isNaN(angle2))
{
- var d2:Point = Point.polar(distance, -GeomUtil.degreesToRadians(angle2));
+ var d2:Point = Point.polar(distance, angle2 * Math.PI / 180);
+ d2.y *= -1;
d2 = d2.add(end);
- controlPoints.push(d2);
- controlPoints[1] = d2;
+ if(d2.x == c2.x)
+ {
+ c2.y = d2.y;
+ }
+ else if(d2.y == c2.y)
+ {
+ c2.x = d2.x;
+ }
+ else
+ {
+ controlPoints[1] = d2;
+ }
}
this.graphics.lineStyle(6, 0xd8d8d8, 1, true, "normal", CapsStyle.NONE);
@@ -26,13 +26,9 @@ package com.flextoolbox.controls.wireClasses
{
import com.joshtynjala.utils.BezierUtil;
import com.yahoo.astra.utils.DisplayObjectUtil;
- import com.yahoo.astra.utils.GeomUtil;
import flash.events.MouseEvent;
import flash.geom.Point;
-
- import mx.styles.CSSStyleDeclaration;
- import mx.styles.StyleManager;
//--------------------------------------
// Styles
@@ -123,21 +119,42 @@ package com.flextoolbox.controls.wireClasses
var distance:Number = Math.min(100, Point.distance(start, end) / 2);
- var controlPoints:Array = [c1, c2];
+ var controlPoints:Vector.<Point> = new <Point>[c1, c2];
if(!isNaN(angle1))
{
- var d1:Point = Point.polar(distance, GeomUtil.degreesToRadians(angle1));
+ var d1:Point = Point.polar(distance, angle1 * Math.PI / 180);
d1.y *= -1;
d1 = d1.add(start);
- controlPoints[0] = d1;
+ if(d1.x == c1.x)
+ {
+ c1.y = d1.y;
+ }
+ else if(d1.y == c1.y)
+ {
+ c1.x = d1.x;
+ }
+ else
+ {
+ controlPoints[0] = d1;
+ }
}
if(!isNaN(angle2))
{
- var d2:Point = Point.polar(distance, GeomUtil.degreesToRadians(angle2));
+ var d2:Point = Point.polar(distance, angle2 * Math.PI / 180);
d2.y *= -1;
d2 = d2.add(end);
- controlPoints.push(d2);
- controlPoints[1] = d2;
+ if(d2.x == c2.x)
+ {
+ c2.y = d2.y;
+ }
+ else if(d2.y == c2.y)
+ {
+ c2.x = d2.x;
+ }
+ else
+ {
+ controlPoints[1] = d2;
+ }
}
var thickness:Number = this.getStyle("thickness");

0 comments on commit 8cd7910

Please sign in to comment.