Author Topic: ScrollBar.value & scroll speed  (Read 2168 times)

MaverickDQ

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
ScrollBar.value & scroll speed
« on: April 22, 2014, 10:39:19 AM »
Hello.

I have a Scrollbar linked to a scrollview with "scroll left" and "scroll right" buttons. On button press (hold) I'm changing scrollbar.value to slide scroll view left or right. But, depending on content the moving speed of the content is different for same scrollbar.value change and this is quite understandable.

Because scrollbar.value is 0-1 clamped I have to calculate "scroll step" that depends on content to have same scroll speed through entire project. I've tried several ways but none give a viable result.

Could you please advice?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar.value & scroll speed
« Reply #1 on: April 23, 2014, 07:14:23 AM »
NGUITools.Calculate series of functions can tell you the bounds of your content. You can use the size of the bounds to adjust your step value accordingly.

MaverickDQ

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: ScrollBar.value & scroll speed
« Reply #2 on: April 23, 2014, 07:53:28 AM »
NGUITools.Calculate series of functions can tell you the bounds of your content. You can use the size of the bounds to adjust your step value accordingly.


You probably meant NGUIMath.Calculate.
Anyway thank you for reminding me about these tools. This is the only thing I haven't try.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollBar.value & scroll speed
« Reply #3 on: April 23, 2014, 08:02:08 AM »
Right you are. NGUIMath.