Author Topic: UIDragScrollView issue with OnPress  (Read 6340 times)

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
UIDragScrollView issue with OnPress
« on: November 25, 2013, 12:17:45 PM »
I have updated NGUI to the latest version, and I am now using the newly named UIScrollView and UIDragScrollView on its children.

However, unlike before, when I click on an object, it instantly scrolls the panel to a location. I do not want the panel to scroll if I click on the item, because I may have other actions to be performed on a click, and it just looks buggy if it scrolls as well.

Could you fix the UIDragScrollView class to behave like the old version did? Only scroll the panel when you drag/scroll, and do not scroll when clicked?

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIDragScrollView issue with OnPress
« Reply #1 on: November 25, 2013, 12:24:15 PM »
It would appear this is due to the Restrict Within Panel option being checked. If its off, it does not scroll to a random location when an item is pressed... Is this correct behaviour?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragScrollView issue with OnPress
« Reply #2 on: November 25, 2013, 06:51:48 PM »
Scrolling to an item on click happens if you have UICenterOnClick attached, which is a new script -- so I doubt that's the cause. I don't see anything that would reposition the panel on click in the base code, and I can't reproduce it in the scroll view example. Can you provide more details?

mimminito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: UIDragScrollView issue with OnPress
« Reply #3 on: November 26, 2013, 04:33:14 AM »
Hi,

Sure. Attached are some screenshots of my "Items" inspector. As you can see, there is no UICenterOnClick attached. However, when I click on an item, it auto moves the panel (not to the item clicked, but another one).

I unchecked the Restrict Within Panel option, run it up again, and it all began to work as normal (i.e. no scrolling when clicking, only dragging).
All I could see, was than when Press was called in the UIScrollView class, and "false" was passed through, it would call RestrictWithinBounds. I just thought I would give it a go by turning off that option, and it worked!

I cant give much more information off the top of my head, but if there is anything specific you need, let me know.

Adam