PdfViewerMagnifierShouldBeShownFunction typedef

PdfViewerMagnifierShouldBeShownFunction = bool Function(PdfTextSelectionAnchor textAnchor, PdfViewerController controller, PdfViewerSelectionMagnifierParams params)

Function to determine whether the magnifier should be shown or not.

Determine whether the magnifier should be shown for the text anchor, textAnchor, which points to a character in the text.

The following fragment illustrates how to determine whether the magnifier should be shown based on the zoom level:

shouldBeShownForAnchor: (textAnchor, controller, params) {
  final h = textAnchor.direction == PdfTextDirection.vrtl ? textAnchor.rect.size.width : textAnchor.rect.size.height;
  return h * _currentZoom < params.magnifierSizeThreshold;

Implementation

typedef PdfViewerMagnifierShouldBeShownFunction =
    bool Function(
      PdfTextSelectionAnchor textAnchor,
      PdfViewerController controller,
      PdfViewerSelectionMagnifierParams params,
    );