Hello Guest

Author Topic: Vertical tk2dUIScrollableArea in a Horizontal tk2dUIScrollableArea  (Read 4746 times)

daklab

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Daklab - Experiments, Projects, Designs, Tips, and Tutorials Related to Creative Coding
I have a vertical tk2dUIScrollableArea (page) inside a horizontal tk2dUIScrollableArea (holding numerous pages) and it works as you would expect given the API. Currently, if I try to scroll my vertical tk2dUIScrollableArea instance but also move my finger horizontally both tk2dUIScrollableArea instances scroll (vertical and horizontal). I'd like to only scroll one of them but I don't know the best way to achieve this with the current API.  I was wondering a few things:

1) Is it possible to delay the initial scrolling of an tk2dUIScrollableArea instance to determine if the backgroundUIItem.Touch.position has occurred more vertical than horizontal and vice versa? This could be handy for my use case mentioned, but it could also be helpful in determining a user's scroll direction intent. By determining the user's intent a developer may be able trigger something in response.

2) Is it possible to disable just the scroll functionality and re-enable it at a later time?
Braindrop Labs - Games. Apps. Coded Art. www.braindroplabs.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Vertical tk2dUIScrollableArea in a Horizontal tk2dUIScrollableArea
« Reply #1 on: October 28, 2013, 12:01:28 pm »
1. Its not been tested, but have you ticked the "Child of another UI Control" on the child scrollable area?
2. Yes - disable the UIScrollableArea component and re-enable it.

daklab

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Daklab - Experiments, Projects, Designs, Tips, and Tutorials Related to Creative Coding
Re: Vertical tk2dUIScrollableArea in a Horizontal tk2dUIScrollableArea
« Reply #2 on: October 29, 2013, 12:51:29 am »
1) Yes, both work as mentioned but I'd like only one to gain focus at a given time.
2) I meant just the actual scroll functionality, so I could still listen for the touch events from the backgroundUIItem

It looks as though there is nothing built in currently that would handle this (this is what I was trying to find out). I'm also trying to limit/prevent modifications to the source tk2dUIScrollableArea file if possible (prevent updating issues). I have a few ideas for a next step but I would like to know if an idea sticks out as a bad solution based on your knowledge of tk2dToolkit. I'm obviously open to any suggestions you have. Here are my current ideas:

A) Modify tk2dUIScrollableArea source by increasing the SWIPE_SCROLLING_FIRST_SCROLL_THRESHOLD value and dispatching a delegate containing the touch data until just before the SWIPE_SCROLLING_FIRST_SCROLL_THRESHOLD value is reached. From here I could determine if the swipe direction is more vertical vs horizontal or vice versa. From here I could enable/disable the proper scroll areas. My concern here is that there may be an easier way and I'd like to stay away from modifying the source unless there is no other way.

B) Disable both my horizontal and vertical scroll areas and place a tk2dUIItem in front of both so touches can be tracked on it temporarily. From this temporary tracking I can determine whether the finger movement traveled more vertical vs. horizontal or vice versa. From here I could enable the proper scroll area and disable the overlaying tk2dUIItem. My concern here is that there may be an easier way and that I may have trouble translating the tk2dUIItem touch properly to the scroll area that I enable.

If you have no recommendation I guess I'll begin modifying the source. Thanks in advance for any insight.
Braindrop Labs - Games. Apps. Coded Art. www.braindroplabs.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Vertical tk2dUIScrollableArea in a Horizontal tk2dUIScrollableArea
« Reply #3 on: October 29, 2013, 10:40:52 am »
I don't really have any recommendations for this - its not something I've implemented or tried to implement with tk2d.