Skip to content

Docs: magnifierSizeThreshold is compared against on-screen size, not pt #680

Description

@espresso3389

Found while porting the selection magnifier to TypeScript.

PdfViewerSelectionMagnifierParams.magnifierSizeThreshold is documented as:

If the character size (in pt.) is smaller than this value, the magnifier will be shown.

but the default implementation compares the character extent multiplied by the current zoom, i.e. the on-screen (logical pixel) size, not pt:

// pdf_viewer.dart, _shouldShowMagnifierForAnchor
final h = textAnchor.direction == PdfTextDirection.vrtl ? textAnchor.rect.size.width : textAnchor.rect.size.height;
return h * _currentZoom < params.magnifierSizeThreshold;

The behavior looks intentional (a character that is already huge on screen does not need magnification regardless of its pt size), so this is likely just a doc fix: the comment on magnifierSizeThreshold should say the threshold applies to the zoomed on-screen size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions