The solution would be to check if the path has only 1 segment and then add an extra one if it has:
var path;
function onMouseDown(event) {
path = new Path();
path.strokeColor = 'black';
path.add(event.point);
}
function onMouseDrag(event) {
if(Key.isDown('a')) {
if (path.segments.length == 1)
path.add(event.point);
// If the 'a' key is down, change the point of
// the last segment to the position of the mouse:
path.lastSegment.point = event.point;
} else {
// If the a key is not down, add a segment
// to the path at the position of the mouse:
path.add(event.point);
}
}
On Jun 6, 2012, at 1:25 AM, Dan Salmonsen wrote: