Private Sub pnl_Touch (Action As Int, X1 As Float, Y1 As Float)
If Action = pnl.TOUCH_ACTION_DOWN Or TouchDown = False Then
StartLeft = pnlBackground.Left
StartTop = pnlBackground.Top
StartX = X1
StartY = Y1
TouchDown = True
If xui.IsB4A = False Then ClickStart = DateTime.Now
Else If Action = pnl.TOUCH_ACTION_MOVE And TouchDown Then
pnlBackground.Left = Min(0.5 * mBase.Width, StartLeft + 1.2 * (X1 - StartX))
pnlBackground.Left = Max(-(pnlBackground.Width - 0.5 * mBase.Width), pnlBackground.Left)
pnlBackground.Top = Min(0.5 * mBase.Height, StartTop + 1.2 * (Y1 - StartY))
pnlBackground.Top = Max(-(pnlBackground.Height - 0.5 * mBase.Height), pnlBackground.Top)
SetImageViewLayout
Else if Action = pnl.TOUCH_ACTION_UP Then
TouchDown = False
If DateTime.Now - ClickStart < ClickThreshold And DisableClickEvent = False Then
If xui.SubExists(mCallBack, mEventName & "_Click", 0) Then
iX = X1 ' <---
iY = Y1 ' <---
CallSub(mCallBack, mEventName & "_Click")
End If
End If
Else
'Log("touch cancelled")
End If
End Sub