Ejemplo n.º 1
0
 public MouseNavigateEventArgs(PointF point, EMouseBtns btns, ENavOp nav_op, bool nav_beg_or_end)
 {
     ZNavigation = false;
     Point       = point;
     Btns        = btns;
     NavOp       = nav_op;
     NavBegOrEnd = nav_beg_or_end;
     Handled     = false;
 }
Ejemplo n.º 2
0
            /// <summary>
            /// Mouse navigation and/or object manipulation.
            /// 'point' is a point in client space.
            /// 'btns' is the state of the mouse buttons (MK_LBUTTON etc)
            /// 'nav_op' is the logical navigation operation to perform.
            /// 'nav_beg_or_end' should be true on mouse button down or up, and false during mouse movement
            /// Returns true if the scene requires refreshing</summary>
            public bool MouseNavigate(PointF point, EMouseBtns btns, ENavOp nav_op, bool nav_beg_or_end)
            {
                // This function is not in the CameraControls object because it is not solely used
                // for camera navigation. It can also be used to manipulate objects in the scene.
                if (m_in_mouse_navigate != 0)
                {
                    return(false);
                }
                using (Scope.Create(() => ++ m_in_mouse_navigate, () => -- m_in_mouse_navigate))
                {
                    // Notify of navigating, allowing client code to make
                    // changes or optionally handle the mouse event.
                    var args = new MouseNavigateEventArgs(point, btns, nav_op, nav_beg_or_end);
                    MouseNavigating?.Invoke(this, args);
                    if (args.Handled)
                    {
                        return(false);
                    }

                    // The mouse event wasn't handled, so forward to the window for navigation
                    return(View3D_MouseNavigate(Handle, v2.From(args.Point), args.NavOp, args.NavBegOrEnd));
                }
            }