Axiom.Samples.TextBox.OnCursorPressed C# (CSharp) Метод

OnCursorPressed() публичный Метод

public OnCursorPressed ( Vector2 cursorPos ) : void
cursorPos Vector2
Результат void
		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 );
				this.FilterLines();
			}

			base.OnCursorPressed( cursorPos );
		}