Author Topic: Weird culling of nested widgets in clipped panels  (Read 2424 times)

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Weird culling of nested widgets in clipped panels
« on: December 13, 2013, 01:59:58 PM »
Now that we're allowed to nest widgets inside other widgets, I've started using that with the new anchor system to lay things out.  I've noticed when using a scroll view with soft clipping (probably any clipping) that once a parent sprite is no longer visible inside the scroll view, any of its children will suddenly disappear, even if they extend outside the bounds of the parent.  This is most obvious if I've used a 2x2 empty widget to anchor the position of a group of widgets, but happens in other cases, too.  (For now I've made those empty widgets encompass the bounds of their children, so I've got a workaround, but thought I'd mention the problem.)

For an example, open up the example scroll view scene with the soft clipped panel.  In one of the items in the scroll view, make the orc armor sprite a child of the sliced sprite, and drag it over so its center is on the left or right edge of the sliced sprite.  Make the "New!" label a child of the orc armor and place its horizontal center on the edge of the sprite.  Now press play and drag the scroll view so that the sliced sprite is outside the clip rect.  You should see the orc armor and the text disappear immediately (except when actively moving the scroll view).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird culling of nested widgets in clipped panels
« Reply #1 on: December 13, 2013, 05:51:10 PM »
Parent doesn't go through all its children to calculate the final bounds. It would be a bit too expensive to do. For this reason I suggest you ensure that children don't go outside their parent's borders. You can always create an empty invisible widget to be the container object if you need.