Author Topic: Button and drag behavior on mac vs iOS  (Read 9139 times)

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #15 on: July 31, 2012, 10:56:12 AM »
Thanks for the hint with the event system.

But i do not think that UICamera.currentTouch.collider.name works, because UICamera.currentTouch odes not have a .collider .
Maybe you mean UICamera.MouseOrTouch.pressed ? not sure because its not documented only by the fact that its there.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #16 on: July 31, 2012, 12:03:30 PM »
You're right, I'm missing one thing. It should be:
  1. UICamera.currentTouch.pressed.collider

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #17 on: August 07, 2012, 05:51:44 AM »
Just tested around and found something interesting.

In my drag and drop script that is mainly a copy of yours i found the following line:

  1. if (UICamera.currentTouchID == -1)

On my mac currentTouchID == -1
On my IPad currentTouchID == 0

So that does not work on mobile.

is there any specific reason why currentTouchID should be -1 ?
I just overwrote the line with
  1.  if(true)
and its works now.

The only thing I am not sure if its a bug or misbehaving because of my fix, but the drag movement is very smoothed out / delayed. (cant tell if its writhe that way because i did never seen any drag movement on mobile before.)

JRoch

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #18 on: August 07, 2012, 10:21:38 AM »
http://www.tasharen.com/?page_id=160

Quote
Inside your event functions you can always figure out who sent the event (UICamera.currentCamera), RaycastHit that resulted in this event (UICamera.lastHit), as well as the on-screen position of the touch or mouse (UICamera.lastTouchPosition). You can also determine the ID of the touch event (UICamera.currentTouchID), which is ‘-1′ for the left mouse button, ‘-2′ for right, and ‘-3′ for middle.

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #19 on: August 07, 2012, 10:59:03 AM »
Ok thats a thanks for you JRoch.

Now is the only remaining question is the delayed / super smoothed behavior of the dragged object normal at touch input?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button and drag behavior on mac vs iOS
« Reply #20 on: August 07, 2012, 12:32:04 PM »
Yeah it's normal.