Skip to content

Commit

Permalink
fix: Fix SVG path close logic. (#3377)
Browse files Browse the repository at this point in the history
  • Loading branch information
jheer committed Mar 9, 2022
1 parent f3eebf4 commit f5a91c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/vega-scenegraph/src/path/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export default function(context, path, l, t, sX, sY) {
tempX,
tempY,
tempControlX,
tempControlY;
tempControlY,
anchorX = 0,
anchorY = 0;

if (l == null) l = 0;
if (t == null) t = 0;
Expand Down Expand Up @@ -86,12 +88,16 @@ export default function(context, path, l, t, sX, sY) {
case 'm': // moveTo, relative
x += current[1];
y += current[2];
anchorX = x;
anchorY = y;
context.moveTo(x + l, y + t);
break;

case 'M': // moveTo, absolute
x = current[1];
y = current[2];
anchorX = x;
anchorY = y;
context.moveTo(x + l, y + t);
break;

Expand Down Expand Up @@ -298,6 +304,8 @@ export default function(context, path, l, t, sX, sY) {

case 'z':
case 'Z':
x = anchorX;
y = anchorY;
context.closePath();
break;
}
Expand Down

0 comments on commit f5a91c8

Please sign in to comment.