NumberController Step is working properly

See details about issue in
https://github.com/dataarts/dat.gui/issues/48#issuecomment-460026017
This commit is contained in:
Andrej 2019-02-03 13:06:35 +07:00
parent a1547d0f21
commit af02b71d6a
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ class NumberController extends Controller {
_v = this.__max; _v = this.__max;
} }
if (this.__step !== undefined && _v % this.__step !== 0) { if (this.__step !== undefined && this.__step !== 0 && _v % this.__step !== 0) {
_v = Math.round(_v / this.__step) * this.__step; _v = Math.round(_v / this.__step) * this.__step;
} }

View File

@ -108,7 +108,7 @@ class NumberControllerBox extends NumberController {
} }
updateDisplay() { updateDisplay() {
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision); this.__input.value = this.__truncationSuspended || this.__step === 0 ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
return super.updateDisplay(); return super.updateDisplay();
} }
} }