diff --git a/src/routes/resources/animtab/index.tsx b/src/routes/resources/animtab/index.tsx index 02b2cea5..48d00607 100644 --- a/src/routes/resources/animtab/index.tsx +++ b/src/routes/resources/animtab/index.tsx @@ -21,9 +21,15 @@ export const animTABDefaults = { }; export const useCookies = routeLoader$(async ({ cookie, url }) => { + const animtabCookies = await getCookies(cookie, 'animtab', url.searchParams) as Partial; + const rgbCookies = await getCookies(cookie, 'rgb', url.searchParams) as Partial; + if (!rgbCookies.customFormat) { + delete rgbCookies.format; + delete animtabCookies.outputFormat; + } return { - animtab: await getCookies(cookie, 'animtab', url.searchParams) as typeof animTABDefaults, - rgb: await getCookies(cookie, 'rgb', url.searchParams) as typeof rgbDefaults, + animtab: animtabCookies, + rgb: rgbCookies, }; }); @@ -140,7 +146,7 @@ export default component$(() => {
-
`${color.hex} ${color.pos}%`).join(', ')});`} onMouseDown$={(e, el) => { if (e.target != el) return; @@ -150,7 +156,7 @@ export default component$(() => { if (store.colors.find(c => c.pos == pos)) return; const newColors = [...store.colors]; newColors.push({ hex: getRandomColor(), pos }); - store.colors = sortColors(newColors); + store.colors = newColors; }} onMouseEnter$={(e, el) => { const abortController = new AbortController(); @@ -174,16 +180,18 @@ export default component$(() => { }} >
- {store.colors.map((color, i) =>
{ + {store.colors.map((color, i) =>
{ const abortController = new AbortController(); const colormap = document.getElementById('colormap')!; const rect = colormap.getBoundingClientRect(); document.addEventListener('mousemove', e => { + el.classList.add('-mt-2', 'scale-125', 'z-[1000]'); + el.style.filter = 'drop-shadow(0 0 10px rgb(31 41 55))'; const length = store.text.length * animtabstore.length; let pos = Math.round((((e.clientX - rect.left) / rect.width) * length)) / length * 100; if (pos < 0) pos = 0; @@ -194,6 +202,8 @@ export default component$(() => { store.colors = newColors; }, { signal: abortController.signal }); document.addEventListener('mouseup', () => { + el.classList.remove('-mt-2', 'scale-125', 'z-[1000]'); + el.style.filter = ''; abortController.abort(); }, { signal: abortController.signal }); }} style={{ @@ -202,12 +212,14 @@ export default component$(() => { >