Skip to content

Free text-drag selection skips the first 1–2 characters on touch devices #665

Description

@goccd

Description

When using free text-drag selection (i.e. dragging directly on the PDF text without first activating selection handles), the selection starts 1–2 characters after the actual touch-down point on touch devices — most noticeably on iPad/tablets.

Root cause

The GestureDetector used for text-drag selection in pdf_viewer.dart relies on the default DragStartBehavior.start, which reports the position in onPanStart only after the touch has moved past the platform's touch slop (kTouchSlop, ~18px). On touch devices this means the reported drag-start position is already 1–2 characters past where the user actually pressed down, so the selection anchor skips the first character(s).

Suggested fix

Set dragStartBehavior: DragStartBehavior.down on that GestureDetector so onPanStart reports the original pointer-down position instead of the post-slop position. This makes the selection start exactly where the user pressed.

Affected file

packages/pdfrx/lib/src/widgets/pdf_viewer.dart — the GestureDetector wrapping onPanStart/onPanUpdate/onPanEnd for free text-drag selection.

I'll open a PR with this fix shortly.

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