on develop help sign in
Merge pull request #21 from pdlla/pdlla_dragfix

fix bug in `drag` that causes dragging with different mouse button to trigger the event on click

commitcb6c9543597b6abbc8842a077f25ef6e0e94664c authorElliot Cameron <3noch@users.noreply.github.com> dateTue 5 May 2020, 11:56 (6 years ago) parent2b319d151e1441
1 file changed+4−4
src/Reflex/Vty/Widget.hs+4−4
src/Reflex/Vty/Widget.hs+4−4
@@ -339,13 +339,13 @@ drag btn = do
339339 f Nothing = \case
340340 V.EvMouseDown x y btn' mods
341341 | btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods False
342− | otherwise -> Nothing
342+ | otherwise -> Nothing
343343 _ -> Nothing
344344 f (Just (Drag from _ _ mods end)) = \case
345345 V.EvMouseDown x y btn' mods'
346− | end -> Just $ Drag (x,y) (x,y) btn' mods' False
347− | btn == btn' -> Just $ Drag from (x,y) btn mods' False
348− | otherwise -> Nothing -- Ignore other buttons.
346+ | end && btn == btn' -> Just $ Drag (x,y) (x,y) btn' mods' False
347+ | btn == btn' -> Just $ Drag from (x,y) btn mods' False
348+ | otherwise -> Nothing -- Ignore other buttons.
349349 V.EvMouseUp x y (Just btn')
350350 | end -> Nothing
351351 | btn == btn' -> Just $ Drag from (x,y) btn mods True