fix(ui): stop the mixed switch knob overshooting its track

The switch knob now slides by transform, but the mixed state still
centred it with justify-content. Going from on to mixed moved the knob
to the centre at once while its 14px transform eased back to zero, so
for a few frames it stuck out past the track's right edge. A folder
switch in the skill tree hits this when one child is turned off.

Mixed now centres the knob by transform too, so every change between
off, on and mixed is a single slide that stays inside the track.
This commit is contained in:
Willie
2026-11-10 00:04:56 +08:00
parent 16799be11d
commit 23bbefdb75
+6 -2
View File
@@ -167,7 +167,7 @@ svg.lucide { flex: none; stroke-width: var(--isw); }
.ss-sw.sm i { width: 12px; height: 12px; }
.ss-sw.on i { background: var(--surface); }
/* Some of the items it covers are on: half-tone track, centered knob with a dash. */
.ss-sw.mix { justify-content: center; background: var(--ink-3); }
.ss-sw.mix { background: var(--ink-3); }
.ss-sw.mix i { display: grid; place-items: center; }
.ss-sw.mix i::after { content: ''; width: 8px; height: 2px; border-radius: 1px; background: var(--ink-3); }
:root[data-theme="playful"] .ss-sw { width: 38px; height: 22px; background: var(--surface); border: 2px solid var(--line); padding: 2px; }
@@ -707,11 +707,15 @@ button:disabled { cursor: not-allowed; }
:root:not([data-theme="playful"]) .ss-counts>a:last-child { border-radius: 0 12px 12px 0; }
:root[data-theme="playful"] .ss-counts>a:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--line); }
.ss-sw { transition: background-color .15s; }
/* The knob slides rather than jumps: each distance is the track's inner width minus the knob's. */
/* The knob slides rather than jumps: on moves it the track's inner width minus the knob's, mixed half
that. Mixed centers by transform too, so a change between any two states is one slide. */
.ss-sw i { transition: transform .15s cubic-bezier(.3,.7,.3,1), background-color .15s; }
.ss-sw.on i { transform: translateX(14px); }
.ss-sw.sm.on i { transform: translateX(12px); }
:root[data-theme="playful"] .ss-sw.on i { transform: translateX(16px); }
.ss-sw.mix i { transform: translateX(7px); }
.ss-sw.sm.mix i { transform: translateX(6px); }
:root[data-theme="playful"] .ss-sw.mix i { transform: translateX(8px); }
.ss-sw:disabled { opacity: .42; }
.ss-chk-input:focus-visible + .ss-chk { outline: 2px solid var(--accent); outline-offset: 2px; }
.ss-more { font-size: 13px; font-weight: 500; color: var(--accent); }