Author Topic: Bug in UISlider?  (Read 4993 times)

NormalUser

  • Guest
Bug in UISlider?
« on: July 12, 2012, 05:23:50 PM »
Below, if mFGFilled is not null, but the fillDirection doesn't match the direction of the UIFilledSprite, the thumb won't move. I think that else if should just be an else condition; or there should be an else that fires off a warning/error. Took me a while to find out why the thumb sprite wasn't moving around when changing the sliderValue from the inspector.
if (mFGFilled != null)
                {
                    if (mFGFilled.fillDirection == UIFilledSprite.FillDirection.Horizontal)
                    {
                        pos.x = mFGFilled.invert ? fullSize.x - scale.x : scale.x;
                    }
                    else if (mFGFilled.fillDirection == UIFilledSprite.FillDirection.Vertical)
                    {
                        pos.y = mFGFilled.invert ? fullSize.y - scale.y : scale.y;
                    }
                }


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug in UISlider?
« Reply #1 on: July 12, 2012, 07:28:10 PM »
Aha, this code was from before I added other methods. Thanks, I will fix it.

moonface

  • Guest
Re: Bug in UISlider?
« Reply #2 on: July 16, 2012, 06:25:02 AM »
Hi,

I've just installed the latest version of NGUI and have the same problem.

The thumb doesn't move although it highlights when moused.

Is a fix coming soon?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug in UISlider?
« Reply #3 on: July 16, 2012, 11:24:39 AM »
Change
  1. else if (mFGFilled.fillDirection == UIFilledSprite.FillDirection.Vertical)
to just:
  1. else
In general though, the thumb movement is only supported with horizontal or vertical filled sprites. Radially filled sprites shouldn't have a thumb.

moonface

  • Guest
Re: Bug in UISlider?
« Reply #4 on: July 17, 2012, 03:47:04 AM »
Hi,

The direction of the sprite was set to radial fill 360 as a default (which I was unaware of) causing this issue for me.

Perhaps when a slider is added it should default to horizontal?

Anyway, it is sorted for me.

Thanks