Author Topic: UIWrapContent ItemHeight (itemSize)  (Read 3543 times)

davitosan

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
UIWrapContent ItemHeight (itemSize)
« on: November 02, 2017, 08:14:58 PM »
I have a ScrollView with an unknown number of items, because of this I am using UIWrapContent.

The design calls for this scroll view to have items organized by categories. At the start of each category the design calls for a 'label' item.
The desire is to have the 'label' item to be smaller then the actual items. If they were all the same size it would look odd.

From what I can gather, UIWrapContent only supports constant item sizes.

Does UIWrapContent support items of varying sizes?
(3.9.4)

Thank you.
« Last Edit: November 02, 2017, 08:20:57 PM by davitosan »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent ItemHeight (itemSize)
« Reply #1 on: November 06, 2017, 07:29:12 AM »
UIWrapContent will change the widget's size to envelop the specified root object and all of its children. UIWrapContent should be on that object's sibling. It shouldn't be used with scroll views, however. It's meant to resize widgets. The only way to use it to adjust the scroll view's dimensions is to make the scroll view a child of the UIWrapContent's widget, anchored to it. Just make sure you aren't trying to envelop the object's own children. Only siblings' children can be used, otherwise the script will count its own dimensions, resulting in an undefined behaviour.

davitosan

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: UIWrapContent ItemHeight (itemSize)
« Reply #2 on: November 06, 2017, 04:41:25 PM »
I don't understand how adjusting the scroll view's dimensions help with having different sized content.
I don't think I explained my question correctly. Here is an image of what I'm trying to accomplish.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent ItemHeight (itemSize)
« Reply #3 on: November 09, 2017, 08:06:41 PM »
Place all your items underneath your "Label Item" object underneath a UIGrid. Put a UITable on the root object containing your Label Item objects. UIWrapContent is not going to help you here.

Panel ScrollView
- UITable
-- Label Item
--- UIGrid, TweenScale
---- Item1
---- Item2
---- Item3
-- Label Item
--- UIGrid, TweenScale
---- Item1
---- Item2
---- Item3

TweenScale should animate the transform's Y scale to shrink the object. Just check the Quest Log example for how it's used.