Author Topic: UICenterOnChild Recenter has a item width offset  (Read 3769 times)

mapleegreen

  • Guest
UICenterOnChild Recenter has a item width offset
« on: October 30, 2012, 06:45:20 AM »
     I have a clip panel and it has a child uigrid,the grid has no any child item,when I click a button,the grid will be add all the child item.for center item,I get the UICenterOnChild component and call the function UICenterOnChild.Recenter(),but the first item is not on center position.If drag the grid,it works well,after move every item will be right on the center position.
  my goal is:after add all the items,the first item will on the center position.
   I know I must have made some mistakes and I have work it for a few days,please help me

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICenterOnChild Recenter has a item width offset
« Reply #1 on: October 30, 2012, 07:59:55 AM »
Recenter() is exactly the function that gets called after you stop dragging, so the logic is exactly the same. Try delaying your Recenter() call by one frame.

mapleegreen

  • Guest
Re: UICenterOnChild Recenter has a item width offset
« Reply #2 on: October 30, 2012, 10:11:17 AM »
Recenter() is exactly the function that gets called after you stop dragging, so the logic is exactly the same. Try delaying your Recenter() call by one frame.
I have tried,but no effect.The item2 is on the center postion,but the item1 is the closest .
It's a horizonal grid.In fact,there are other grid that all work well.
« Last Edit: October 30, 2012, 10:22:49 AM by mapleegreen »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UICenterOnChild Recenter has a item width offset
« Reply #3 on: October 30, 2012, 10:23:17 AM »
You have to make your own essentially, that's what I've done. Let me see if I can find something for you to work with when I get home.

mapleegreen

  • Guest
Re: UICenterOnChild Recenter has a item width offset
« Reply #4 on: November 01, 2012, 04:35:38 AM »
You have to make your own essentially, that's what I've done. Let me see if I can find something for you to work with when I get home.
Thanks a lot,I have not find a good way.