elm/core/Mouse.elm
evancz d53cecf3ba List module dependencies in elm and js code.
Planning on having the compiler crawl through to determine dependencies, then compile everything in an appropriate order. This will also let me print out compiler progress in a reasonable order.
2013-02-23 00:19:40 +01:00

39 lines
No EOL
1 KiB
Elm

module Mouse where
import Native.Mouse
-- The current mouse position.
position : Signal (Int,Int)
position = Native.Mouse.position
-- The current x-coordinate of the mouse.
x : Signal Int
x = Native.Mouse.x
-- The current y-coordinate of the mouse.
y : Signal Int
y = Native.Mouse.y
-- The current state of the left mouse-button.
-- True when the button is down, and false otherwise.
isDown : Signal Bool
isDown = Native.Mouse.isDown
-- True immediately after the left mouse-button has been clicked,
-- and false otherwise.
isClicked : Signal Bool
isClicked = Native.Mouse.isClicked
-- Always equal to unit. Event triggers on every mouse click.
clicks : Signal ()
clicks = Native.Mouse.clicks
-- Determine whether an element has been clicked. The resulting pair
-- is a signal of booleans that is true when its paired element has
-- been clicked. The signal is True immediately after the left
-- mouse-button has been clicked, and false otherwise.
isClickedOn : Element -> (Element, Signal Bool)
isClickedOn = Native.Mouse.isClickedOn