In ScrollView - see if user presses the scrollbar thumb

I’m trying to combine a ScrollView touch interface with a thumb scrollbar. Is there a way to see if the user is touching (or clicking) the scrollbar thumb?

I don’t know of a way to get the thumb specifically, however I’ve always been able to capture this click event by checking for the mouse being contained in the slider rect when pressing. Something like:

if (verticalSliderDrawingRect.Contains(Event.current.mousePosition)  Input.GetMouseButtonDown(0)){
//close enough
}

Of course, you could always get the current skin’s slider thumb size values and do some fancy math with the slider value to get exactly where the button is, then use that for a comparison. Or, just watch for the value to change, and consider that a press on the thumb.

Hope it helps!

Hi gvaughan, thanks for your suggestion. The difficult thing is that we use a scrollframe and not a vertical slider, so there’s no difference for that matter between touching the scrollframe or the scroll thumb…

if (rScrollFrame.Contains(Event.current.mousePosition)) 
{
  // obviously returns true for ScrollFrame as well as ScrollFrame Thumb
}

UnityGUI scrollview is buggy. I’m still using it in with eDriven, but considering to write my own (because it seem that UT won’t do it anytime soon).

I’ve experienced the same things, and usually get around it by using a scrollbar to control the position of the scrollview or just control the content position of a group with that value.
If you don’t want to get that involved, you could always set up another rect that you use just for checking for a click in the scrollbar area.