zoom static method
Simulates a zoom gesture.
Example:
await EaseSimulator.zoom(Offset(100, 200), Offset(200, 300));
Implementation
static Future zoom(Offset focalPoint1, Offset focalPoint2) async {
final initialDistance = (focalPoint2 - focalPoint1).distance;
final delta = Offset(0, initialDistance * 0.1);
await _handlePointerEvent(PointerAddedEvent(
pointer: 11,
position: focalPoint1,
kind: PointerDeviceKind.touch,
));
await _handlePointerEvent(PointerAddedEvent(
pointer: 12,
position: focalPoint2 + delta,
kind: PointerDeviceKind.touch,
));
await Future.delayed(const Duration(milliseconds: 500));
await _handlePointerEvent(PointerMoveEvent(
pointer: 11,
position: focalPoint1,
kind: PointerDeviceKind.touch,
synthesized: true,
));
await _handlePointerEvent(PointerMoveEvent(
pointer: 12,
position: focalPoint2,
kind: PointerDeviceKind.touch,
synthesized: true,
));
await Future.delayed(const Duration(milliseconds: 500));
await _handlePointerEvent(PointerRemovedEvent(
pointer: 11,
kind: PointerDeviceKind.touch,
));
await _handlePointerEvent(PointerRemovedEvent(
pointer: 12,
kind: PointerDeviceKind.touch,
));
}