Author Topic: Touch threshold has a minimum based on screen.height  (Read 24578 times)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Touch threshold has a minimum based on screen.height
« on: October 10, 2012, 06:05:33 AM »
I'm talking about line 920 in UICamera
  1. float click  = isMouse ? mouseClickThreshold : Mathf.Max(touchClickThreshold, Screen.height * 0.1f);

I'm wondering if the Screen.height * 0.1f isnecessary, because that means that on a ipad3 or iphone5 I can't have click thresholds lower than 24 and 11 px respectively. It especially causes trouble when I'm doing the UIRoot with manual height, because on ipad 3 (or other ipads) the height is calculated as 512, which means 24 px is quite big, since it's only 384 px wide. :)

I would just change it in UICamera, but then it will break every time I update NGUI - so I was hoping you could either remove it or make a "smarter" solution.

Nicki.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #1 on: October 10, 2012, 08:06:40 AM »
I've made a different solution based on DPI (since we only support iOS devices right now), so I can define a certain distance that your finger has to move instead of by pixels, then by inch/cm and calculate the pixel thresholds from that.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #2 on: October 10, 2012, 09:41:24 AM »
Share the solution and I will be able to integrate it into the main branch.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #3 on: October 10, 2012, 05:33:46 PM »
Will do when I get back to work tomorrow.

damelin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #4 on: March 05, 2013, 12:42:56 AM »
I saw this post after a fight with 'touchClickThreshold'. Would it be possible to reconsider the ScreenHeight * .1f? This make a big threshold, bigger then the default 40 one, which is already high for most devices.

I saw the suggestion of cancelling click on OnDrag (with clickNotification = none) but, I would rather use the touchClickThreshold, since it could perfectly do the work!

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #5 on: March 05, 2013, 02:33:06 PM »
Just tweak the code to what you want it to be. I can remove the 0.1 part in the next update.

damelin

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Touch threshold has a minimum based on screen.height
« Reply #6 on: March 05, 2013, 05:55:30 PM »
Yeah, it would be great if you could remove it! :)

Thanks.