@@ -174,15 +174,38 @@ export const ThresholdSlider: React.FC<ThresholdSliderProps> = ({ config, orient
174174 const color = isEnabled ? "var(--color-plan-mode)" : "var(--color-muted)" ;
175175 const tooltipText = getTooltipText ( config . threshold , orientation ) ;
176176
177- // Container styles
177+ // Container styles - covers the full bar area for drag handling
178+ // Uses pointer-events: none by default, only the indicator handle has pointer-events: auto
179+ // This allows the token meter tooltip to work when hovering elsewhere on the bar
178180 const containerStyle : React . CSSProperties = {
179181 position : "absolute" ,
180- cursor : isHorizontal ? "ew-resize" : "ns-resize" ,
181182 top : 0 ,
182183 bottom : 0 ,
183184 left : 0 ,
184185 right : 0 ,
185186 zIndex : 50 ,
187+ pointerEvents : "none" , // Let events pass through to tooltip beneath
188+ } ;
189+
190+ // Drag handle around the indicator - this captures mouse events
191+ const DRAG_ZONE_SIZE = 16 ; // pixels on each side of the indicator
192+ const handleStyle : React . CSSProperties = {
193+ position : "absolute" ,
194+ cursor : isHorizontal ? "ew-resize" : "ns-resize" ,
195+ pointerEvents : "auto" , // Only this element captures events
196+ ...( isHorizontal
197+ ? {
198+ left : `calc(${ config . threshold } % - ${ DRAG_ZONE_SIZE } px)` ,
199+ width : DRAG_ZONE_SIZE * 2 ,
200+ top : 0 ,
201+ bottom : 0 ,
202+ }
203+ : {
204+ top : `calc(${ config . threshold } % - ${ DRAG_ZONE_SIZE } px)` ,
205+ height : DRAG_ZONE_SIZE * 2 ,
206+ left : 0 ,
207+ right : 0 ,
208+ } ) ,
186209 } ;
187210
188211 // Indicator positioning - use transform for centering on both axes
@@ -215,15 +238,17 @@ export const ThresholdSlider: React.FC<ThresholdSliderProps> = ({ config, orient
215238 const containerRect = containerRef . current ?. getBoundingClientRect ( ) ;
216239
217240 return (
218- < div
219- ref = { containerRef }
220- style = { containerStyle }
221- onMouseDown = { handleMouseDown }
222- onMouseEnter = { ( ) => setIsHovered ( true ) }
223- onMouseLeave = { ( ) => setIsHovered ( false ) }
224- // Horizontal uses native title (simpler, no clipping issues with wide tooltips)
225- title = { isHorizontal ? tooltipText : undefined }
226- >
241+ < div ref = { containerRef } style = { containerStyle } >
242+ { /* Drag handle - captures mouse events in a small zone around the indicator */ }
243+ < div
244+ style = { handleStyle }
245+ onMouseDown = { handleMouseDown }
246+ onMouseEnter = { ( ) => setIsHovered ( true ) }
247+ onMouseLeave = { ( ) => setIsHovered ( false ) }
248+ // Horizontal uses native title (simpler, no clipping issues with wide tooltips)
249+ title = { isHorizontal ? tooltipText : undefined }
250+ />
251+
227252 { /* Visual indicator - pointer events disabled */ }
228253 < div style = { indicatorStyle } >
229254 < Triangle direction = { isHorizontal ? "down" : "right" } color = { color } />
0 commit comments