Author Topic: 3.8.1 UIScrollView iOS Drag Emulation scrolling bug  (Read 5498 times)

Nespar

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 2
    • View Profile
3.8.1 UIScrollView iOS Drag Emulation scrolling bug
« on: March 24, 2015, 04:07:15 AM »
Hi there,
I have a clipped scroll view with a grid with some widgets inside. The Grid and Scroll view allow vertical movement and filling. However scrolling the list is always only half as fast as the input finger movement, which means that the element initially touched doesn't stay below the finger, even though there are enough elements in the list and "restrict within panel" would not kick. I noticed that our widgets are entering the clipped area of the scroll view horizontally by a little bit, and testing showed that this was the problem.

How to reproduce:
  • Create a UIScrollView with vertical movement, enable restrict within panel and enable iOS Drag Emulation
  • Create a UIGrid inside with vertical arrangement
  • Create enough widgets with UIDragScrollView inside so it exceeds the clipped area vertically
  • Move the UIGrid horizontally so that it's content widgets get horizontally clipped as well
  • Enter play mode, scroll the UIScrollView vertically
Behaviour:
While there are enough elements vertically to completely fill the clipped area, scrolling the content should keep the finger/mouse on the element touched. However, when iOS Drag simulation is on and the content gets clipped horizontally, the content only scrolls about half as fast as the finger.

I guess that the iOS Drag simulation is not ignoring axes that the movement doesn't allow, thus thinking that it should move the content slower, as it normally does in iOS Drag simulation when reaching the end of a list.

I can manage, by resizing our widgets or clipped area, but I thought you might want to know.
Please ask, if you have any questions. Have a great day!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.8.1 UIScrollView iOS Drag Emulation scrolling bug
« Reply #1 on: March 24, 2015, 10:41:51 AM »
Thanks, I was able to reproduce it.

shinki

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: 3.8.1 UIScrollView iOS Drag Emulation scrolling bug
« Reply #2 on: December 18, 2015, 08:05:57 AM »
Hi there,

Apologies for reviving this old thread but we are seeing this exact issue in 3.9, and the OP explains it perfectly. You said you reproduced it but I'm not seeing any fixes for this in NGUI commits since our last pull.

We will fix it locally by having the constraint vector only measure in the movement axis, but would appreciate an official fix if possible! :)


Many thanks!

seandanger

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 32
    • View Profile
    • Bit By Bit Studios
Re: 3.8.1 UIScrollView iOS Drag Emulation scrolling bug
« Reply #3 on: April 01, 2016, 06:53:08 PM »
Sorry to resurrect this one again, but I came across this bug in 3.9 as well and wanted to share my fix.

In UIScrollView.cs, after this line:
  1. Vector3 constraint = mPanel.CalculateConstrainOffset(bounds.min, bounds.max);

Add this code:
  1. // modify the offset amounts according to ScrollView movement
  2. if (movement == Movement.Custom)
  3. {
  4.         constraint.x *= customMovement.x;
  5.         constraint.y *= customMovement.y;
  6. }
  7. else if (movement == Movement.Horizontal)
  8. {
  9.         constraint.y = 0.0f;
  10. }
  11. else if (movement == Movement.Vertical)
  12. {
  13.         constraint.x = 0.0f;
  14. }
  15.