'coding is wonderfull ..simple stuff can bring 5 star features NO LIBS INVOLVED for these features
'thank you b4a
' img the parent canvas , preview the objects panel
'action , the basics
img.Left=X-x0
img.Top=Y-y0
'reference , first point reference
x0=X-img.left
y0=Y-img.Top
'the drawing targets of the drawn object
Dim nx,ny As Int
If img.Left>0 Then
nx=-Abs(img.Left)
If preview.Left>0 Then
nx=nx+Abs(preview.Left)
Else
nx=nx-Abs(preview.Left)
End If
Else
nx=Abs(img.Left)
If preview.Left>0 Then
nx=nx+Abs(preview.Left)
Else
nx=nx-Abs(preview.Left)
End If
End If
If img.Top>0 Then
ny=-Abs(img.Top)
If preview.Top>0 Then
ny=ny+Abs(preview.Top)
Else
ny=ny-Abs(preview.Top)
End If
Else
ny=Abs(img.Top)
If preview.Top>0 Then
ny=ny+Abs(preview.Top)
Else
ny=ny-Abs(preview.Top)
End If
End If