Skip to content

Commit

Permalink
fix: add padding for screen range
Browse files Browse the repository at this point in the history
  • Loading branch information
fcastrovilli committed Apr 6, 2024
1 parent 4b424d6 commit a2222b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/colors.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@

const touchX = touch.clientX;
const screenCenter = window.innerWidth / 2;
value = Math.min(Math.max(Math.round(((touchX - screenCenter) / screenCenter) * 50), -100), 0);
value = Math.min(
Math.max(Math.round(((touchX - screenCenter) / screenCenter) * 50 - 50), -100),
0
);
if (osc) osc.volume.linearRampTo(value, 0.3);
}}
class="flex justify-center items-center"
Expand Down

0 comments on commit a2222b8

Please sign in to comment.