- Inuyasha123
- Posts: 19
- Joined:
ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
I am using NoesisGUI in conjunction with Unity for development. Noesis is a very good framework. We have encountered a problem now. When I placed a ListBox control on the main interface, when I slid the mouse wheel, not only the ScrollBox of the ListBox was scrolling, but the Unity camera was also scrolling because I mounted it on the MainCamera of Unity. Handles the event that the mouse wheel is swiping. So we want to do the separation of Noesis events from Unity events, and when Noesis controls get focus, they will respond accordingly.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
Hi,
To determine when mouse is over the UI you can use the following:
In case mouse is over UI you can ignore mouse events for the 3D scene.
You can also deactivate mouse input by changing the property EnableMouse in the NoesisView component.
Hope this helps.
To determine when mouse is over the UI you can use the following:
Code: Select all
Noesis.Visual root = Noesis.VisualTreeHelper.GetRoot(m_view.Content);
Noesis.Point mousePos = new Noesis.Point(UnityEngine.Input.mousePosition.x, UnityEngine.Screen.height - UnityEngine.Input.mousePosition.y);
Noesis.HitTestResult hit = Noesis.VisualTreeHelper.HitTest(root, mousePos);
if (hit.VisualHit != null)
{
// You are over the UI
}
You can also deactivate mouse input by changing the property EnableMouse in the NoesisView component.
Hope this helps.
- Inuyasha123
- Posts: 19
- Joined:
Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
I used the Grid panel to fill the entire screen so that every time the mouse hit the UI element of Noesis
Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
If the panel has a null background it won't be hit-testable.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 9 guests