AntoineW/luge

Missing Math.clamp

Closed this issue · 1 comments

You are using Math.clamp() in SmoothScroll & MouseObserver. But the function is not defined in your code.
On https://luge.cool/ you are using a vendor-function clamp().
I implemented this function and it works fine.
function clamp (value, min, max) {
return Math.max(min, Math.min(max, value))
}
It seems like your code provided here is not the one you are using.
Math.clamp() is missing.

Math.clamp() function is part of a new JS feature proposal that is not yet approved. However, it's covered by Babel preset so it should work once the code is compiled.