Skip to content

fix: anchor the mobile selection auto scroll on the pointer - #1251

Merged
appflowy merged 2 commits into
AppFlowy-IO:mainfrom
asjqkkkk:fix/mobile/scrolling
Dec 2, 2026
Merged

appflowy merged 2 commits into
AppFlowy-IO:mainfrom
asjqkkkk:fix/mobile/scrolling

Conversation

@asjqkkkk

Copy link
Copy Markdown
Contributor

The auto scroll while dragging a selection handle used the selection rect as its anchor and a 220px band as the trigger region, and the scroll direction was hardcoded per handle type (left handle -> up, right handle -> down).

This made the drag scrolling unreliable:

  • the selection rect is glued to the content, so it never reaches the edge of the viewport and the document stops scrolling as soon as the content moves
  • the trigger region was far too large (a ~110px margin), so the document started scrolling long before the pointer reached the edge
  • a handle could only scroll in one direction
  • the document kept scrolling after the user released the handle

Now the auto scroll is driven by the mobile selection service:

  • the pointer is the anchor, so the document keeps scrolling while the pointer is held at the edge, even when it is not over any text
  • the proxy rect is a square centered on the pointer (80px, so the pointer only has to be within 40px of the edge), and the direction is derived from the position of the pointer, which lets both handles scroll up and down
  • the comfortable reading position scroll (220px margin) is still used for the selection changes that are not part of a drag
  • the auto scroll is stopped when the drag ends, and the drag mode is kept in the selection extra info so that the tail of a drag is not mistaken for a regular selection change

@asjqkkkk
asjqkkkk marked this pull request as draft November 18, 2026 03:22
@asjqkkkk
asjqkkkk force-pushed the fix/mobile/scrolling branch 3 times, most recently from dfde41f to 93f6b09 Compare November 18, 2026 06:46
The auto scroll while dragging a selection handle used the selection rect
as its anchor and a 220px band as the trigger region, and the scroll
direction was hardcoded per handle type (left handle -> up, right handle
-> down).

This made the drag scrolling unreliable:
- the selection rect is glued to the content, so it never reaches the edge
  of the viewport and the document stops scrolling as soon as the content
  moves
- the trigger region was far too large (a ~110px margin), so the document
  started scrolling long before the pointer reached the edge
- a handle could only scroll in one direction
- the document kept scrolling after the user released the handle

Now the auto scroll is driven by the mobile selection service:
- the pointer is the anchor, so the document keeps scrolling while the
  pointer is held at the edge, even when it is not over any text
- the proxy rect is a square centered on the pointer (80px, so the pointer
  only has to be within 40px of the edge), and the direction is derived
  from the position of the pointer, which lets both handles scroll up and
  down
- the comfortable reading position scroll (220px margin) is still used for
  the selection changes that are not part of a drag
- the auto scroll is stopped when the drag ends, and the drag mode is kept
  in the selection extra info so that the tail of a drag is not mistaken
  for a regular selection change

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@asjqkkkk
asjqkkkk force-pushed the fix/mobile/scrolling branch from 93f6b09 to 51d7c46 Compare November 18, 2026 10:16
@asjqkkkk
asjqkkkk marked this pull request as ready for review November 19, 2026 05:45
image 4.11.0 calls ZLibDecoder.decodeLazy, which only exists in
archive >=4.1.0, but pdf caps archive below 4.1.0. The resolved pair
image 4.11.0 + archive 4.0.9 fails to compile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@asjqkkkk
asjqkkkk force-pushed the fix/mobile/scrolling branch from dd007e2 to 98de631 Compare November 26, 2026 07:14
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.13793% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.99%. Comparing base (01eccc6) to head (98de631).

Files with missing lines Patch % Lines
...nt/service/selection/mobile_selection_service.dart 52.00% 12 Missing ⚠️
...omponent/service/scroll/mobile_scroll_service.dart 0.00% 1 Missing ⚠️
...ditor_component/service/scroll_service_widget.dart 90.00% 1 Missing ⚠️
lib/src/editor_state.dart 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1251      +/-   ##
==========================================
+ Coverage   71.50%   71.99%   +0.48%     
==========================================
  Files         334      334              
  Lines       16647    16674      +27     
==========================================
+ Hits        11903    12004     +101     
+ Misses       4744     4670      -74     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@appflowy
appflowy merged commit ed77189 into AppFlowy-IO:main Dec 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants