Author Topic: Dragging panel with embedded scroll view?  (Read 22386 times)

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Dragging panel with embedded scroll view?
« on: October 04, 2015, 06:14:17 AM »
Hi, I have a couple of cases where I have a panel with an embedded scroll view, and when I drag the parent panel around, the scroll view hitches and looks bad.

Is there a particular way to set up something like this?

e.g. I have a Map with a title bar, which can be used to drag the entire map. The map itself can be scrolled around as it is much larger than the scroll view.

Panel_Map
- Title Bar (Has UIDragObject with Panel_Map as target)
- Panel (scroll view)
  - Texture (map)

This seems like a logical setup to me, but it just doesn't work nicely at all - it's like the panels are updating in the wrong order, or the scroll view isn't fully in local space.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #1 on: October 07, 2015, 07:40:29 PM »
I just did this simple test:

1. New scene.
2. Added a panel.
3. Added a child sprite with a collider to it, UIDragObject on it set to point to panel from #2.
4. Added a scroll view underneath panel from #2.
5. Added a sprite underneath the scroll view.

Running the scene and dragging the sprite from #3 works fine and there are no hitches. What are you doing differently?

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #2 on: October 07, 2015, 08:31:39 PM »
I just did this simple test:

1. New scene.
2. Added a panel.
3. Added a child sprite with a collider to it, UIDragObject on it set to point to panel from #2.
4. Added a scroll view underneath panel from #2.
5. Added a sprite underneath the scroll view.

Running the scene and dragging the sprite from #3 works fine and there are no hitches. What are you doing differently?

I just followed those exact steps, and when I drag the title bar (Sprite from #3) around, the sprite from #5 hitches around

This is on my work PC too, and as a new scene in a different project, so it's showing the exact the same issue I'm seeing at home.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #3 on: October 07, 2015, 08:32:42 PM »
What version of NGUI?

Make sure the hierarchy looks like this:

UIRoot
- Camera
- Panel 1 (draggable)
-- Sprite (UIDragObject set to target panel 1)
-- Scroll View
--- Sprite

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #4 on: October 07, 2015, 08:36:52 PM »
3.9.2 at home, and 3.8.0 at the office

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #5 on: October 07, 2015, 08:37:39 PM »
Please be sure to update to the latest. Also note that the UIDragObject script updates are based on the mouse updates, so if your mouse update rate is 30 Hz, you will only get 30 updates per second. This is why in the draggable window example that comes with NGUI I use an interpolation script to make it smoother.

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Dragging panel with embedded scroll view?
« Reply #6 on: October 07, 2015, 09:23:29 PM »
Thanks for that.

It's funny but I've noticed this issue in the past several times, but it wasn't critical to get it fixed until now, and then you fix it without me noticing :)