diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index b4fe272..ed98056 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -163,4 +163,12 @@ function Library (ronin) { this.mod = function (a, b) { return a % b } + + this.clamp = function (val, min, max) { + return Math.min(max, Math.max(min, val)) + } + + this.step = function (val, step) { + return Math.round(val / step) * step + } }