Toggle _asMovingNode when clicked

This commit is contained in:
Daniel Garcia 2020-08-09 17:03:20 -05:00 committed by Robbie Gleichman
parent 6d22e87061
commit 6fe9c112d4

View File

@ -264,13 +264,15 @@ startApp app = do
(do (do
putStrLn "Left click" putStrLn "Left click"
mousePosition <- getXandY eventButton mousePosition <- getXandY eventButton
-- print (x, y)
modifyIORef' stateRef modifyIORef' stateRef
(\s@AppState{_asMovingNode, _asElements} (\s@AppState{_asMovingNode, _asElements}
-> ->
let let
newMovingNode = findElementByPosition _asElements mousePosition -- toggle _asMovingNode when clicked
newMovingNode = case _asMovingNode of
Nothing -> findElementByPosition _asElements mousePosition
Just _ -> Nothing
in in
s{_asMovingNode=newMovingNode} s{_asMovingNode=newMovingNode}
) )