on develop help sign in
fix bug in `drag` that causes dragging with different mouse button to trigger the event on click
3e0054epdlla
src/Reflex/Vty/Widget.hs+4−4
@@ -338,13 +338,13 @@ drag btn = do
338 f Nothing = \case
338 f Nothing = \case
339 V.EvMouseDown x y btn' mods
339 V.EvMouseDown x y btn' mods
340 | btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods False
340 | btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods False
341− | otherwise -> Nothing
341+ | otherwise -> Nothing
342 _ -> Nothing
342 _ -> Nothing
343 f (Just (Drag from _ _ mods end)) = \case
343 f (Just (Drag from _ _ mods end)) = \case
344 V.EvMouseDown x y btn' mods'
344 V.EvMouseDown x y btn' mods'
345− | end -> Just $ Drag (x,y) (x,y) btn' mods' False
345+ | end && btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods' False
346− | btn == btn' -> Just $ Drag from (x,y) btn mods' False
346+ | btn == btn' -> Just $ Drag from (x,y) btn mods' False
347− | otherwise -> Nothing -- Ignore other buttons.
347+ | otherwise -> Nothing -- Ignore other buttons.
348 V.EvMouseUp x y (Just btn')
348 V.EvMouseUp x y (Just btn')
349 | end -> Nothing
349 | end -> Nothing
350 | btn == btn' -> Just $ Drag from (x,y) btn mods True
350 | btn == btn' -> Just $ Drag from (x,y) btn mods True