Author Topic: UIGrid - maxPerLine wrong (answered)  (Read 4378 times)

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
UIGrid - maxPerLine wrong (answered)
« 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.  
« Last Edit: March 18, 2013, 04:06:37 AM by Dover8 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid - maxPerLine wrong
« Reply #1 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.

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: UIGrid - maxPerLine wrong
« Reply #2 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.