Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Dover8 on March 15, 2013, 06:00:32 AM

Title: UIGrid - maxPerLine wrong (answered)
Post by: Dover8 on March 15, 2013, 06:00:32 AM
the public variable maxPerLine is either poorly named, or it's behaviour is not as intended. When setting this to 2, instead of there being 2 items in each line, there will be 2 lines.

Either the variable should be named "maxLines", or this code:

  1. if (++x >= maxPerLine && maxPerLine > 0)
  2. {
  3.         x = 0;
  4.         ++y;
  5. }
  6.  

should be changed to:

  1. if (++y >= maxPerLine && maxPerLine > 0)
  2. {
  3.         y = 0;
  4.         ++x;
  5. }
  6.  
Title: Re: UIGrid - maxPerLine wrong
Post by: ArenMook on March 16, 2013, 11:07:53 AM
That depends on the direction of the grid. If it's horizontal, it will be 2 items per line. If it's vertical, it will be 2 items per column.
Title: Re: UIGrid - maxPerLine wrong
Post by: Dover8 on March 18, 2013, 04:06:04 AM
That depends on the direction of the grid. If it's horizontal, it will be 2 items per line. If it's vertical, it will be 2 items per column.

Apologies. I did not see the "arrangement" variable of the grid beforehand.