Author Topic: Restrict within Panel?:  (Read 4575 times)

J450NP13

  • Guest
Restrict within Panel?:
« on: November 28, 2013, 12:00:42 AM »
I have buttons and I need them to stay ont he screen.  They can be dragged off screen.  Setting up collision isn't going to work...using pyshics isn't going to work.

I notice there's a "restrict within panel" check box, but it doesn't work....unless I am doing it wrong.

How is this suppose to work to keep buttons on the screen???

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Restrict within Panel?:
« Reply #1 on: November 28, 2013, 01:18:16 AM »
Restrict within panel option works on panels that have clipping set to something other than "None".

If you set up your panel with Invisible clipping, with a UIStretch on that panel that would automatically adjust the clipping to screen's dimensions, and change UIScrollView's Drag Effect to "Momentum" or "None", then you will achieve the effect you're going for.

J450NP13

  • Guest
Re: Restrict within Panel?:
« Reply #2 on: November 28, 2013, 01:21:52 AM »
My panels don't have a option for invisible clipping. Just alpha ans soft clip.

J450NP13

  • Guest
Re: Restrict within Panel?:
« Reply #3 on: November 28, 2013, 01:26:45 AM »
I set it to alpha clipping and connected the UIstretch, and dragged the panel the buttons are on to the container, is that correct?

But when the buttons get to the edges they just start to go invisible,  I need them to stop there.

J450NP13

  • Guest
Re: Restrict within Panel?:
« Reply #4 on: November 28, 2013, 01:40:52 AM »
Got it....awesome.

How do I change the size of the panel with code for different resolutions?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Restrict within Panel?:
« Reply #5 on: November 28, 2013, 01:47:10 AM »
If you don't have the Invisible option they you don't have the latest version of NGUI. To change the size of the panel, just use UIStretch. It does it for you just like if the panel was a widget. If you want to do it manually, adjust the panel's clipping rect.

J450NP13

  • Guest
Re: Restrict within Panel?:
« Reply #6 on: November 28, 2013, 02:02:06 AM »
Well I'm not upgrading now...with my luck it will screw something up.

How do I use the UIStretch??

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Restrict within Panel?:
« Reply #7 on: November 28, 2013, 03:31:23 PM »
Just attach it to your panel like you would attach it to any widget.