Author Topic: Window resize based on content  (Read 1866 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Window resize based on content
« on: November 18, 2015, 04:55:48 PM »
Hey,

I've been using NGUI for quite some time now and always avoided doing this... but now would be a good time to know if there is an "easy way" to do it. What I want to achieve is this:

http://www.teeteehaa.de/gc/gamescom2010/images/guildwars2-skills8-feralsignet.jpg

Imagine that the background is a widget, the items inside are ordered by a grid, and I want the grid to control the size of the parent widget, based on how many items are in the grid. Is there an "automatic" way to do it? I know it wouldnt be hard to calculate the size based on the widget's variables, but what if this was a Table for exemple? Is this at all possible by "NGUI Native" ways?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Window resize based on content
« Reply #1 on: November 25, 2015, 04:46:17 PM »
EnvelopContent script can resize a widget based on the bounds of the root object you provide. Use it to automatically resize the background sprite.