예제 #1
0
            /// <summary>
            /// Zoom using the mouse.
            /// 'point' is a point in client rect space.
            /// 'delta' is the mouse wheel scroll delta value (i.e. 120 = 1 click)
            /// 'along_ray' is true if the camera should move along a ray cast through 'point'
            /// Returns true if the scene requires refreshing</summary>
            public bool MouseNavigateZ(PointF point, EMouseBtns btns, float delta, bool along_ray)
            {
                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, delta, along_ray);
                    MouseNavigating?.Invoke(this, args);
                    if (args.Handled)
                    {
                        return(false);
                    }

                    // The mouse event wasn't handled, so forward to the window for navigation
                    return(View3D_MouseNavigateZ(Handle, v2.From(args.Point), args.Delta, args.AlongRay));
                }
            }
예제 #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));
                }
            }