diff --git a/src/routes/resources/animtab/index.tsx b/src/routes/resources/animtab/index.tsx index 6bf6e52f..58078aaa 100644 --- a/src/routes/resources/animtab/index.tsx +++ b/src/routes/resources/animtab/index.tsx @@ -208,8 +208,8 @@ export default component$(() => { class={{ 'motion-safe:transition-all absolute top-full mt-2 gap-1 z-[1000]': true, 'opacity-0 scale-95 pointer-events-none': store.opened != i, - 'left-0': i + 1 < Math.round(store.colors.length / 2), - 'right-0': i + 1 >= Math.round(store.colors.length / 2), + 'left-0': i < store.colors.length / 2, + 'right-0': i >= store.colors.length / 2, }} onInput$={(newColor: string) => { const newColors = [...store.colors]; diff --git a/src/routes/resources/rgb/index.tsx b/src/routes/resources/rgb/index.tsx index 9ba6fb4d..eae8974d 100644 --- a/src/routes/resources/rgb/index.tsx +++ b/src/routes/resources/rgb/index.tsx @@ -5,7 +5,7 @@ import { Gradient } from '~/components/util/HexUtils'; import { defaults, loadPreset, presets, v3formats } from '~/components/util/PresetUtils'; import { convertToHex, convertToRGB, generateOutput, getBrightness, getRandomColor } from '~/components/util/RGBUtils'; -import { Add, ChevronDown, ChevronUp, ColorFillOutline, Remove, SettingsOutline, Text, TrashOutline } from 'qwik-ionicons'; +import { Add, Remove, SettingsOutline, Text, TrashOutline } from 'qwik-ionicons'; import { Button, ColorPicker, Header, Dropdown, TextArea, TextInput, Toggle } from '@luminescent/ui'; import { inlineTranslate, useSpeak } from 'qwik-speak'; @@ -69,7 +69,7 @@ export default component$(() => { }); return ( -
+

{t('gradient.title@@RGBirdflop')} @@ -119,32 +119,6 @@ export default component$(() => { })()}

-
-
- - - -
-
-
-
- {store.colors.map((color: string, i: number) =>
+
+ {store.colors.map((color: string, i: number) =>
{ + const abortController = new AbortController(); + const colormap = document.getElementById('colormap')!; + document.addEventListener('mousemove', (e) => { + const rect = colormap.getBoundingClientRect(); + const x = e.clientX - rect.left; + const width = rect.width; + const index = Math.round((store.colors.length - 1) * (x / width)); + if (index != i) { + handleSwap(i, index); + abortController.abort(); + } + }, { signal: abortController.signal }); + document.addEventListener('mouseup', () => { + abortController.abort(); + }, { signal: abortController.signal }); + }} style={{ + left: `${(100 / (store.colors.length - 1)) * i}%`, + }}> + }
, )}
@@ -200,120 +209,74 @@ export default component$(() => {
-
-