move ball on click without drag

This commit is contained in:
nek0 2019-09-30 03:38:20 +02:00
parent c060a7f740
commit 6a4f1abe8c
1 changed files with 4 additions and 8 deletions

View File

@ -217,7 +217,7 @@ networkDescription (listenerah, _) rotvar transvar = mdo
emouse <- fromAddHandler =<< registerMouseEvent passfire mouseah
epass <- fromAddHandler =<< registerPassEvent passah
eClickHold <- fromAddHandler =<< registerClickHoldEvent passfire clickholdah
clickHoldBehaviour <- RBC.stepper True eClickHold
clickHoldBehaviour <- RBC.stepper False eClickHold
mouseMoveBehaviour <- RBC.stepper (V2 1 1) epass
let moveReaction = fmap (\x -> do
let input = (\(V2 xx _) ->
@ -270,7 +270,6 @@ registerListenerEvent listenerah mousefire clickholdfire = do
if null filteredClickEvents
then
return ()
-- clickholdfire False
else
clickholdfire
(any (\x -> SDL.Pressed == SDL.mouseButtonEventMotion
@ -309,10 +308,7 @@ registerClickHoldEvent
-> AddHandler Bool
-> m (AddHandler Bool)
registerClickHoldEvent passfire clickholdah = do
void $ liftIO $ register clickholdah $ \x -> if x
then do
SDL.P vect <- SDL.getAbsoluteMouseLocation
passfire $ fmap fromIntegral vect
else
return ()
void $ liftIO $ register clickholdah $ \_ -> do
SDL.P vect <- SDL.getAbsoluteMouseLocation
passfire $ fmap fromIntegral vect
return clickholdah