Titanium Community Questions & Answer Archive

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

Generic Touch Events with bounding box

Any way to get a bounding box or min & max x & y with touch events?

ie - if somebody touches a large portion of the screen as a single touch event it would be helpful to know the start & end of the x & y.

I'm primarily interested in the Android platform.

— asked May 4th 2010 by David Ashwood
  • bounding
  • box
  • events
  • screen
  • touch
0 Comments

4 Answers

  • Yes, but it depends. Most components have touchstart, touchmove & touchend events. You would need to listen for these events and track them to do what you need.

    Hope this points you in the right direction, but if not, I can help you for your situation.

    — answered May 4th 2010 by Clint Tredway
    permalink
    0 Comments
  • Hi Clint,

    I've tried this - but the result isn't what I'd expect it to be.
    It appears the end event appears to give the top/left of the box - rather than the bottom right (assuming that x & y are pixels).

    Using a simple example of checking for the size of a fingerprint on the screen with meaty fingers :):

    {"width":5.029895782470703,"height":4.52215576171875}

    — answered May 4th 2010 by David Ashwood
    permalink
    0 Comments
  • I do not believe you can get the size of a touch. I have done multi-touch apps on other devices and this is a very hard thing to do and its not reliable.

    — answered May 4th 2010 by Clint Tredway
    permalink
    0 Comments
  • Muti-touch is another issue but I would imagine that having a bounding box would help - where the top left and bottom right would be each finger.

    — answered May 4th 2010 by David Ashwood
    permalink
    0 Comments
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.