Move the _asMovingNode to the mouse position.

This commit is contained in:
Robbie Gleichman 2020-08-09 14:33:04 -07:00
parent fbbbd52143
commit cbf4f36ee5

View File

@ -142,10 +142,16 @@ findElementByPosition elements (mouseX, mouseY) =
-- position. Consider moving inputs like mouse position into a
-- separate input struct.
updateState :: AppState -> AppState
updateState oldState@AppState{..} =
updateState oldState@AppState{_asMouseXandY, _asElements, _asMovingNode} =
let
-- TODO Finish
newState = oldState
-- Move the asMovingNode to MouseXandY
newElements = case _asMovingNode of
Nothing -> _asElements
Just nodeId -> IntMap.adjust
(\oldNode@Element{_elPosition} -> oldNode{_elPosition=_asMouseXandY})
nodeId
_asElements
newState = oldState{_asElements=newElements}
in
newState