Author Topic: UIGrid bug - ConstrainTargetTobounds  (Read 5164 times)

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
UIGrid bug - ConstrainTargetTobounds
« on: January 03, 2014, 01:16:33 PM »
On line 192/3 of UIGrid, A call to ConstrainTargetToBounds was added. 

I believe this is an inaccurate addition.  It breaks the concept of a grid and directly relates a grid to ANY parent panel.  I believe a grid is used to align its children with respect to itself. *** I don't believe it should take any action to move itself *** 
Here is the circumstances where it is being used and why it is breaking.
I use grid as I believe it should be used, to align children.  Here is the hierarchy.
Panel
- GridEx (an extended grid class to use x number of children, rotating them so that you can display "infinite" number as the window scrolls.) May want to offer this in the future as it is extremely useful
  - Inventory GameObject(there are multiple of these)
    - Sprites/Text/etc
    - Grid
      - sprite
      - sprtie
      - ...

In this case I use the Grid which is under the Inventory GameObject to align its children sprites with respect to its parent gameobject.  Here is where the problem arises, the grid itself changes it location to fit with in the Panel which is incorrect behavior.  It doesn't seem like the Grid should do any repositioning of itself.  It needs to remain in the location I placed it with respect to its parent.

Does this seem correct to you?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid bug - ConstrainTargetTobounds
« Reply #1 on: January 04, 2014, 08:38:42 AM »
Looking at the code, yes your logic makes more sense. I didn't add that line of code by the way. I removed something else above it. What I'm going to do is add "keep within panel" checkbox from UITable to the UIGrid as well. It controls whether the constrain function will be called or not.

cbartlett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 43
    • View Profile
Re: UIGrid bug - ConstrainTargetTobounds
« Reply #2 on: January 04, 2014, 12:02:31 PM »
Sounds good I appreciate you looking at this and confirming.