on develop help sign in
fix bug in `drag` that causes dragging with different mouse button to trigger the event on click
commit3e0054e09773ae72dd3dd5b15d21f42261f54487 authorpdlla <chippermonky@gmail.com> dateTue 28 Apr 2020, 13:32 (7 years ago) parent74b505a
1 file changed+4−4
src/Reflex/Vty/Widget.hs+4−4
src/Reflex/Vty/Widget.hs+4−4
@@ -338,13 +338,13 @@ drag btn = do
338338 f Nothing = \case
339339 V.EvMouseDown x y btn' mods
340340 | btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods False
341− | otherwise -> Nothing
341+ | otherwise -> Nothing
342342 _ -> Nothing
343343 f (Just (Drag from _ _ mods end)) = \case
344344 V.EvMouseDown x y btn' mods'
345− | end -> Just $ Drag (x,y) (x,y) btn' mods' False
346− | btn == btn' -> Just $ Drag from (x,y) btn mods' False
347− | otherwise -> Nothing -- Ignore other buttons.
345+ | end && btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods' False
346+ | btn == btn' -> Just $ Drag from (x,y) btn mods' False
347+ | otherwise -> Nothing -- Ignore other buttons.
348348 V.EvMouseUp x y (Just btn')
349349 | end -> Nothing
350350 | btn == btn' -> Just $ Drag from (x,y) btn mods True