Skip to content

Commit

Permalink
Fix knob useEffect conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-thompson committed Nov 27, 2023
1 parent de1aac3 commit 61ac850
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Knob.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function cx(...classes) {
return classes.filter(Boolean).join(' ')
}

function draw(ctx, width, height, value, trackColor, meterColor, knobColor, thumbColor) {
function draw(ctx, width, height, value, meterColor, knobColor, thumbColor) {
ctx.clearRect(0, 0, width, height);

const hw = width * 0.5;
Expand Down Expand Up @@ -55,7 +55,7 @@ function Knob(props) {
height: 0,
});

let {className, trackColor, meterColor, knobColor, thumbColor, ...other} = props;
let {className, meterColor, knobColor, thumbColor, ...other} = props;
let classes = cx(className, 'relative touch-none');

useEffect(function() {
Expand Down Expand Up @@ -84,8 +84,8 @@ function Knob(props) {
canvas.width = bounds.width;
canvas.height = bounds.height;

draw(ctx, bounds.width, bounds.height, props.value, trackColor, meterColor, knobColor, thumbColor);
}, [bounds, props.value]);
draw(ctx, bounds.width, bounds.height, props.value, meterColor, knobColor, thumbColor);
}, [bounds, props.value, meterColor, knobColor, thumbColor]);

return (
<DragBehavior className={classes} {...other}>
Expand Down

0 comments on commit 61ac850

Please sign in to comment.