Author Topic: Slider Thumb Placement is wrong - How to fix it?  (Read 2845 times)

Chaosgod_Espér

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 28
    • View Profile
Slider Thumb Placement is wrong - How to fix it?
« on: November 30, 2015, 05:43:26 AM »
Hi there..

I tried to create a Slider with this Sprites:
Background

Foreground

Thumb



I´m using the latest NGUI version, and created the Slider that way:
• create Empty child
• NGUI -> Attach -> Slider Script
• create the UISprites as children of the SliderObject
  (the Foreground and Background are sliced)
• All Widget privots are Center/Center
• The Thumb Sprite has a BoxCollider attached (with auto adjust size)
• Slider Directionis "Bottom To Top"

The Results:


What have i made wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Slider Thumb Placement is wrong - How to fix it?
« Reply #1 on: December 01, 2015, 07:27:20 AM »
I can only suggest having a look at provided slider controls to see what differs from yours. Make sure you are using scales of (1, 1, 1).

Chaosgod_Espér

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 28
    • View Profile
Re: Slider Thumb Placement is wrong - How to fix it?
« Reply #2 on: December 01, 2015, 09:55:16 AM »
The same problem is in the Examples..
It seems like the Thumb is always placed in the center of the Foreground.. 


Isn´t there a way to create a slider or scrollbar, where the thumb is at the outer edge of the bar, instead of this worng placed thing?


Edit: ugly workaround:

• Slider Main (UISlider, Background Sprite, Foreground Sprite, Thumb)
• • Background Sprite
• • Foreground Sprite with alpha 0, offset of Y -248
• • Foreground visible Graphic, with Y offset of -232 and no affect to the slider - just to show the red inner
• • Thumb (with BoxCollider)

It´s a bit stupid to need a transparent graphic as Foreground, to adjust the Thumb position, and a visible Foreground, to show something ._.
« Last Edit: December 01, 2015, 10:10:41 AM by Chaosgod_Espér »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Slider Thumb Placement is wrong - How to fix it?
« Reply #3 on: December 09, 2015, 12:48:38 PM »
The thumb is just a gameobject. It doesn't need to be a sprite. You can just have a game object there that has a sprite as a child, and adjust the sprite's position accordingly.