Sub Pane1_Touch (Action As Int, X As Float, Y As Float)
'assuming only one pointer
Dim thex As Int =Floor(X/ zoomsize)
Dim they As Int =Floor(y/ zoomsize)
Dim screenx As Int
Dim screeny As Int
screenx = thex * zoomsize
screeny = they * zoomsize
Dim lineendactx As Float
Dim lineendacty As Float
Dim actx As Int
Dim acty As Int
actx = thex + topleftx
acty = they + toplefty
Log (Action)
Select Case Action
Case Pane1.TOUCH_ACTION_DOWN
'record when the pointer went down, for backstitch and lines
linestartactx =screenx 'todo ... on the halves
linestartacty =screeny 'todo.. on the halves
linestartx =thex 'todo ... on the halves
linestarty =they 'todo.. on the halves
redraw (True)
Case Pane1.TOUCH_ACTION_MOVE
'Log (x & " " & Y)
If ( lastx <> actx Or lasty <> acty) Then
'Log ("do it")
Select Case drawmode
Case draw_00Normal
rct.Initialize (thex*zoomsize,they * zoomsize, thex*zoomsize + zoomsize,they * zoomsize + zoomsize)
maingrid2.DrawRect (rct, thecolor,True,1)
'other cases removed
End Select
maingrid2.Invalidate
End If
lastx =actx
lasty = acty
Case Pane1.TOUCH_ACTION_UP
redraw (True)
'store a copy for undo
pushacopy 'make a backup
Case Else
' this is debugging so that I can see what is being delivered
Private thecode As Int
thecode = Action
thecode = Pane1.TOUCH_ACTION_MOVE_NOTOUCH
thecode = Pane1.TOUCH_ACTION_UP
thecode = Pane1.TOUCH_ACTION_DOWN
thecode = 1
End Select
maingrid2.Invalidate 'this is the control that does the display of data and should be getting the events
End Sub