AB4D Forum
Problem of employ MouseEnter and MouseLeave on a Complex model - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: Problem of employ MouseEnter and MouseLeave on a Complex model (/showthread.php?tid=4088)



Problem of employ MouseEnter and MouseLeave on a Complex model - liketempl - 02-24-2018

I have an application where I would like to have my Sofa model and Person model (dae format) highlighted when the mouse is over them. I would like the highlighting be the display of a half opacity bounding box of the model just like the picture shows. 
       

I have a strange problem getting an event notification from MouseEnter and MouseLeave events.
When I carefully move the mouse over the model, the mouseEnter event triggers and bounding box shows up,
but when I start to move the mouse pointer around the model (still on the model), the mouseLeave event triggers and bounding box disappear. And it happened repeatedly, mouseEnter and mouseLeave, mouseEnter and mouseLeave. And the bounding box just blink as the mouse moves on the model.

Since the model is very complex, I use the root group (Model3DGroup) as the event's source.

Any help will be great, thanks a lot.
 


RE: Problem of employ MouseEnter and MouseLeave on a Complex model - abenedik - 02-25-2018

When you show the bounding box, it is shown over your 3D model and this makes the mouse hit the bounding box instead of the model - this triggers the mouse leave event.

To prevent the bounding box from being hit by EventManager3D use the RegisterExcludedVisual3D method on EventManager3D and pass the Visual3D that is used to show the bounding box. This will remove it from being hit. When you hide the bounding box from the scene, call the RemoveExcludedVisual3D method so that it will not be checked again.