Skip to content

Commit

Permalink
perf: Avoid overhead calculation if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
miyanokomiya committed Apr 26, 2024
1 parent c5c66ad commit 3c51377
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,7 @@ export function clamp(min = -Infinity, max = Infinity, val: number) {
*/
export function circleClamp(min: number, max: number, val: number) {
if (min === max) return min
if (min <= val && val <= max) return val

if (max < val) {
return ((val - max) % (max - min)) + min
Expand Down

0 comments on commit 3c51377

Please sign in to comment.