Streamline calibration modal: inline controls, dynamic aspect ratio, offset fix
Some checks failed
Validate / validate (push) Failing after 8s

- Move total LEDs counter, direction toggle, and offset input into the
  screen area of the calibration preview
- Remove description paragraph, standalone offset form, and total LEDs banner
- Add mismatch warning (yellow + ⚠) when configured LEDs ≠ device count
- Use actual display aspect ratio for calibration preview
- Fix offset not updating tick labels (buildSegments now starts at offset)
- Remove max-width constraint on preview, add padding for breathing room
- Clean up unused i18n keys from both locale files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 04:43:56 +03:00
parent cf770440c0
commit c34f10f7de
5 changed files with 95 additions and 44 deletions

View File

@@ -83,19 +83,21 @@
</div>
<div class="modal-body">
<input type="hidden" id="calibration-device-id">
<p style="margin-bottom: 12px; color: var(--text-secondary);" data-i18n="calibration.description">
Configure how your LED strip is mapped to screen edges. Click an edge to toggle test mode.
</p>
<!-- Interactive Preview with integrated LED inputs and test toggles -->
<div style="margin-bottom: 12px;">
<div style="margin-bottom: 12px; padding: 0 24px;">
<div class="calibration-preview">
<!-- Screen with direction toggle -->
<!-- Screen with direction toggle, total LEDs, and offset -->
<div class="preview-screen">
<span data-i18n="calibration.preview.screen">Screen</span>
<button type="button" class="direction-toggle" onclick="toggleDirection()" title="Toggle direction">
<span id="direction-icon"></span> <span id="direction-label">CW</span>
</button>
<div class="preview-screen-total"><span id="cal-total-leds-inline">0</span> / <span id="cal-device-led-count-inline">0</span></div>
<div class="preview-screen-controls">
<button type="button" class="direction-toggle" onclick="toggleDirection()" title="Toggle direction">
<span id="direction-icon"></span> <span id="direction-label">CW</span>
</button>
<label class="offset-control" title="LED offset from LED 0 to start corner">
<span></span>
<input type="number" id="cal-offset" min="0" value="0" oninput="updateCalibrationPreview()">
</label>
</div>
</div>
<!-- Clickable edge bars with LED count inputs -->
@@ -142,15 +144,6 @@
</select>
</div>
<div class="form-group" style="margin-bottom: 12px;">
<label for="cal-offset" data-i18n="calibration.offset">LED Offset:</label>
<input type="number" id="cal-offset" min="0" value="0" oninput="updateCalibrationPreview()">
<small style="color: #aaa; display: block; margin-top: 4px;" data-i18n="calibration.offset_hint">LEDs from LED 0 to start corner (along strip)</small>
</div>
<div style="padding: 8px 10px; background: rgba(255, 193, 7, 0.1); border-left: 4px solid #FFC107; border-radius: 4px; margin-bottom: 12px;">
<strong data-i18n="calibration.total">Total LEDs:</strong> <span id="cal-total-leds">0</span> / <span id="cal-device-led-count">0</span>
</div>
<div id="calibration-error" class="error-message" style="display: none;"></div>
</div>