Skip to content

Commit

Permalink
Omit an ending line segment (when writing a shape to a Canvas context…
Browse files Browse the repository at this point in the history
…) if our path is closed, see phetsims/ph-scale#83
  • Loading branch information
jonathanolson authored and pixelzoom committed Jul 23, 2019
1 parent 4ec082d commit 41f5c22
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/util/Subpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ define( function( require ) {
context.moveTo( startPoint.x, startPoint.y ); // the segments assume the current context position is at their start

var len = this.segments.length;

// Omit an ending line segment if our path is closed.
// see https://github.com/phetsims/ph-scale/issues/83#issuecomment-512663949
if ( this.closed && len >= 2 && this.segments[ len - 1 ] instanceof Line ) {
len--;
}

for ( var i = 0; i < len; i++ ) {
this.segments[ i ].writeToContext( context );
}
Expand Down

0 comments on commit 41f5c22

Please sign in to comment.