diff --git a/src-theme/src/routes/clickgui/setting/MultiChooseSetting.svelte b/src-theme/src/routes/clickgui/setting/MultiChooseSetting.svelte index 5f13248fea9..768107dc59d 100644 --- a/src-theme/src/routes/clickgui/setting/MultiChooseSetting.svelte +++ b/src-theme/src/routes/clickgui/setting/MultiChooseSetting.svelte @@ -1,10 +1,12 @@ @@ -60,16 +100,41 @@ {#if expanded}
- {#each cSetting.choices as choice (choice)} + {#each choices as choice, i (choice)} + {@const enabledIndex = getEnabledIndex(choice)} + {@const showLeftArrow = cSetting.isOrderSensitive && enabledIndex > 0 && hoveringChoice === i} + {@const showRightArrow = cSetting.isOrderSensitive && enabledIndex >= 0 && enabledIndex < cSetting.value.length - 1 && hoveringChoice === i}
{ - handleChange(choice) - }} + class:order-sensitive={cSetting.isOrderSensitive} + animate:flip={{duration: 200}} + on:mouseenter={() => hoveringChoice = i} + on:mouseleave={() => hoveringChoice = -1} > - {$spaceSeperatedNames ? convertToSpacedString(choice) : choice} + + moveEnabledChoice(enabledIndex, -1)} + > + ◀ + + + + handleChange(choice)}> + {$spaceSeperatedNames ? convertToSpacedString(choice) : choice} + + + + moveEnabledChoice(enabledIndex, 1)} + > + ▶ +
{/each}
@@ -97,8 +162,12 @@ padding: 3px 6px; cursor: pointer; font-weight: 500; - transition: ease color 0.2s; + transition: ease color 0.2s, ease background-color 0.2s; overflow-wrap: anywhere; + position: relative; + display: inline-flex; + align-items: center; + gap: 3px; &:hover { color: $clickgui-text-color; @@ -111,7 +180,43 @@ &.active { background-color: rgba($accent-color, 0.1); - color: $accent-color; + .choice-name { + color: $accent-color; + } + } + + &:not(.order-sensitive) { + gap: 0; + + .choice-action { + display: none; + } + } + + .choice-action { + color: $clickgui-text-dimmed-color; + font-size: 10px; + cursor: pointer; + padding: 1px 2px; + border-radius: 2px; + transition: ease color 0.2s, ease background-color 0.2s, ease width 0.2s, ease opacity 0.2s; + display: inline-flex; + align-items: center; + justify-content: center; + width: 0; + height: 14px; + opacity: 0; + overflow: hidden; + + &.visible { + width: 14px; + opacity: 1; + } + + &:hover { + color: $accent-color; + background-color: rgba($accent-color, 0.1); + } } }