mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
Move start position after a close path (z) to the starting node of the path (previous M).
This commit is contained in:
@@ -295,9 +295,22 @@
|
||||
|
||||
// Note: lineTo handlers need to be above this point
|
||||
case 'm':
|
||||
cpx += p.shift();
|
||||
cpy += p.shift();
|
||||
var dx = p.shift();
|
||||
var dy = p.shift();
|
||||
cpx += dx;
|
||||
cpy += dy;
|
||||
cmd = 'M';
|
||||
// After closing the path move the current position
|
||||
// to the the first point of the path (if any).
|
||||
if(ca.length>2 && ca[ca.length-1].command==='z'){
|
||||
for(var idx=ca.length-2;idx>=0;idx--){
|
||||
if(ca[idx].command==='M'){
|
||||
cpx=ca[idx].points[0]+dx;
|
||||
cpy=ca[idx].points[1]+dy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
points.push(cpx, cpy);
|
||||
c = 'l';
|
||||
// subsequent points are treated as relative lineTo
|
||||
|
||||
Reference in New Issue
Block a user