fix: update rack width controls and images

This commit is contained in:
2026-08-12 15:57:22 +02:00
parent c663069825
commit 4ee78ae4fe
6 changed files with 56 additions and 5 deletions
@@ -103,11 +103,18 @@
const position = Number.parseInt(option.value || '1', 10);
option.disabled = position > width;
});
if (width === 1 || Number.parseInt(positionField.value || '1', 10) > width) {
const resetPosition = width === 1 || Number.parseInt(positionField.value || '1', 10) > width;
if (resetPosition) {
positionField.value = '1';
}
positionField.disabled = width === 1;
if (positionField.tomselect) positionField.tomselect.sync();
if (resetPosition) {
positionField.dispatchEvent(new Event('change', {bubbles: true}));
}
positionField.disabled = width === 1;
};
widthField.addEventListener('change', updatePositions);