keepMousePosition method

void keepMousePosition(
  1. PointerScrollInfo? info,
  2. Vector2 opg,
  3. double zoomDelta,
  4. Viewfinder vf,
  5. double oz, [
  6. Vector2? wp,
])

Implementation

void keepMousePosition(
  PointerScrollInfo? info,
  Vector2 opg,
  double zoomDelta,
  Viewfinder vf,
  double oz, [
  Vector2? wp,
]) {
  assert(
    info != null || wp != null,
    'scroll info and widgetPosition cannot be null at the same time',
  );
  wp = wp ?? info!.eventPosition.widget;
  var wpg = wp - opg;
  var wpgDelta = wpg * zoomDelta;
  var npg = vf.localToGlobal(Vector2.zero());
  vf.position += (npg - opg + wpgDelta / oz) / vf.zoom;
}