|
@@ -10,20 +10,21 @@ class RoundRect {
|
|
|
var lenSq : Float;
|
|
|
var invLenSq : Float;
|
|
|
|
|
|
- public inline function new(x:Float,y:Float,rayW:Float,rayH:Float,rotation:Float) {
|
|
|
- if( rayW < rayH ) {
|
|
|
- var tmp = rayW;
|
|
|
- rayW = rayH;
|
|
|
- rayH = tmp;
|
|
|
+ public inline function new(x:Float,y:Float,w:Float,h:Float,rotation:Float) {
|
|
|
+ if( w < h ) {
|
|
|
+ var tmp = w;
|
|
|
+ w = h;
|
|
|
+ h = tmp;
|
|
|
rotation += Math.PI / 2;
|
|
|
}
|
|
|
- this.ray = rayH;
|
|
|
- var dx = (rayW - rayH) * Math.cos(rotation);
|
|
|
- var dy = (rayW - rayH) * Math.sin(rotation);
|
|
|
+ var hseg = (w - h) * 0.5;
|
|
|
+ var dx = hseg * Math.cos(rotation);
|
|
|
+ var dy = hseg * Math.sin(rotation);
|
|
|
this.x = x - dx;
|
|
|
this.y = y - dy;
|
|
|
this.dx = dx * 2;
|
|
|
this.dy = dy * 2;
|
|
|
+ this.ray = h * 0.5;
|
|
|
lenSq = this.dx * this.dx + this.dy * this.dy;
|
|
|
invLenSq = 1 / lenSq;
|
|
|
}
|