Author Topic: Making a slider longer  (Read 4933 times)

loopyllama

  • Guest
Making a slider longer
« on: April 12, 2012, 04:59:47 AM »
This one has me stumped. How can I make a slider longer? If I make the slider node or a panel node longer in x then I lose the sharpness of the sliced sprite. If I start scaling the "Size" unde the UISlider then things start to get weird: the thumb starts appearing in the wrong place. What is the "official" way to make the slider longer, but not taller? It seems like NGUI wants sliders to be a certain wdith to height ratio and it is very hard to break that...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Making a slider longer
« Reply #1 on: April 12, 2012, 01:39:09 PM »
There is a "full size" parameter on the slider, that's what you're looking for.

I'll be redoing slider in the future to make it more intuitive, closer to how I have the scroll bar set up right now.

loopyllama

  • Guest
Re: Making a slider longer
« Reply #2 on: April 12, 2012, 01:55:54 PM »
The full size parameter makes the slider look longer, but the slider no longer functions properly. For instance, I use the scifi atlas with settings of button, button, button, and it creates a slider with a full size of 200, 30. If I change this to 400, 30 I see the slider get twice as wide. If I run the game and click somewhere on the slider it behaves oddly. This is also the case with my own atlases. I am doing something wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Making a slider longer
« Reply #3 on: April 12, 2012, 01:59:26 PM »
You need to manually scale the background as well, since the slider doesn't scale it for you.

This is what I'll be changing when I redo the slider in the future.

loopyllama

  • Guest
Re: Making a slider longer
« Reply #4 on: April 12, 2012, 02:08:00 PM »
Thanks for the quick reply. I definitely manually scale the background as well. The slider looks fine, but clicking on the thumb, the thumb will jump all the way to the right and will not slide correctly. Maybe you could make a scifi slider in a blank scene with the button sprite, set fullsize x from 200 to 400, background to 400 scale in x, run, then try moving the slider. For me it does not behave!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Making a slider longer
« Reply #5 on: April 12, 2012, 02:12:41 PM »
oh make sure to update the collider -- NGUI menu -> Add Collider updates it.

loopyllama

  • Guest
Re: Making a slider longer
« Reply #6 on: April 12, 2012, 02:39:04 PM »
That absolutely fixes it. Thank you so much!!  :)