Implement generalised storing of position for mouse presses
This commit is contained in:
@@ -63,9 +63,11 @@ handleMouseWheelEvent mwev =
|
||||
V2 _ y = mouseWheelEventPos mwev
|
||||
|
||||
handleMouseButtonEvent :: MouseButtonEventData -> Input -> Input
|
||||
handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of
|
||||
Released -> mouseButtons . at thebutton .~ Nothing
|
||||
Pressed -> mouseButtons . at thebutton ?~ 1 -- note that mouse button events are NOT repeating
|
||||
handleMouseButtonEvent mbev theinput = case mouseButtonEventMotion mbev of
|
||||
Released -> theinput & mouseButtons . at thebutton .~ Nothing
|
||||
Pressed -> theinput
|
||||
& mouseButtons . at thebutton ?~ 1
|
||||
& clickPos . at thebutton ?~ (theinput ^. mousePos)
|
||||
-- note that mouse button down events are NOT repeating
|
||||
where
|
||||
-- pointtothebutton = mouseButtons . at thebutton
|
||||
thebutton = mouseButtonEventButton mbev
|
||||
|
||||
Reference in New Issue
Block a user