summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-10-18 08:46:53 +0300
committerMaxim Devaev <[email protected]>2021-10-18 08:46:53 +0300
commite2873032eedb341a9a21686ad216ee87bf114f4d (patch)
tree4e887affa7f20f276f4f756d3ec0a48f117ebf53 /web/share/js/tools.js
parentb4ca93dac1585b63e316287d66cecfbc8e00590c (diff)
slider setValue/getValue
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index e0b350d5..26685cb4 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -162,6 +162,21 @@ export var tools = new function() {
el.step = step;
el.value = value;
},
+ "setValue": function(el, value, callback=null) {
+ if (el.value != value) {
+ el.value = value;
+ if (callback) {
+ callback(value);
+ }
+ }
+ },
+ "getValue": function(el) {
+ if (el.step % 1 === 0) {
+ return parseInt(el.value);
+ } else {
+ return parseFloat(el.value);
+ }
+ },
};
};