public void OnTouchEffectAction(SKPoint point, TouchActionEventArgs args) { switch (args.Type) { case TouchActionType.Pressed: if (Contains(point.X, point.Y) && !IsBeingDragged) { IsBeingDragged = true; TouchId = args.Id; OldPosition = point; } break; case TouchActionType.Moved: if (IsBeingDragged && TouchId == args.Id) { float dx = IsDraggableX ? point.X - OldPosition.X : 0; float dy = IsDraggableY ? point.Y - OldPosition.Y : 0; OffsetX += dx; OffsetY += dy; OldPosition = point; UpdatePosition(); } break; case TouchActionType.Released: if (IsBeingDragged && TouchId == args.Id) { IsBeingDragged = false; } break; } }
public void OnTouchAction(Element element, TouchActionEventArgs args) { TouchAction?.Invoke(element, args); }