Page 1 of 1
ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
Posted: 13 Jun 2019, 04:20
by Inuyasha123
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.
Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
Posted: 14 Jun 2019, 13:15
by sfernandez
Hi,
To determine when mouse is over the UI you can use the following:
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
}
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.
Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped
Posted: 19 Jun 2019, 04:35
by Inuyasha123
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
Posted: 20 Jun 2019, 11:09
by jsantos
If the panel has a null background it won't be hit-testable.