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

This commit is contained in:
Artur Trzęsiok 2018-06-02 23:47:12 +02:00
parent fe5bb21f59
commit fa20388df9
7 changed files with 22 additions and 3 deletions

View File

@ -1175,6 +1175,9 @@ var NumberControllerBox = function (_NumberController) {
createClass(NumberControllerBox, [{ createClass(NumberControllerBox, [{
key: 'updateDisplay', key: 'updateDisplay',
value: function updateDisplay() { value: function 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 get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this); return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this);
} }
@ -1244,6 +1247,9 @@ var NumberControllerSlider = function (_NumberController) {
createClass(NumberControllerSlider, [{ createClass(NumberControllerSlider, [{
key: 'updateDisplay', key: 'updateDisplay',
value: function updateDisplay() { value: function updateDisplay() {
if (this.__input === document.activeElement) {
return;
}
var pct = (this.getValue() - this.__min) / (this.__max - this.__min); var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
this.__foreground.style.width = pct * 100 + '%'; this.__foreground.style.width = pct * 100 + '%';
return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this); return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1169,6 +1169,9 @@ var NumberControllerBox = function (_NumberController) {
createClass(NumberControllerBox, [{ createClass(NumberControllerBox, [{
key: 'updateDisplay', key: 'updateDisplay',
value: function updateDisplay() { value: function 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 get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this); return get(NumberControllerBox.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox.prototype), 'updateDisplay', this).call(this);
} }
@ -1238,6 +1241,9 @@ var NumberControllerSlider = function (_NumberController) {
createClass(NumberControllerSlider, [{ createClass(NumberControllerSlider, [{
key: 'updateDisplay', key: 'updateDisplay',
value: function updateDisplay() { value: function updateDisplay() {
if (this.__input === document.activeElement) {
return;
}
var pct = (this.getValue() - this.__min) / (this.__max - this.__min); var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
this.__foreground.style.width = pct * 100 + '%'; this.__foreground.style.width = pct * 100 + '%';
return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this); return get(NumberControllerSlider.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider.prototype), 'updateDisplay', this).call(this);

File diff suppressed because one or more lines are too long

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();