Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - JSwigart

Pages: [1]
NGUI 3 Support / UIDragScrollView usage
« on: July 12, 2017, 10:48:19 PM »
I have a grid of objects within a scroll view, there is also a single large "background" item with a UIDragScrollView such that you can drag anywhere within the scroll view to scroll it, as one would expect. Once items are added to the grid, by default you cannot drag on the items themselves to still invoke the scroll view dragging. As I understand it, the fix for this is to add a UIDragScrollView to each of the items as well, and indeed this seems to work.

Assuming all that is proper usage, I've encountered an issue that appears to require a fix within NGUI itself.

Since my grid items now have UIDragScrollView, they forward OnPress events to the underlying scroll view. The issue is that if any of my custom logic, such as a click event on the object itself, removes or disables the item in the grid(as is the case with the inventory swapping I am debugging), when that grid item gets the OnPress(false) to notify of the release, the item is disabled, so that event is not forwarded to the scroll view. This leaves the scroll view in a mPressed = true state and scrolling is broken, because LateUpdate doesn't apply the mScroll, and zeroes it out in the else from

  1. // Apply momentum
  2.                 if (mShouldMove && !mPressed)

Pages: [1]