From 92657c629c05038a47f3fda327cb7ea26afa4462 Mon Sep 17 00:00:00 2001 From: Quentin Leonetti Date: Sat, 13 Jul 2019 21:42:48 +0200 Subject: [PATCH] Add step function --- desktop/sources/scripts/library.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 060e0ff..7d35cfe 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -112,4 +112,8 @@ function Library (ronin) { 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 + } }