Einzelnen Beitrag anzeigen

flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#1

Wie sende ich TImage-Mauskoordinaten korrekt an Canvas moveTo () / lineTo ()

  Alt 25. Dez 2019, 21:44
Delphi-Version: 10 Seattle
Ich habe einen Android-Code gefunden, mit dem Ihr Ziel einen L-förmigen Ziehweg simuliert: 200 Pixel rechts, dann 200 Pixel unten. Diese Werte wurden im Code vordefiniert. Wie kann dies mit den Mauskoordinaten einer TImage-Komponente und Ihren Ereignissen ("Maus runter", "Maus hoch" usw.) erreicht werden?

Ich brauche dies, um in meinem Beispiel für Remote-Zugriff (Delphi-Controller > Android-Client) zu implementieren.

Hier ist der Android-Code >

Delphi-Quellcode:
// Simulates an L-shaped drag path: 200 pixels right, then 200 pixels down.
Path path = new Path();
path.moveTo(200,200);
path.lineTo(400,200);

final GestureDescription.StrokeDescription sd = new GestureDescription.StrokeDescription(path, 0, 500, true);

// The starting point of the second path must match
// the ending point of the first path.
Path path2 = new Path();
path2.moveTo(400,200);
path2.lineTo(400,400);

final GestureDescription.StrokeDescription sd2 = sd.continueStroke(path2, 0, 500, false); // 0.5 second

HongBaoService.mService.dispatchGesture(new GestureDescription.Builder().addStroke(sd).build(), new AccessibilityService.GestureResultCallback(){

@Override
public void onCompleted(GestureDescription gestureDescription){
super.onCompleted(gestureDescription);
HongBaoService.mService.dispatchGesture(new GestureDescription.Builder().addStroke(sd2).build(),null,null);
}


@Override
public void onCancelled(GestureDescription gestureDescription){
super.onCancelled(gestureDescription);
}

},null);
  Mit Zitat antworten Zitat