From 6c7c4d0798e2020c7d82af9358639817c1727576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 13 Mar 2014 03:28:46 +0100 Subject: [PATCH] Close previous paths if followed by a new M command. --- src/path/PathItem.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 567f2578..7ebe6efd 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -225,11 +225,14 @@ var PathItem = Item.extend(/** @lends PathItem# */{ switch (lower) { case 'm': case 'l': + var move = lower === 'm'; + if (move && previous && previous !== 'z') + this.closePath(); for (var j = 0; j < length; j += 2) - this[j === 0 && lower === 'm' ? 'moveTo' : 'lineTo']( + this[j === 0 && move ? 'moveTo' : 'lineTo']( current = getPoint(j)); control = current; - if(lower === 'm') + if (move) start = current; break; case 'h':