convertGlobalToLocalCoordinate method

Vector2 convertGlobalToLocalCoordinate(
  1. Vector2 point
)

Converts a global coordinate (i.e. w.r.t. the app itself) to a local coordinate (i.e. w.r.t. he game widget). If the widget occupies the whole app ("full screen" games), or is not attached to Flutter, this operation is the identity.

Implementation

Vector2 convertGlobalToLocalCoordinate(Vector2 point) {
  if (!isAttached) {
    return point.clone();
  }
  return _gameRenderBox!.globalToLocal(point.toOffset()).toVector2();
}