New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with input events from within collage #334

Closed
jvoigtlaender opened this Issue Aug 6, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@jvoigtlaender
Contributor

jvoigtlaender commented Aug 6, 2015

The following doesn't work as it supposedly should:

import Graphics.Input exposing (..)
import Graphics.Collage exposing (..)
import Graphics.Element exposing (..)
import Signal exposing (..)
import Color exposing (..)

mbx = mailbox ()

foo = move (40,0) (toForm (clickable (message mbx.address ()) <| show "foo"))

counter = foldp (\_ -> (+) 1) 0 mbx.signal

-- Given the above, clicking on the "foo" text should always increment the counter.

bar1 = toForm (show "bar")
bar2 = outlined (solid black) (circle 5)

-- However, this doesn't work:

main = (\c -> flow down [ show c
                        , collage 150 20 [foo, bar2]
                        ]) <~ counter

-- Strangely enough, after replacing [foo, bar2] by any of
-- [foo, bar1], [bar1, foo], [bar2, foo], it does work.

More discussion on this happened on the mailing list and in elm/compiler#747.

The issue is not specific to clickable, for example it also appears with button.

Mentioning elm-lang/core#332 so folks can find this more easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment