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
putStrLn "Left click"
mousePosition <- getXandY eventButton
-- print (x, y)
modifyIORef' stateRef
(\s@AppState{_asMovingNode, _asElements}
->
let
newMovingNode = findElementByPosition _asElements mousePosition
-- toggle _asMovingNode when clicked
newMovingNode = case _asMovingNode of
Nothing -> findElementByPosition _asElements mousePosition
Just _ -> Nothing
in
s{_asMovingNode=newMovingNode}
)