GestureEvent.fromPointerEvent constructor
GestureEvent.fromPointerEvent(
- PointerEvent event, {
- required Vector2 screenToWorld(
- Vector2 position
- required Vector2 globalToViewportPosition(
- Vector2 position
Implementation
factory GestureEvent.fromPointerEvent(
PointerEvent event, {
required Vector2 Function(Vector2 position) screenToWorld,
required Vector2 Function(Vector2 position) globalToViewportPosition,
}) {
final eventPosition = event.localPosition.toVector2();
final screenPosition = globalToViewportPosition(eventPosition);
return GestureEvent(
pointer: event.pointer,
kind: event.kind,
screenPosition: screenPosition,
worldPosition: screenToWorld(eventPosition),
);
}