#179 : Cannot update NumberControllerBox with .listen() fix

(cherry picked from commit fa20388)
This commit is contained in:
Artur Trzęsiok 2018-06-02 23:47:12 +02:00
parent 4dd9c866b7
commit 8bbddc7bbe
2 changed files with 7 additions and 0 deletions

View File

@ -108,6 +108,10 @@ class NumberControllerBox extends NumberController {
} }
updateDisplay() { updateDisplay() {
if(this.__input === document.activeElement) {
return;
}
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision); this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
return super.updateDisplay(); return super.updateDisplay();
} }

View File

@ -109,6 +109,9 @@ class NumberControllerSlider extends NumberController {
} }
updateDisplay() { updateDisplay() {
if(this.__input === document.activeElement) {
return;
}
const pct = (this.getValue() - this.__min) / (this.__max - this.__min); const pct = (this.getValue() - this.__min) / (this.__max - this.__min);
this.__foreground.style.width = pct * 100 + '%'; this.__foreground.style.width = pct * 100 + '%';
return super.updateDisplay(); return super.updateDisplay();