Round to multiples of 8 always (#37)

It was set at 8 for a reason, I was a bit dumb to change this in the first place...
pull/41/head
thomas 2023-03-31 20:16:41 +01:00 committed by GitHub
parent 36c450111f
commit 6c8a27fde5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -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 {
<div id="${page}_ratio" class="gr-block gr-box relative w-full border-solid border border-gray-200 gr-padded">
<select id="${page}_select_aspect_ratio" class="gr-box gr-input w-full disabled:cursor-not-allowed">
${
[...new Set(allOptions)].map(r => {
return '<option class="ar-option">' + r + '</option>'
}).join('\n')
}
[...new Set(allOptions)].map(r => {
return '<option class="ar-option">' + r + '</option>'
}).join('\n')
}
</select>
</div>
`;