Inuyasha123
Topic Author
Posts: 19
Joined: 22 May 2019, 10:53

ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped

13 Jun 2019, 04:20

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.
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped

14 Jun 2019, 13:15

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.
 
Inuyasha123
Topic Author
Posts: 19
Joined: 22 May 2019, 10:53

Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped

19 Jun 2019, 04:35

I used the Grid panel to fill the entire screen so that every time the mouse hit the UI element of Noesis
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: ListBox's ScrollBar and Unity's MainCamera scroll simultaneously when the mouse wheel is swiped

20 Jun 2019, 11:09

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