Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Improve slider interactivity

ameer246826fd9a6e0584
diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx
index f27a48559..6df84a69b 100644
--- a/apps/desktop/src/routes/editor/ui.tsx
+++ b/apps/desktop/src/routes/editor/ui.tsx
@@ -90,7 +90,7 @@ export function Slider(
<KSlider
{...props}
class={cx(
- "relative px-1 h-4 flex flex-row justify-stretch items-center",
+ "relative px-1 h-8 flex flex-row justify-stretch items-center",
props.class
)}
onChange={(v) => {
@@ -104,25 +104,18 @@ export function Slider(
}}
>
<KSlider.Track
- class="h-[0.3rem] transition-[height] relative mx-1 bg-gray-200 rounded-full w-full"
+ class="h-[0.3rem] cursor-pointer transition-[height] relative mx-1 bg-gray-200 rounded-full w-full before:content-[''] before:absolute before:inset-0 before:-top-3 before:-bottom-3"
onPointerDown={() => {
setDragging(true);
- console.log("set dragging true");
createRoot((dispose) => {
createEventListener(window, "mouseup", () => {
setDragging(false);
- console.log("set dragging false");
dispose();
});
});
}}
>
- <KSlider.Fill
- onPointerDown={() => {
- console.log("MOUSE DOWN FILL");
- }}
- class="absolute -ml-2 h-full bg-blue-300 rounded-full ui-disabled:bg-gray-300"
- />
+ <KSlider.Fill class="absolute -ml-2 h-full bg-blue-300 rounded-full ui-disabled:bg-gray-300" />
<Tooltip
open={dragging() ? true : undefined}
getAnchorRect={() => {
@@ -147,14 +140,12 @@ export function Slider(
ref={setThumbRef}
onPointerDown={() => {
setDragging(true);
- console.log("set dragging true");
}}
onPointerUp={() => {
setDragging(false);
- console.log("set dragging false");
}}
class={cx(
- "bg-solid-white shadow-xl border border-gray-300 rounded-full outline-none size-4 -top-[6.3px] ui-disabled:bg-gray-400"
+ "bg-solid-white shadow-xl border border-gray-300 rounded-full outline-none size-4 -top-[6.3px] ui-disabled:bg-gray-400 after:content-[''] after:absolute after:inset-0 after:-m-3 after:cursor-pointer"
)}
/>
</Tooltip>