Skip to content

Commit 5ff911f

Browse files
committed
Have Path#closePath() handle merging of first and last segment, if doubled.
So we finally found a reason for #closePath() to stick around :)
1 parent 30b7891 commit 5ff911f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/path/CompoundPath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
241241
},
242242

243243
closePath: function() {
244-
getCurrentPath(this).setClosed(true);
244+
getCurrentPath(this).closePath();
245245
}
246246
};
247247

src/path/Path.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,12 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
22022202
},
22032203

22042204
closePath: function() {
2205+
var first = this.getFirstSegment(),
2206+
last = this.getLastSegment();
2207+
if (first._point.equals(last._point)) {
2208+
first.setHandleIn(last._handleIn);
2209+
last.remove();
2210+
}
22052211
this.setClosed(true);
22062212
}
22072213
};

0 commit comments

Comments
 (0)