Tinkr2/4.2/AphelionCore/AphelionCommonControls/Controls/Containers/Panel.cs
/// <summary>
/// Override this message to handle touch events internally.
/// </summary>
/// <param name="sender">Object sending the event</param>
/// <param name="point">Point on screen touch event is occurring</param>
/// <param name="handled">true if the event is handled. Set to true if handled.</param>
/// <remarks>
/// Moves the form if touch down was on the form.
/// If no then forwards the message to <see cref="Container.ActiveChild"/> or if null, to the child under point
/// </remarks>
Override this message to handle touch events internally.
Override this message to handle touch events internally .
protected override void TouchMoveMessage(object sender, point point, ref bool handled)
      {
         try
         {
            if (_touch)
            {
               bool bUpdated = false;
               int diffY = 0;
               int diffX = 0;
               if (_maxY > Height)
               {
                  diffY = point.Y - LastTouch.Y;
                  if (diffY > 0 && _minY < Top)
                  {
                     diffY = System.Math.Min(diffY, _minY + Top);
                     bUpdated = true;
                  }
                  else if (diffY < 0 && _maxY > Height)
                  {
                     diffY = System.Math.Min(-diffY, _maxY - _minY - Height);
                     bUpdated = true;
                  }
                  else
                  {
                     diffY = 0;
                  }
                  _moving = true;
               }
               if (_maxX > Width)
               {
                  diffX = point.X - LastTouch.X;
                  if (diffX > 0 && _minX < Left)
                  {
                     diffX = System.Math.Min(diffX, _minX + Left);
                     bUpdated = true;
                  }
                  else if (diffX < 0 && _maxX > Width)
                  {
                     diffX = System.Math.Min(-diffX, _maxX - _minX - Width);
                     bUpdated = true;
                  }
                  else
                  {
                     diffX = 0;
                  }
                  _moving = true;
                  handled = true;
               }
               LastTouch = point;
               if (bUpdated)
               {
                  var ptOff = new point(diffX, diffY);
                  for (int i = 0; i < Children.Length; i++)
                  {
                     Children[i].UpdateOffsets(ptOff);
                  }
                  Render(true);
                  handled = true;
               }
               else if (_moving)
               {
                  Render(true);
               }
            }
            else
            {
               if (ActiveChild != null && ActiveChild.Touching)
               {
                  ActiveChild.SendTouchMove(this, point);
                  handled = true;
                  return;
               }
               if (Children != null)
               {
                  for (int i = Children.Length - 1; i >= 0; i--)
                  {
                     if (Children[i].Touching || Children[i].HitTest(point))
                     {
                        Children[i].SendTouchMove(this, point);
                     }
                  }
               }
            }
         }
         finally
         {
            base.TouchMoveMessage(sender, point, ref handled);
         }
      }
protected override void TouchMoveMessage ( object sender , point point , ref bool handled ) { try { if ( _touch ) { bool bUpdated = false ; int diffY = 0 ; int diffX = 0 ; if ( _maxY > Height ) { diffY = point . Y - LastTouch . Y ; if ( diffY > 0 && _minY < Top ) { diffY = System . Math . Min ( diffY , _minY + Top ) ; bUpdated = true ; } else if ( diffY < 0 && _maxY > Height ) { diffY = System . Math . Min ( - diffY , _maxY - _minY - Height ) ; bUpdated = true ; } else { diffY = 0 ; } _moving = true ; } if ( _maxX > Width ) { diffX = point . X - LastTouch . X ; if ( diffX > 0 && _minX < Left ) { diffX = System . Math . Min ( diffX , _minX + Left ) ; bUpdated = true ; } else if ( diffX < 0 && _maxX > Width ) { diffX = System . Math . Min ( - diffX , _maxX - _minX - Width ) ; bUpdated = true ; } else { diffX = 0 ; } _moving = true ; handled = true ; } LastTouch = point ; if ( bUpdated ) { var ptOff = new point ( diffX , diffY ) ; for ( int i = 0 ; i < Children . Length ; i ++ ) { Children [ i ] . UpdateOffsets ( ptOff ) ; } Render ( true ) ; handled = true ; } else if ( _moving ) { Render ( true ) ; } } else { if ( ActiveChild != null && ActiveChild . Touching ) { ActiveChild . SendTouchMove ( this , point ) ; handled = true ; return ; } if ( Children != null ) { for ( int i = Children . Length - 1 ; i >= 0 ; i -- ) { if ( Children [ i ] . Touching || Children [ i ] . HitTest ( point ) ) { Children [ i ] . SendTouchMove ( this , point ) ; } } } } } finally { base . TouchMoveMessage ( sender , point , ref handled ) ; } }
Override this message to handle touch events internally.
Override this message to handle touch events internally .
// Scroll Y // Scroll X //TODO: check if this code shouldn't go to Container (or may be even the whole method?) // Check Controls
sender
object
Object sending the event
Object sending the event
point
point
Point on screen touch event is occurring
Point on screen touch event is occurring
bool
ref
handled
true if the event is handled. Set to true if handled.
true if the event is handled . Set to true if handled .
remarks
Moves the form if touch down was on the form.
If no then forwards the message to  or if null, to the child under point
Moves the form if touch down was on the form . If no then forwards the message to or if null to the child under point