Thanks for the CPU burn pointer. I don't want to pollute the Touch issue here with that so I started a new thread. bill
On Friday, July 8, 2016 at 3:41:26 PM UTC-4, William Bailey wrote: > > Every once in a while the blind squirrel finds the nut. First, to get a > taste for what I’m implementing in Elm, hit: > > > www.deepfinesse.com/demo > > > Then hit the GO button, then the rotate icon a few times. It’s a bridge > playing game. > > > I began developing this in 0.16 and have it ported to 0.17. I was > somewhat on the fence about whether to implement this using Elm’s HTML > modules or as pure graphics via the Element / Collage modules. Since it > really is all graphics ala Mario and Pong, I went with Element / Collage, > as those programs did. > > > All was fine until the Touch.elm package disappeared in 0.17. This meant > my app no longer worked on my iPhone - a major target for it. I found a > reference on how to do touching in 0.17 but it was HTML based so I could > not really leverage. > > > Completely befuddled about what to do, I took a look inside core/Mouse.elm > to see if I could replicate it in a new Touch.elm module. Despite having > gotten pretty strong with Elm at an application level, I have to say the > contents of Mouse.elm was almost entirely French to me. AFAIK there is no > manual on how all that Effects magic works. > > > Now for the blind squirrel part. I edited core/Mouse.elm directly in my > elm-stuff folder, adding only this: > > > touches : (Position -> msg) -> Sub msg > > touches tagger = > > subscription (MySub "touchend" tagger) > > > Then added the necessary boiler plate to my app: > > > type Msg = WinResize Window.Size > > | MouseClick Mouse.Position > > | TouchEnd Mouse.Position <- ADDED > > > update msg model = > > case msg of > > WinResize newSize -> > > resizeModel newSize model > > MouseClick pos -> > > handleMouseClick pos model > > TouchEnd pos -> > > handleMouseClick pos model <- ADDED > > > And EUREKA, it now works on the iPhone! > > > Now I’m 100% sure this is NOT the right way to do this - adding touchend > to Mouse.elm. If anyone who actually knows what they are doing wants to > add a proper Touch.elm module, or otherwise tell me how to do this > correctly, I’m all ears. > > > I’m also considering re-implementing my whole VIEW code path using the > HTML approach. This seems to be the preferred direction for Elm apps. But > I’m not sure how much sense that makes or even it is doable in a way that > provides the same slick app I have now. It’s all graphics so it really > just wants to put a CANVAS on the whole screen and draw in it. > > > thx Bill > > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
