Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: yuewah on June 13, 2013, 09:53:06 PM

Title: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: yuewah on June 13, 2013, 09:53:06 PM
Scroll View is wired if UICamera 's Sticky Press is set to false

I am using the NGUI Example 7 - Scroll View (Panel).
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: yuewah on June 16, 2013, 01:04:52 AM
@ArenMook, If Stick Press is set to false, the Scroll View will be bounding abnormally when dragging.
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: ArenMook on June 16, 2013, 09:57:23 PM
Find the part that begins with
  1. if (!stickyPress && !unpressed && currentTouch.pressStarted && currentTouch.pressed != hoveredObject)
in UICamera, and replace it with
  1. if (currentTouch.clickNotification != ClickNotification.None)
  2. {
  3.         // If the user is pressing down and has dragged the touch away from the original object,
  4.         // unpress the original object and notify the new object that it is now being pressed on.
  5.         if (!stickyPress && !unpressed && currentTouch.pressStarted && currentTouch.pressed != hoveredObject)
  6.         {
  7.                 isDragging = true;
  8.                 Notify(currentTouch.pressed, "OnPress", false);
  9.                 currentTouch.pressed = hoveredObject;
  10.                 Notify(currentTouch.pressed, "OnPress", true);
  11.                 isDragging = false;
  12.         }
  13. }
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: yuewah on June 17, 2013, 08:36:45 AM
Will you include this in next release ?
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: ArenMook on June 17, 2013, 09:49:37 PM
It's a part of it, yes.
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: yuewah on June 18, 2013, 01:17:13 AM
When StickyPress is set to false, and a button contains UIButtonMessage and UIEventListener, when drag from outside and drop to the button, it throws error "Failed to call function OnDrop of class UIEventListener
Calling function OnDrop with no parameters but the function requires 1."
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: yuewah on June 18, 2013, 02:42:03 AM
Btw, If I start drag from outside through over UIButton, It will notify OnPress Message. I think it will confuse user that they  are clicked on the button.
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: PabloAM on September 16, 2013, 03:55:49 AM
When StickyPress is set to false, and a button contains UIButtonMessage and UIEventListener, when drag from outside and drop to the button, it throws error "Failed to call function OnDrop of class UIEventListener
Calling function OnDrop with no parameters but the function requires 1."

I´m having the same issue even using ArenMook "Patch" (if (currentTouch.clickNotification != ClickNotification.None)).

 I´m using 2.6.5b.

Thanks
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: Nicki on September 16, 2013, 05:43:39 AM
The way stickyPress=false works is sort of a mess and I would seriously recommend not using it.

I will see if I can change it to be the way that one would expect when I have time, but it likely requires some tinkering under the surface, which I'd rather not do.
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: hellaandrew on July 28, 2014, 05:23:43 PM
I was trying to find a solution that didn't require setting the Sticky Press option to false, mainly due to the issues it causes with scrollviews.

What I came up with was just setting the stickyPress boolean to false when the OnPress function is triggered, then set it back to true when OnPress is false.

PS. At my work, we are using an older version of NGUI, only because we're so dug in with this version and can't afford to change anything at this point. I'm not too sure which version we are on or whether or not this sort of issue has been fixed in newer versions, but this seemed to work for me.

  1. UICamera uiCamera;
  2.  
  3. void Start ()
  4.         {
  5.                 uiCamera = GameObject.FindObjectOfType<UICamera>();
  6.         }
  7.  
  8. void OnPress (bool isPressed)
  9.         {
  10.                 if (isPressed)
  11.                 {      
  12.                         uiCamera.stickyPress = false;
  13.                         // Do whatever you need to do here.
  14.                 }
  15.                 else
  16.                 {
  17.                         uiCamera.stickyPress = true;
  18.                 }
  19.         }
  20.  
Title: Re: Scroll View is wired if UICamera 's Sticky Press is set to false
Post by: ArenMook on July 29, 2014, 03:26:57 AM
Sticky press doesn't exist anymore. It was removed a long time ago.