keepMousePosition method
void
keepMousePosition(
- PointerScrollInfo? info,
- Vector2 opg,
- double zoomDelta,
- Viewfinder vf,
- double oz, [
- 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;
}