Skip to content

Commit 0437bd4

Browse files
committed
🤖 fix: separate slider hit area from visual positioning
1 parent fe574e3 commit 0437bd4

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

src/browser/components/RightSidebar/ThresholdSlider.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,34 +100,44 @@ export const HorizontalThresholdSlider: React.FC<HorizontalThresholdSliderProps>
100100
? "Release to disable auto-compact"
101101
: `Auto-compact at ${dragValue}%`
102102
: config.enabled
103-
? `Auto-compact at ${config.threshold}% · Drag to adjust`
104-
: "Auto-compact disabled · Drag left to enable";
103+
? `Auto-compact at ${config.threshold}% · Drag to adjust`
104+
: "Auto-compact disabled · Drag left to enable";
105105

106-
const lineColor = config.enabled ? "var(--color-plan-mode)" : "var(--color-muted)";
106+
const lineColor = config.enabled
107+
? "var(--color-plan-mode)"
108+
: "var(--color-muted)";
107109
const opacity = isDragging ? 1 : 0.8;
108110

109111
return (
110112
<div
111113
ref={containerRef}
112-
className="absolute z-10 cursor-ew-resize"
113-
style={{
114-
// Extend hit area beyond the thin bar for easier clicking
115-
left: 0,
116-
right: 0,
117-
top: -8,
118-
bottom: -8,
119-
}}
120-
onMouseDown={handleMouseDown}
121-
title={title}
114+
className="absolute inset-0 z-10"
115+
style={{ pointerEvents: "none" }} // pass clicks through the empty parts of the container if needed, but we want the hit area to catch them
122116
>
123-
{/* Vertical line with triangle handles */}
117+
{/* Hit Area - Wider than the bar for easier grabbing */}
118+
<div
119+
className="absolute cursor-ew-resize"
120+
style={{
121+
top: -12, // Extend 12px up
122+
bottom: -12, // Extend 12px down
123+
left: 0,
124+
right: 0,
125+
pointerEvents: "auto", // Re-enable pointer events for the hit area
126+
zIndex: 20,
127+
}}
128+
onMouseDown={handleMouseDown}
129+
title={title}
130+
/>
131+
132+
{/* Visual Indicator - Strictly positioned relative to the bar (containerRef) */}
124133
<div
125134
className="pointer-events-none absolute flex flex-col items-center"
126135
style={{
127136
left: `${position}%`,
128-
top: -4,
129-
bottom: -4,
137+
top: -4, // Visual overshoot top
138+
bottom: -4, // Visual overshoot bottom
130139
transform: "translateX(-50%)",
140+
zIndex: 10,
131141
}}
132142
>
133143
{/* Top triangle (pointing down) */}

0 commit comments

Comments
 (0)