AntoineW / luge

Luge
290 stars 10 forks source link

Missing Math.clamp #40

Closed hamburger123456 closed 1 year ago

hamburger123456 commented 1 year ago

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.

AntoineW commented 1 year ago

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.