- Home /
Disabling mouse wheel when ScrollView is scrolled
Hello everyone,
Basically, I have two scripts so that one (ScrollView.cs) is responsible for ScrollView and other(CameraControl.cs) is for zooming by using mouse wheel.
Zooming codes are in LateUpdate. Scrolling codes are in OnGUI.
The problem is obvious, I do not want to zoom in-out when user is scrolling the ScrollView.
I also tried the changing order of script execution. But nevermind, I do not know why but it did not work.
Thanks in advance.
Answer by dvincent1337 · Feb 08, 2013 at 04:08 AM
What you may be able to do is detect if the mouse is over top of your scroll view. If the mouse is over the scroll view, and the user is scrolling, then disable scrolling in your other script.
You can detect if the mouse is over your scroll view by using the Rect.Contains function and give it the Rect of your scroll view, and the mouse coordinates. The following doc may help you:
http://docs.unity3d.com/Documentation/ScriptReference/Rect.Contains.html
Good luck!
Your answer

Follow this Question
Related Questions
Disabling mouse wheel when user is scrolling ScrollView 3 Answers
Tapping a button often scrolls outer scrollview instead of running onclick() handler. 2 Answers
How to filter items in a scroll list, using a search bar? 1 Answer
Multiple Prefab Instantiation, Camera, Button and Scroll View Question 1 Answer
ScrollRect autoscroll down 0 Answers