Path#join: use internal variables.

This commit is contained in:
Jonathan Puckey 2011-04-21 18:43:22 +02:00
parent ff9976ab57
commit cf2faa14e3

View file

@ -177,19 +177,19 @@ var Path = this.Path = PathItem.extend({
var segments = path.segments; var segments = path.segments;
var last1 = this.getLastSegment(); var last1 = this.getLastSegment();
var last2 = path.getLastSegment(); var last2 = path.getLastSegment();
if (last1.getPoint().equals(last2.getPoint())) if (last1._point.equals(last2._point))
path.reverse(); path.reverse();
var first2 = path.getFirstSegment(); var first2 = path.getFirstSegment();
if (last1.getPoint().equals(first2.getPoint())) { if (last1._point.equals(first2._point)) {
last1.setHandleOut(first2.getHandleOut()); last1.setHandleOut(first2.handleOut);
for (var i = 1, l = segments.length; i < l; i++) for (var i = 1, l = segments.length; i < l; i++)
this._add(segments[i]); this._add(segments[i]);
} else { } else {
var first1 = this.getFirstSegment(); var first1 = this.getFirstSegment();
if (first1.getPoint().equals(first2.getPoint())) if (first1._point.equals(first2._point))
path.reverse(); path.reverse();
if (first1.getPoint().equals(last2.getPoint())) { if (first1._point.equals(last2._point)) {
first1.setHandleIn(last2.getHandleIn()); first1.setHandleIn(last2._handleIn);
// Prepend all segments from path except last one // Prepend all segments from path except last one
for (var i = 0, l = segments.length - 1; i < l; i++) for (var i = 0, l = segments.length - 1; i < l; i++)
this._add(segments[i], 0); this._add(segments[i], 0);
@ -202,8 +202,8 @@ var Path = this.Path = PathItem.extend({
// Close if they touch in both places // Close if they touch in both places
var first1 = this.getFirstSegment(); var first1 = this.getFirstSegment();
last1 = this.getLastSegment(); last1 = this.getLastSegment();
if (last1.getPoint().equals(first1.getPoint())) { if (last1._point.equals(first1._point)) {
first1.setHandleIn(last1.getHandleIn()); first1.setHandleIn(last1._handleIn);
last1.remove(); last1.remove();
this.closed = true; this.closed = true;
} }