-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep ZoomState and position if loading Images in same screen. #104
Comments
Is the overall goal here to retain the pan and zoom state across image changes? If so, I'd definitely like to support it but it has proven to be non-trivial in my past attempts. For your thumbnails, have you tried using coil's placeholder for displaying them? Telephoto will smoothly swap out placeholders when their full quality versions are ready and even block zoom events until then. https://saket.github.io/telephoto/zoomableimage/#placeholders For smoothly transitioning from a preview image to its full-sized image, is the image resolution known before hand for the full-sized variant? |
Hi saket, thanks for you reply.
In my use case, it is essential to provide good UX. We don't want to reset the current zoom state as soon the fullSize downloaded. If you see my video, each quality transition: thumbnail -> preview -> fullSize, the central position is changing. I guess it is caused by the different size of picture (thumbnail/preview/fullsize). But I have no idea to handle it.
Great to know!
Unfortunately, we don't know. Again, thank you so much. |
Yeah it'd be great @saket if Telephoto can support it. |
Gotcha. Yea I wish Coil had support for dynamic thumbnails.
Noted. In theory it should be possible to retain the zoom and offset values if the new image shares the same aspect ratio as the old one. I'll try working on this soon. |
Thank you very much. |
Hi Saket, any progress on this? |
I unfortunately haven't been able to find time to work on this yet. I made some progress in the last release by adapting zoom & pan values to a new viewport size: Lines 15 to 24 in edd9974
I think we can write something similar for adapting to new content sizes. Wanna help me out? |
Hello, my job has changed and I am unable to support the work. I will notify my colleagues for follow-up. Thank you very much. |
Hi @saket,
Here's the sample code Screen record: Restore.offset.mp4 |
Good to know. We can copy over that logic to |
I applied the logic based on aspect ratio, and it actually worked nicely! The transition to hi-res image is also extremely smooth (3-4th second of the video). Here's the commit. However, there’s one existing issue that needs to be addressed. After the new high-resolution image is loaded, when you pan on it(drag by finger/apply gesture), it resets the offset, causing a jumping effect (6th second of the video). I was wondering if the previousOffset or userOffset for new contentSize could be handled inside GestureState instead of contentTransformation. Any thoughts? Screen_Recording_20241129_160751_Telephoto.mp4Based on the logs, another approach could be by updating UserOffset based on new image's scale factor compared to old image's UserOffset.
By the way, I'm really enjoying working on it. You've done an amazing job with this library ❤️ |
Hello @saket, Currently, when a new high-resolution image is loaded, the
Here's the code changes I'm pretty sure you might have a better way to handle this, specially considering other edge cases you’re aware of. This is just the basic idea. Screen_Recording_20241130_210418_Telephoto.mp4 |
Hi @saket , have you got the chance to look at it? |
Sorry, no, I haven't been able to find any time to work on telephoto since our last conversation. Your code looks very helpful though. I should be able to adapt it to something. |
Thank you. We are eagerly waiting for a release of Telephoto with this functionality 😄 |
Done! Can you give it a try by using |
Hello Saket, thanks for taking time to work in it. I've ran the app from trunk branch, but it seems there're some issues with the pan offset retention. You can find the sample code here. |
Pan.issue3.mp4 |
Interesting, the code works fine for |
Correct. Also there's a slight shake when I pan on the image that was loaded at last. |
Hi @saket , should we reopen this ticket as it's not fully working? |
Yea let's do that |
Hello my situation that I have ImagePreview pager and I will show thumbnail first then Preview then fullSizeImage (3 different paths), which require 3 downloading process in same screen. I am wondering whether it is possible to support
Now my code like this
I know it may be not easy, so could you please guide if I can custom this logic in somewhere? Thank you very much.
flash.and.position.move.mp4
The text was updated successfully, but these errors were encountered: