Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: tydygunn on October 13, 2015, 01:28:52 PM

Title: Any way to tell if a UISlider is currently being dragged?
Post by: tydygunn on October 13, 2015, 01:28:52 PM
Hiya! NGUI's a lifesaver!

I'm building a scene with camera movement where the user can click and drag the mouse to rotate the camera. I've got it so when the mouse cursor is hovering above a UI collider it'll disable camera movement, but I'm having an issue with sliders. When you click and drag a slider, the cursor can move off the slider's collider area, therefore the camera's movement is allowed again even though the user is still dragging my UIScrollView's slider.

Do you have a technique I could use to check if a slider is in use? I've tried simply checking if UISlider.current != null, but that doesn't seem to be working. UISlider.current.isActiveAndEnabled doesn't work either, but I'm not 100% certain of the purpose of that bool so I didn't expect it to work in the first place. The slider is attached to a UIScrollView, so maybe I could check if that scroll view is being moved? I'm not sure how I'd do that.

Thanks for any advice you could give! Currently using NGUI 3.8.2.
Title: Re: Any way to tell if a UISlider is currently being dragged?
Post by: ArenMook on October 14, 2015, 08:34:39 AM
UICamera.currentTouch.pressed tells you what you pressed it on. Don't just check for what it's currently over. Check for what it's pressed on first.