Author Topic: Nested ScrollView Accordion - Touch usability on mobile.  (Read 7393 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Nested ScrollView Accordion - Touch usability on mobile.
« on: June 10, 2014, 01:04:50 PM »
I just upgraded to Unity 4.5 and happy to report that NGUI's accordion nested scrollview is still working.

I have a question about how to do the following:

The accordion has nested horizontal scrollviews and when scrolling the accordion items vertically on the phone, if the user touches one of the horizontal items then it's not possible to scroll up and down, only horizontally.  This behaviour makes it quite difficult to use the accordion on mobile devices.

How to get the accordion to scroll up/down even when the user is dragging vertically on an item from the horizontal scrollview ?
To rephrase the question:  How to get the accordion to behave like most mobile accordions where when the the user drags up/down, the accordion pans up/down.  When dragging left/right on a horizontal scrollview item, then the item is paned left/right.

Edit: The situation is at its worse when all of the accordion's items are expanded.
Here's a video:

https://dl.dropboxusercontent.com/u/48378123/NGUI-Accordion_Dragging_Up_down.mp4
« Last Edit: June 10, 2014, 01:20:08 PM by wallabie »

spooky

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 16
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #1 on: June 10, 2014, 01:19:04 PM »
This sounds like something explained in one of the new tutorial videos on scroll views. In the example he constrains the direction, so that when panning the scroll view, clicking on a dragdrop item in the list doesn't prevent you from scrolling. I'm not sure if you could apply this to the nested accordion scroll view, but it might help?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #2 on: June 10, 2014, 04:22:10 PM »
I would make an accordion controller that receives the touch input and based on the drag values decide which scrollPanel to forward the events to.

Alternatively, you have to have both scrollPanels receive the OnPress and OnDrag events from the draggables. This will make them draggable everywhich way at the same time.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #3 on: June 11, 2014, 05:11:04 AM »
"Alternatively, you have to have both scrollPanels receive the OnPress and OnDrag events from the draggables. This will make them draggable everywhich way at the same time."

You mean to add a UIDragScrollView to the main Accordion SV and to each of the horizontal SV?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #4 on: June 12, 2014, 03:21:59 AM »
Yup.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #5 on: June 12, 2014, 01:31:25 PM »
I tried your suggestion but it doesn't seem to work so well for me.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #6 on: June 13, 2014, 02:10:18 AM »
@ArenMook,

Can you give some suggestions to make this work, the Daikon Accordion works on mobile perfectly.  It would be nice to wrap up the NGUI accordion so that it looks and also works like how an accordion should be.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #7 on: June 13, 2014, 05:08:26 AM »
Quote
if the user touches one of the horizontal items then it's not possible to scroll up and down, only horizontally
Why not? In the drag & drop example if you press on an item and move the mouse vertically, it scrolls the scroll view, and if you move the mouse horizontally it starts the drag operation.

If you have nested scroll views, and one is horizontal and another is vertical, just have two UIDragScrollView scripts -- one for one scroll view, and the other for another -- attached to the same items.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #8 on: June 13, 2014, 06:51:28 PM »
Wallabie, maybe you didn't add the double DragScrollView scripts to the objects inside the accordion? It should work. :)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #9 on: June 14, 2014, 04:32:14 AM »
Ah that was it.  I didn't quite get the idea to attach 2 draging comp to the same item. 

It works but the interaction is a bit wonky.  I mean, when dragging vertically, the items are also moving horizontally.  Is there an offset that can be applied so that it can better detect the "General" drag direction in order to give a more solid feel to the Vertical or Horizontal scrolling?

This video shows the wobbling nature of the dragging.
https://dl.dropboxusercontent.com/u/48378123/AccordionDragging.mp4

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #10 on: June 14, 2014, 07:26:34 AM »
Yeah I can imagine that. In that case, I would make my own extension of UIDragScrollView that could send the inputs to both scrollviews and make any form of "selecting direction" logic in there.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #11 on: June 15, 2014, 03:44:29 AM »
Do you mean "lock" into a specific direction? So when you start dragging horizontally, it will prevent dragging vertically?

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #12 on: June 15, 2014, 06:00:05 AM »
Yes, a kind of lock. 

On the phone, if the "General Direction" of the swipe is vertical, then it will scroll vertically and if the "General Direction" of the swipe is horizontal then it will go horizontal.  This way, the feeling of the interaction is much more solid and purposeful.

Have a look at some of these types of nested kinds of scrollViews on your phone and you'll see what I mean.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested ScrollView Accordion - Touch usability on mobile.
« Reply #13 on: June 15, 2014, 06:10:23 AM »
I would achieve this by using a script that would keep an eye on the OnDrag event -- once it arrives, the drag operation begins -- so check which way we're moving (horizontally or vertically). Do a GetComponents<UIScrollView>(), and disable the one that's the opposite. Re-enable the components in OnPress(false).