Skip to content

Commit

Permalink
Fix slider
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesWalker55 committed Nov 14, 2024
1 parent 23791ad commit ffbe8f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,8 @@ export class Context {
) {
value = low + ((this.mousePos.x - base.x) * (high - low)) / base.w;
if (step !== null && step !== 0) {
value = ((value + step / 2) / step) * step;
value = Math.round((value - low) / step) * step + low;
value = Math.max(low, Math.min(value, high));
}
}
// clamp and store value, update res
Expand Down

0 comments on commit ffbe8f9

Please sign in to comment.