improve range control number input action

This commit is contained in:
zombieFox 2021-08-18 19:48:56 +01:00
parent d5edc010e2
commit 15665b2494
3 changed files with 12 additions and 12 deletions

View File

@ -101,13 +101,13 @@ export const Control_color = function({
}
});
this.delayedUpdate = null;
this.update = ({
delay = false,
all = false
} = {}) => {
let delayedUpdate = null;
const updateControl = () => {
this.color.value = convertColor.rgb.hex(get({
@ -125,8 +125,8 @@ export const Control_color = function({
};
if (delay) {
clearTimeout(delayedUpdate);
delayedUpdate = setTimeout(updateControl, 2000);
clearTimeout(this.delayedUpdate);
this.delayedUpdate = setTimeout(updateControl, 2000);
} else {
updateControl();
};

View File

@ -194,20 +194,20 @@ export const Control_sliderDouble = function({
};
this.delayedUpdate = null;
this.update = ({
delay = false
} = {}) => {
let delayedUpdate = null;
const updateControl = () => {
this.range.left.update();
this.range.right.update();
};
if (delay) {
clearTimeout(delayedUpdate);
delayedUpdate = setTimeout(updateControl, 2000);
clearTimeout(this.delayedUpdate);
this.delayedUpdate = setTimeout(updateControl, 2000);
} else {
updateControl();
};

View File

@ -128,20 +128,20 @@ export const Control_sliderSlim = function({
}
});
this.delayedUpdate = null;
this.update = ({
delay = false
} = {}) => {
let delayedUpdate = null;
const updateControl = () => {
this.range.value = get({ object: object, path: path });
this.number.value = get({ object: object, path: path });
};
if (delay) {
clearTimeout(delayedUpdate);
delayedUpdate = setTimeout(updateControl, 2000);
clearTimeout(this.delayedUpdate);
this.delayedUpdate = setTimeout(updateControl, 2000);
} else {
updateControl();
};