defaultDragAnchor function

Offset defaultDragAnchor(
  1. AnchorContext ctx
)

Default focal-point-preserving anchor: the rect.center is positioned so the user's finger stays at the same relative point of the rect as it scales. Used when no Overrides.anchor is configured.

Implementation

Offset defaultDragAnchor(AnchorContext ctx) {
  final anchor = ctx.startFocalPoint - ctx.startRect.center;
  return ctx.currentFocalPoint - anchor * ctx.scale;
}