Author Topic: When and why to use seperate panels in one UI?  (Read 1559 times)

vexe

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 153
    • View Profile
When and why to use seperate panels in one UI?
« on: August 26, 2013, 12:57:16 PM »
Hello, in the NGUI scroll view example, the one with the clipping panel. There's a lot of panels used. One for the clipped view, one for the main window, and one inside the main window, for the scroll bar. I just wonder why? - when and when should I do that?
can't everything fit in one panel? - what's the benefits of using separate panels? and how should I decide on how to separate them? - Thanks a lot.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: When and why to use seperate panels in one UI?
« Reply #1 on: August 27, 2013, 02:45:53 AM »
Each panel batches widgets underneath. When widgets change, everything must be re-batched. This is why the scroll bar is on its own panel -- so that when it changes (which happens every frame) it doesn't force the entire window to be redrawn. Clipped panel has its own panel because the elements inside must be clipped.