Skip to content

Commit 93b51c5

Browse files
committed
Bug fix: handleSlider() always used default color even in rainbow mode
1 parent d51731e commit 93b51c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

33 - Etch-a-Sketch/etch-a-sketch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ function vigorousStroke() {
8787
}
8888

8989
function handleSlider() {
90-
console.log(`slider.value ${slider.value} and ctx.lineWidth ${ctx.lineWidth}`);
90+
let tmpStrokeColor = ctx.strokeStyle;
91+
9192
if (slider.value < ctx.lineWidth) {
9293
ctx.strokeStyle = `rgb(${CANVAS_BACKGROUND})`;
9394
vigorousStroke();
9495
ctx.lineWidth = slider.value;
95-
ctx.strokeStyle = DEFAULT_STROKE_COLOR;
96+
ctx.strokeStyle = tmpStrokeColor;
9697
ctx.stroke();
9798
}
9899
else {
99-
ctx.strokeStyle = DEFAULT_STROKE_COLOR;
100100
ctx.lineWidth = slider.value;
101101
ctx.stroke();
102102
}

0 commit comments

Comments
 (0)