Author Topic: UITable with ClipedView children reposition error  (Read 2901 times)

kptt

  • Guest
UITable with ClipedView children reposition error
« on: June 20, 2013, 02:39:10 AM »
Hi,
my hierarchy looks like:

UITable
-CategoryOne
--UIButtonTween
--TweenScale(to shrink or extend)
----Panel(ClipedView)
------UIGrid
--------items
----Scroll Bar
-CategoryTwo
--UIButtonTween
--TweenScale(to shrink or extend)
----Panel(ClipedView)
------UIGrid
--------items
----Scroll Bar

If all tweenScale are shrinked(scale to 0.00001),two uibutton are repositoned ok.
Now when Category One extended,I need the UIButton of category two positioned just below ClipedView panel,but it goes far away,depends on the UIGrid items count no matter many of them are hidden.

Expected View:
CategoryOne
Title
item1
item2
item3
...
END OF CLIP HEIGHT
CategoryTwo

Actual View:
CategoryOne
Title
item1
item2
item3
...
END OF CLIP HEIGHT
SPACING (hidden item)
SPACING (hidden item)
SPACING (hidden item)
...
CategoryTwo

 :'(
I think CalculateRelativeWidgetBounds do not know about the cliped panel.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITable with ClipedView children reposition error
« Reply #1 on: June 20, 2013, 07:38:05 AM »
If I understand your post correctly, you should be using UITable instead of UIGrid. UIGrid always spaces things evenly.

Also you should really take a look at the Quest Log example that comes with NGUI.

kptt

  • Guest
Re: UITable with ClipedView children reposition error
« Reply #2 on: June 20, 2013, 09:24:28 PM »
If I understand your post correctly, you should be using UITable instead of UIGrid. UIGrid always spaces things evenly.

Also you should really take a look at the Quest Log example that comes with NGUI.

You havn't understood correctly.
Let me explain again
All UITalbe and UIGrid are vertical align and single column.
===========================================================
ClipedView Panel (Cliped Size Y is 200)
--UIGrid with many children,total height 500 (300 will invisible cause clip size is 200)
===========================================================make this a prefab called ITEM
create a UITable,put many ITEMs input the UITable
with hierachy like
UITable
--ITEM 1
--ITEM 2
--ITEM 3

Expect positions are
ITEM 1 at Y 0
ITEM 2 at Y 200                              (ITEM 1 clip size Y is 200)
ITEM 3 at Y 400

Actual positions are
ITEM 1 at Y 0
ITEM 2 at Y 500                              (ITEM 1 total height is 500,clip size ignored)
ITEM 3 at Y 1000

UITable reposition do not consider Clip size,but using real widget size.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITable with ClipedView children reposition error
« Reply #3 on: June 21, 2013, 05:28:38 AM »
Yes, table works with the actual widget size. It auto-scales the cell sizes to best fit the content. Grid doesn't. Grid maintains fixed size.

kptt

  • Guest
Re: UITable with ClipedView children reposition error
« Reply #4 on: June 23, 2013, 10:40:55 PM »
Yes, table works with the actual widget size. It auto-scales the cell sizes to best fit the content. Grid doesn't. Grid maintains fixed size.

But ITEM is not fixed size,ITEM is like a dropdown menu,when extend its size is 200(clipedSize),when shrink its size is 20.
another graphics:

--ITEM 1(shrinked)   at Y 0
--ITEM 2(extended)  at Y 20  (cause ITEM 1 is shrinked,and its height is 20)
--ITEM 3                at 220  (ITEM 2 is extended,its height + ITEM 1 height = 220)

Table use actual widget size,Grid use fixed size,neither of them are suit to this situation.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITable with ClipedView children reposition error
« Reply #5 on: June 24, 2013, 10:39:24 AM »
I just re-read your post... Yes, calculation of widget bounds does not take clipped panels into consideration.

kptt

  • Guest
Re: UITable with ClipedView children reposition error
« Reply #6 on: June 24, 2013, 09:44:45 PM »
I just re-read your post... Yes, calculation of widget bounds does not take clipped panels into consideration.

Yes,that's the problem.When use ClipedView, I think widget bounds should just return Cliped size.

Will you match patch to this? Or could you tell me how to achieve this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITable with ClipedView children reposition error
« Reply #7 on: June 25, 2013, 01:16:08 PM »
The function isn't meant to work with clipping. It's used to determine the final bounds of everything -- which is actually used by draggable panels (which use clipping). If I was to change it, draggable panels would stop working.

I advise you write your own logic -- calculate the bounds of widgets, and calculate the bounds of the clipped panel -- then just choose the smallest of the two.