Sub Class_Globals
.
.
Private sx, sy, sx2, sy2 As Int
Private MoveUpper, MoveLeft As Boolean
.
.
End Sub
.
.
.
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
If ((X < SelectionRect.Right) And (X > SelectionRect.Left)) And ((Y >SelectionRect.Top) And (Y < SelectionRect.Bottom)) Then
sx2 = X
sy2 = Y
If (sx2 < (SelectionRect.Width / 2)) Then MoveLeft = True Else MoveLeft = False
If (sy2 < (SelectionRect.Height / 2)) Then MoveUpper = True Else MoveUpper = False
Else
SelectionRect.Left = 0
SelectionRect.Top = 0
SelectionRect.Right = 0
SelectionRect.Bottom = 0
sx = X
sy = Y
sx2 = 0
sy2 = 0
End If
Case pnl.TOUCH_ACTION_MOVE
If (sx2 > 0) Or (sy2 > 0) Then
If MoveLeft Then
SelectionRect.Left = SelectionRect.Left + (X - sx2)
Else
Log(SelectionRect.Right)
SelectionRect.Right = SelectionRect.Right + (X - sx2)
End If
sx2 = X
If MoveUpper Then
SelectionRect.Top = SelectionRect.Top + (Y - sy2)
Else
SelectionRect.Bottom = SelectionRect.Bottom + (Y - sy2)
End If
sy2 = Y
Else
SelectionRect.Left = Min(sx, X)
SelectionRect.Top = Min(sy, Y)
SelectionRect.Right = Max(sx, X)
SelectionRect.Bottom = Max(sy, Y)
End If
Case pnl.TOUCH_ACTION_UP
If IsValidSelection Then
CallSubDelayed(mCallBack, mEventName & "_CropCompleted")
End If
End Select
UpdateTarget
End Sub