Axiom.Samples.Widget.IsCursorOver C# (CSharp) Méthode

IsCursorOver() public static méthode

Static utility method to check if the cursor is over an overlay element.
public static IsCursorOver ( OverlayElement element, Vector2 cursorPos ) : bool
element Axiom.Overlays.OverlayElement
cursorPos Vector2
Résultat bool
		public static bool IsCursorOver( OverlayElement element, Vector2 cursorPos )
		{
			return IsCursorOver( element, cursorPos, 0 );
		}

Same methods

Widget::IsCursorOver ( OverlayElement element, Vector2 cursorPos, Real voidBorder ) : bool

Usage Example

Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cursorPos"></param>
        public override void OnCursorPressed(Vector2 cursorPos)
        {
            if (!this.scrollHandle.IsVisible)
            {
                return;                 // don't care about clicks if text not scrollable
            }

            Vector2 co = Widget.CursorOffset(this.scrollHandle, cursorPos);

            if (co.LengthSquared <= 81)
            {
                this.isDragging = true;
                this.dragOffset = co.y;
            }
            else if (Widget.IsCursorOver(this.scrollTrack, cursorPos))
            {
                Real newTop        = this.scrollHandle.Top + co.y;
                Real lowerBoundary = this.scrollTrack.Height - this.scrollHandle.Height;
                this.scrollHandle.Top = Math.Utility.Clamp <Real>(newTop, lowerBoundary, 0);

                // update text area contents based on new scroll percentage
                this.scrollPercentage = Math.Utility.Clamp <Real>(newTop / lowerBoundary, 1, 0);
                FilterLines();
            }

            base.OnCursorPressed(cursorPos);
        }
All Usage Examples Of Axiom.Samples.Widget::IsCursorOver