diff --git a/javascript/aspectRatioController.js b/javascript/aspectRatioController.js index af8bcc8..3db6fcb 100644 --- a/javascript/aspectRatioController.js +++ b/javascript/aspectRatioController.js @@ -43,9 +43,15 @@ class ContainerController { } setVal(text) { - this.updateVal(text); + this.updateVal( + ContainerController.roundToClosestMultipleOf8(text) + ); this.eventHandler(); } + + static roundToClosestMultipleOf8(num) { + return Math.round(Number(num) / 8) * 8; + } } function _reverseAspectRatio(ar) { @@ -76,7 +82,6 @@ class AspectRatioController { }; Object.values(this.dimensions).forEach(dimension => { - dimension.step = 1; dimension.addEventListener('change', (e) => { e.preventDefault() this._syncValues(dimension); @@ -227,10 +232,10 @@ class AspectRatioController {