Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Touch Events through Webviews

So I've seen this question asked before, but neither of those anwsers have helped me solve this problem yet.

I used the Code to draw through a webview "html5/javscript" combo.

While this works on the simulator (and a android phone, although I have to press really hard) it does not want to work on either a ipod/iphone/ipad (tested all 3 of them)

the code is here:

app.js :

http://pastie.org/1202528

index.html :

http://pastie.org/1202526

While this works on the simulator and on a android device (G1) it doesnt work on apple devices (ipod/iphone/ipad).

The init() function gets loaded cause the moment i put:
alert('it works'); in the init() function the alert box pops up on all devices (incl the ipod/iphone/ipad)

What is going on here how do I fix this?

As a bonus, whenever I get this working, I will upload the whole project of a working version on all devices for people to grab and analyse.

Thnx

— asked October 6th 2010 by Patrick van Zadel
  • html5
  • touch
  • webview
0 Comments

2 Answers

  • For the Reader Here.

    Here is my final version of a preview app with painting, it uses an Jquery plugin made by someone else (credits are in the drawbox.js)

    this app start with a white view, in landscape..
    if you click on the drawer at the bottom a drawer opens and it shows 4 icons (home, music, replay/back, brushes).

    when you click on the right most icon (brushes) the webview event gets fired and you can draw on the view, the drawer also changes to 24 colors (which can be clicked) and each color has 2 brush sizes.

    so for the people that need this or are interessted here you go.

    http://www.megaupload.com/?d=I2G07ZJ6

    — answered October 7th 2010 by Patrick van Zadel
    permalink
    1 Comment
    • can you upload it to another free hosting site

      — commented October 2nd 2012 by shanuka gayashan
  • I just downloaded your project, very nice work!

    — answered October 7th 2010 by John McKnight
    permalink
    1 Comment
    • Thanks, it took some time but with the help of other js communities I managed to get this working, as said in my firstpost this should and will work on ios devices not just on the simulator, the jquery plugin was specifically designed for ios touch events.
      Ofcourse I'm looking at expanding this code with a brush size slider and a color picker version.
      Ideally the new muro.deviantart.com is a wondefull goal.

      But for now I'm focussing on multitouch gestures for pinch zoom/rotate
      First by trying natively and if that won't work with a js webview..
      Things I'm looking at now are iprocessing and scripty2 and also bought a iphone dev book for eventual module creation as a last resort.
      Anyway I may need to start a git for some of these stuff.
      If you see any problems or something please do tell i'l try and fix or help fix them

      — commented October 7th 2010 by Patrick van Zadel
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.