Author Topic: Question about UIPanel  (Read 16513 times)

jingato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Question about UIPanel
« on: May 09, 2014, 04:03:12 PM »
Hi, I was having an issue with UIPanel where Im creating a scrollview and Im anchoring the panel so it grows and shrinks with its parent. I have a function that collapses it so it basically hides all the items. This essentially tries to set the size of the UIPanel's width to 0. It was giving be odd result though as the panel would never go below 20 units. I dug around inside UIpanel and found this code:

  1. float minx = Mathf.Max(20f, mClipSoftness.x);
  2. float miny = Mathf.Max(20f, mClipSoftness.y);
  3.  
  4. if (w < minx) w = minx;
  5. if (h < miny) h = miny;
  6.  
  7. // Update the clipping range
  8. baseClipRegion = new Vector4(newX, newY, w, h);
  9.  


I was wondering why this is there and if it is safe to remove this min size so that I could do what I want it to. I tried removing it and it works, but I want to make sure that  it won't break something else as Im sure it was put there for a reason.

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Question about UIPanel
« Reply #1 on: May 09, 2014, 11:26:00 PM »
Well, size of zero would be invalid. Lower size than 20, sure doable... but why not make it fade out via alpha as it gets close to the smaller dimensions?