From 8bbddc7bbe43e55a58e39a3e415a60009bd595b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Trz=C4=99siok?= Date: Sat, 2 Jun 2018 23:47:12 +0200 Subject: [PATCH] #179 : Cannot update NumberControllerBox with .listen() fix (cherry picked from commit fa20388) --- src/dat/controllers/NumberControllerBox.js | 4 ++++ src/dat/controllers/NumberControllerSlider.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/dat/controllers/NumberControllerBox.js b/src/dat/controllers/NumberControllerBox.js index 462ebf2..940c20e 100644 --- a/src/dat/controllers/NumberControllerBox.js +++ b/src/dat/controllers/NumberControllerBox.js @@ -108,6 +108,10 @@ class NumberControllerBox extends NumberController { } updateDisplay() { + if(this.__input === document.activeElement) { + return; + } + this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision); return super.updateDisplay(); } diff --git a/src/dat/controllers/NumberControllerSlider.js b/src/dat/controllers/NumberControllerSlider.js index f75bc0e..67b3cf1 100644 --- a/src/dat/controllers/NumberControllerSlider.js +++ b/src/dat/controllers/NumberControllerSlider.js @@ -109,6 +109,9 @@ class NumberControllerSlider extends NumberController { } updateDisplay() { + if(this.__input === document.activeElement) { + return; + } const pct = (this.getValue() - this.__min) / (this.__max - this.__min); this.__foreground.style.width = pct * 100 + '%'; return super.updateDisplay();