diff --git a/src/path/Path.js b/src/path/Path.js index d72be39c..38ca020b 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1733,11 +1733,12 @@ var Path = PathItem.extend(/** @lends Path# */{ // graph to run the hit-test on it. area = new Path({ internal: true, closed: true }); if (isJoin) { - // It's a join. See that it's not a round one (collinear - // handles). - // _addBevelJoin() handles both 'bevel' and 'miter' joins. - Path._addBevelJoin(segment, join, strokeRadius, - miterLimit, null, strokeMatrix, addToArea, true); + // Only add bevels to segments that aren't smooth. + if (!segment.isSmooth()) { + // _addBevelJoin() handles both 'bevel' and 'miter'. + Path._addBevelJoin(segment, join, strokeRadius, + miterLimit, null, strokeMatrix, addToArea, true); + } } else if (cap === 'square') { Path._addSquareCap(segment, cap, strokeRadius, null, strokeMatrix, addToArea, true); @@ -2714,10 +2715,7 @@ statics: { function addJoin(segment, join) { // When both handles are set in a segment and they are collinear, // the join setting is ignored and round is always used. - var handleIn = segment._handleIn, - handleOut = segment._handleOut; - if (join === 'round' || !handleIn.isZero() && !handleOut.isZero() - && handleIn.isCollinear(handleOut)) { + if (join === 'round' || segment.isSmooth()) { addRound(segment); } else { // _addBevelJoin() handles both 'bevel' and 'miter' joins. diff --git a/src/path/Segment.js b/src/path/Segment.js index d9d863d5..c372b7d9 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -243,6 +243,20 @@ var Segment = Base.extend(/** @lends Segment# */{ return !this._handleIn.isZero() || !this._handleOut.isZero(); }, + /** + * Checks if the segment connects two curves smoothly, meaning that its two + * handles are collinear and segment does not form a corner. + * + * @return {Boolean} {@true if the segment is smooth} + * @see Point#isCollinear() + */ + isSmooth: function() { + var handleIn = this._handleIn, + handleOut = this._handleOut; + return !handleIn.isZero() && !handleOut.isZero() + && handleIn.isCollinear(handleOut); + }, + /** * Clears the segment's handles by setting their coordinates to zero, * turning the segment into a corner.