Simplified redraw

This commit is contained in:
Luis Leiva 2019-07-23 09:57:49 +03:00
parent e18f23123e
commit be740d5c60
2 changed files with 30 additions and 42 deletions

View File

@ -687,36 +687,30 @@
}
if (t === 0) {
sketch.beginPath();
// Draw first point of stroke.
if (options.graphics.firstPointSize > 0) {
sketch.beginFill(lineColor)
sketch.beginFill(options.graphics.fillStyle)
.fillCircle(currPt[0], currPt[1], options.graphics.firstPointSize)
.endFill();
}
}
// Connect consecutive points with lines.
if (nextPt) {
var lineColor, lineWidth;
// Set line styles.
var lc, lw;
if (isDrawing) {
// Style for regular, pendown strokes.
lineColor = options.strokeStyle;
lineWidth = options.lineWidth;
lc = options.strokeStyle;
lw = options.lineWidth;
} else if (options.mouseupMovements) {
// Style for penup strokes.
lineColor = options.mouseupMovements.strokeStyle || '#DDD';
lineWidth = options.mouseupMovements.lineWidth || 1;
lc = options.mouseupMovements.strokeStyle || '#DDD';
lw = options.mouseupMovements.lineWidth || 1;
}
sketch.lineStyle(lineColor, lineWidth)
sketch.lineStyle(lc, lw);
} else if (nextPt) {
// Connect consecutive points with lines.
sketch.beginPath()
.line(currPt[0], currPt[1], nextPt[0], nextPt[1])
.stroke();
}
// Flag stroke change.
if (t === stroke.length - 1) {
sketch.closePath();
.stroke()
.closePath();
}
}
}

View File

@ -682,36 +682,30 @@
}
if (t === 0) {
sketch.beginPath();
// Draw first point of stroke.
if (options.graphics.firstPointSize > 0) {
sketch.beginFill(lineColor)
sketch.beginFill(options.graphics.fillStyle)
.fillCircle(currPt[0], currPt[1], options.graphics.firstPointSize)
.endFill();
}
}
// Connect consecutive points with lines.
if (nextPt) {
var lineColor, lineWidth;
// Set line styles.
var lc, lw;
if (isDrawing) {
// Style for regular, pendown strokes.
lineColor = options.strokeStyle;
lineWidth = options.lineWidth;
lc = options.strokeStyle;
lw = options.lineWidth;
} else if (options.mouseupMovements) {
// Style for penup strokes.
lineColor = options.mouseupMovements.strokeStyle || '#DDD';
lineWidth = options.mouseupMovements.lineWidth || 1;
lc = options.mouseupMovements.strokeStyle || '#DDD';
lw = options.mouseupMovements.lineWidth || 1;
}
sketch.lineStyle(lineColor, lineWidth)
sketch.lineStyle(lc, lw);
} else if (nextPt) {
// Connect consecutive points with lines.
sketch.beginPath()
.line(currPt[0], currPt[1], nextPt[0], nextPt[1])
.stroke();
}
// Flag stroke change.
if (t === stroke.length - 1) {
sketch.closePath();
.stroke()
.closePath();
}
}
}