Private Sub pnl_Touch (Action As Int, X As Float, Y As Float)
x = (x - OffsetX)/ xui.Scale
y = (y - OffsetY) / xui.Scale
x = Max(0, Min(ColorBC.mWidth - 1, X))
y = Max(0, Min(ColorBC.mHeight - 1, Y))
Select Action
Case pnl.TOUCH_ACTION_DOWN
SelectionRect.Left = 0
SelectionRect.Top = 0
SelectionRect.Right = 0
SelectionRect.Bottom = 0
sx = X
sy = Y
Case pnl.TOUCH_ACTION_MOVE
SelectionRect.Left = Min(sx, X)
SelectionRect.Top = Min(sy, Y)
SelectionRect.Right = Max(sx, X)
SelectionRect.Bottom = Max(sy, Y)
Case pnl.TOUCH_ACTION_UP
If IsValidSelection Then
CallSubDelayed(mCallBack, mEventName & "_CropCompleted")
End If
End Select
UpdateTarget
End Sub