Author Topic: center child bug in scroll view  (Read 4758 times)

paynechu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
center child bug in scroll view
« on: January 15, 2014, 10:55:41 PM »
open
Quote
Example 7 - Scroll View (Panel)
enable "Center on items"
scroll to first item.
then press left empty space (click to background not item) inside the scroll view.
suppose should not happen anything. but the scroll view will move the first item to the left edge.
« Last Edit: January 16, 2014, 10:27:37 AM by paynechu »

paynechu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: center child bug in scroll view
« Reply #1 on: January 16, 2014, 07:27:48 PM »
:) waiting

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: center child bug in scroll view
« Reply #2 on: January 16, 2014, 11:19:49 PM »
You can fix it by modifying UIScrollView.cs, lines 642 from:
  1.                                 if (!smoothDragStart || mDragStarted)
  2.                                 {
  3.                                         if (onDragFinished != null)
  4.                                                 onDragFinished();
  5.                                 }
...to:
  1.                                 if (onDragFinished != null)
  2.                                         onDragFinished();

paynechu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: center child bug in scroll view
« Reply #3 on: January 18, 2014, 05:09:49 AM »
just upgraded to 3.0.9f1
the issue already fixed.
But still have 2 issues when center of child enabled.
1) You drag the scroll bar to the edge. The scroll view will move the first item to the edge. instead should move the first item to the center.
2) If I removed Checkbox's UIToggledComponents. That mean center of child should enabled by default. when the game started, the scroll view still will move the first item to the edge. instead should the first item in the center.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: center child bug in scroll view
« Reply #4 on: January 18, 2014, 10:26:09 PM »
Yeah, that's not a bug. It's just how the scroll bar works. Scroll bar represents the difference between the content of the scroll view and the scroll view's rectangle. UICenterOnChild lets you have padding on the sides, and the scroll view + scroll bar is not designed to take it into account. I may add support for it in some future version, but for the time being the current behaviour is intentional.

I suggest you use different means of navigation -- swiping around the actual scroll view for example -- and not by dragging the scroll bar. In fact, I would suggest you to use the scroll bar as a means of displaying the position only. Remove the collider from it so that it's not interactable.