Skip to content

[mobile][photos] Enable text selection during zoom#10023

Open
Amrithesh-Kakkoth wants to merge 3 commits intoente-io:mainfrom
Amrithesh-Kakkoth:feat/zoomfix
Open

[mobile][photos] Enable text selection during zoom#10023
Amrithesh-Kakkoth wants to merge 3 commits intoente-io:mainfrom
Amrithesh-Kakkoth:feat/zoomfix

Conversation

@Amrithesh-Kakkoth
Copy link
Copy Markdown
Contributor

  • Add ZoomTransform (scale + offset) propagated via InheritedDetailPageState
  • Subscribe to PhotoViewController.outputStateStream in ZoomableImage to push continuous transform updates on every gesture frame
  • Wrap OCR overlay in a Transform that mirrors the zoom instead of hiding it; text boundaries stay aligned with the image during pinch-to-zoom
  • Overlay becomes interactive 200ms after gesture settles
  • Use a Listener to count active pointers; force IgnorePointer when 2+ fingers are down so pinch gestures always reach PhotoView
  • Increase teardrop handle hitbox from 52 to 72px for easier grabbing

- Add ZoomTransform (scale + offset) propagated via InheritedDetailPageState
- Subscribe to PhotoViewController.outputStateStream in ZoomableImage to
  push continuous transform updates on every gesture frame
- Wrap OCR overlay in a Transform that mirrors the zoom instead of hiding
  it; text boundaries stay aligned with the image during pinch-to-zoom
- Overlay becomes interactive 200ms after gesture settles
- Use a Listener to count active pointers; force IgnorePointer when 2+
  fingers are down so pinch gestures always reach PhotoView
- Increase teardrop handle hitbox from 52 to 72px for easier grabbing
Resolve conflict in zoomable_image.dart: keep zoom transform tracking
(zoomTransformNotifier reset + initialScale reset) from our branch,
drop debug print from upstream.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80fde5b732

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@Amrithesh-Kakkoth
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dbbd2aa14

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@laurenspriem
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dbbd2aa14

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +488 to +493
unawaited(_zoomStreamSubscription?.cancel());
_photoViewController = PhotoViewController(
initialPosition: currentPosition,
initialScale: scale,
);
_subscribeToZoomStream();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reset zoom baseline after swapping PhotoViewController

When _updatePhotoViewController replaces _photoViewController for a higher-resolution image during an active zoom, the code resubscribes to outputStateStream but never resets _initialScale. Because _subscribeToZoomStream computes relativeScale as value.scale / _initialScale, this reuses a baseline from the old controller even though the new controller’s scale was renormalized (scale is adjusted by image-width ratio). In practice, users who are zoomed in when the final image loads can get a mis-scaled OCR overlay (text bounds drift) until zoom returns to initial state.

Useful? React with 👍 / 👎.

- Reset _initialScale when swapping PhotoViewController in
  _updatePhotoViewController so the new controller's scale range
  is used as the baseline, preventing overlay transform jumps when
  the final image loads while the user is zoomed in.

- Fix overlay settle debounce not restarting after a post-settle
  re-zoom (e.g. double-tap). Previously the !_zoomGestureSettled
  guard meant the 200ms timer was never restarted once settled,
  leaving the overlay interactive during subsequent zoom animations.
  Now every incoming transform resets the flag and restarts the
  debounce within the same builder pass.
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