Get rid of isClicked

It can be argued that everything should be derived from isDown and
position (the two real facts about the mouse), so maybe that is a
direction to go from here.
This commit is contained in:
Evan Czaplicki 2014-01-27 12:29:52 +01:00
parent 50c2618d3a
commit 007ea7126f
2 changed files with 3 additions and 12 deletions

View file

@ -7,7 +7,7 @@ module Mouse where
@docs position, x, y
# Button Status
@docs isDown, clicks, isClicked
@docs isDown, clicks
-}
@ -31,11 +31,6 @@ 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

View file

@ -20,15 +20,12 @@ Elm.Native.Mouse.make = function(elm) {
y.defaultNumberOfKids = 0;
var isDown = Signal.constant(false);
var isClicked = Signal.constant(false);
var clicks = Signal.constant(Utils.Tuple0);
var node = elm.display === ElmRuntime.Display.FULLSCREEN ? document : elm.node;
elm.addListener([isClicked.id, clicks.id], node, 'click', function click() {
elm.notify(isClicked.id, true);
elm.addListener([clicks.id], node, 'click', function click() {
elm.notify(clicks.id, Utils.Tuple0);
elm.notify(isClicked.id, false);
});
elm.addListener([isDown.id], node, 'mousedown', function down() {
elm.notify(isDown.id, true);
@ -44,7 +41,6 @@ Elm.Native.Mouse.make = function(elm) {
position: position,
x:x,
y:y,
isClicked: isClicked,
isDown: isDown,
clicks: clicks
};