Skip to content

Commit

Permalink
Change the 'miter' joint style behaviour a bit by placing a hard limi…
Browse files Browse the repository at this point in the history
…t on how extruded the joint can become. This will stop cases where a stroke with sharp angles produce very long corners - ideally this would be resolved by supportting the 'bevel' joint style, but there are no plans for this, so this hybrid behaviour seems more appropriate for the time being.
  • Loading branch information
jonathanrpace committed May 20, 2013
1 parent f5ba3f1 commit 14d8149
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Binary file modified extension/bin/Starling-Extension-Graphics.swc
Binary file not shown.
6 changes: 6 additions & 0 deletions extension/src/starling/display/graphics/Stroke.as
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,16 @@ package starling.display.graphics
// Thanks to Tom Clapham for spotting this relationship.
var dot:Number = (d0x*d1x+d0y*d1y) / (d0*d1);
elbowThickness /= sin((PI-Math.acos(dot)) * 0.5);

if ( elbowThickness > v1.thickness * 4 )
{
elbowThickness = v1.thickness * 4;
}

if ( isNaN( elbowThickness ) )
{
elbowThickness = v1.thickness*0.5;
}
}

var n0x:Number = -d0y / d0;
Expand Down

1 comment on commit 14d8149

@AlBirdie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this fixes the issue with "long corners", it amplified the issue that sometimes line sections are not being drawn when they are either very close to each other or have very steep angles.

The attached images show the difference between a stroke before and after this commit.
line_before
line_after

Note that this is on a non-retina iPad, so the lines are quite aliased.

Please sign in to comment.