Skip to content

Commit

Permalink
fix mousedown propagation on color picker
Browse files Browse the repository at this point in the history
  • Loading branch information
saboooor committed Jun 12, 2024
1 parent 2a58077 commit c8c0ef9
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions src/routes/resources/rgb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,39 +165,41 @@ export default component$(() => {
store.opened = i;
}}
/>
<ColorPicker
id={`color${i + 1}`}
value={color}
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 < store.colors.length / 2,
'right-0': i >= store.colors.length / 2,
}}
onInput$={(newColor: string) => {
const newColors = [...store.colors];
newColors[i] = newColor;
store.colors = newColors;
}}
horizontal
/>
{store.colors.length > 2 &&
<Button
<div onMouseDown$={(e) => e.stopPropagation()}>
<ColorPicker
id={`color${i + 1}`}
value={color}
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 < store.colors.length / 2,
'right-0': i >= store.colors.length / 2,
}}
square size='sm' color="red" onClick$={() => {
onInput$={(newColor: string) => {
const newColors = [...store.colors];
newColors.splice(i, 1);
newColors[i] = newColor;
store.colors = newColors;
}
}>
<TrashOutline width="20" />
</Button>
}
}}
horizontal
/>
{store.colors.length > 2 &&
<Button
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 < store.colors.length / 2,
'right-0': i >= store.colors.length / 2,
}}
square size='sm' color="red" onClick$={() => {
const newColors = [...store.colors];
newColors.splice(i, 1);
store.colors = newColors;
}
}>
<TrashOutline width="20" />
</Button>
}
</div>
</div>,
)}
</div>
Expand Down

0 comments on commit c8c0ef9

Please sign in to comment.