-
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
Zoomable modifier looses state after ZoomableState gets disposed and recreated #72
Comments
Also, flings no longer work in this situation either |
Is this no longer an issue? |
It is. I honestly don't know why it's closed. I don't remember closing it. Maybe a missclick |
Ah, I see. I referenced this issue in a commit to a private repo with a message containing |
I think I have the same problem with the SubSamplingImage (with the I've changed the sample app a bit to reproduce the issue: kvn-stgl@b1b74ac Here is also a short video: Screen_recording_20240306_105618.mp4 |
@kvn-stgl I was able to reproduce the problem using your sample, thank you! This is related to #70. @kvn-stgl and @CalamityDeadshot I'm also curious to learn your reasons for not using |
1749177 was deployed to maven. Can you please try out |
My gallery displays multiple types of content, like photos and videos, so it just makes more sense to use |
I no longer experience this issue with |
@CalamityDeadshot glad to hear!
This is exactly the usecase I wanted to support with having a decoupled val zoomableState = rememberZoomableState()
when (media) {
is Image -> {
ZoomableAsyncImage(
model = media.imageUrl,
state = rememberZoomableImageState(zoomableState),
)
}
is Video -> {
ZoomableVideoPlayer(
model = media.videoUrl,
state = rememberZoomableExoState(zoomableState),
)
}
} I'm going ahead and closing this issue, but let's continue this discussion because I want to nudge developers away from maintaining their own implementation of |
It's more of a matter of interoperability for me, as my gallery uses val contentModifier = Modifier
.fillMaxSize()
.zoomable(
state = zoomableState,
onClick = { onClick() }
)
when (model) {
is Painter -> {
// ...
Image(
painter = model,
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = contentModifier,
)
}
is ComposeModel -> {
// ...
Box(
modifier = contentModifier,
contentAlignment = Alignment.Center
) {
model.content()
}
}
} This comes from a fork of this gallery which had its own transform gestures implementation, but it broke horribly (with a fatal crash) after I updated |
Got it. Thanks for explaining! |
…1308) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto) | dependencies | minor | `0.8.0` -> `0.9.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>saket/telephoto (me.saket.telephoto:zoomable-image-coil)</summary> ### [`v0.9.0`](https://togithub.com/saket/telephoto/releases/tag/0.9.0) [Compare Source](https://togithub.com/saket/telephoto/compare/0.8.0...0.9.0) Bug fixes - [https://github.com/saket/telephoto/issues/70](https://togithub.com/saket/telephoto/issues/70), [https://github.com/saket/telephoto/issues/72](https://togithub.com/saket/telephoto/issues/72): Zoomable modifier looses state after ZoomableState gets disposed and recreated Dependency updates - Compose compiler: 1.5.10 - Compose UI: 1.6.3 - Compose multiplatform: 1.6.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI3MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
…1308) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto) | dependencies | minor | `0.8.0` -> `0.9.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>saket/telephoto (me.saket.telephoto:zoomable-image-coil)</summary> ### [`v0.9.0`](https://togithub.com/saket/telephoto/releases/tag/0.9.0) [Compare Source](https://togithub.com/saket/telephoto/compare/0.8.0...0.9.0) Bug fixes - [https://github.com/saket/telephoto/issues/70](https://togithub.com/saket/telephoto/issues/70), [https://github.com/saket/telephoto/issues/72](https://togithub.com/saket/telephoto/issues/72): Zoomable modifier looses state after ZoomableState gets disposed and recreated Dependency updates - Compose compiler: 1.5.10 - Compose UI: 1.6.3 - Compose multiplatform: 1.6.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI3MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto) | `0.8.0` -> `0.9.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image-coil/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image-coil/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image-coil/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image-coil/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [me.saket.telephoto:zoomable-image](https://togithub.com/saket/telephoto) | `0.8.0` -> `0.9.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [me.saket.telephoto:zoomable](https://togithub.com/saket/telephoto) | `0.8.0` -> `0.9.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable/0.8.0/0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>saket/telephoto (me.saket.telephoto:zoomable-image-coil)</summary> ### [`v0.9.0`](https://togithub.com/saket/telephoto/releases/tag/0.9.0) [Compare Source](https://togithub.com/saket/telephoto/compare/0.8.0...0.9.0) Bug fixes - [https://github.com/saket/telephoto/issues/70](https://togithub.com/saket/telephoto/issues/70), [https://github.com/saket/telephoto/issues/72](https://togithub.com/saket/telephoto/issues/72): Zoomable modifier looses state after ZoomableState gets disposed and recreated Dependency updates - Compose compiler: 1.5.10 - Compose UI: 1.6.3 - Compose multiplatform: 1.6.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ZacSweers/CatchUp). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto) | `0.9.0` -> `0.10.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image-coil/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image-coil/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image-coil/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image-coil/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [me.saket.telephoto:zoomable-image](https://togithub.com/saket/telephoto) | `0.9.0` -> `0.10.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable-image/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable-image/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable-image/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable-image/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [me.saket.telephoto:zoomable](https://togithub.com/saket/telephoto) | `0.9.0` -> `0.10.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/me.saket.telephoto:zoomable/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/me.saket.telephoto:zoomable/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/me.saket.telephoto:zoomable/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/me.saket.telephoto:zoomable/0.9.0/0.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>saket/telephoto (me.saket.telephoto:zoomable-image-coil)</summary> ### [`v0.10.0`](https://togithub.com/saket/telephoto/releases/tag/0.10.0) [Compare Source](https://togithub.com/saket/telephoto/compare/0.9.0...0.10.0) Bug fixes - [https://github.com/saket/telephoto/issues/70](https://togithub.com/saket/telephoto/issues/70), [https://github.com/saket/telephoto/issues/72](https://togithub.com/saket/telephoto/issues/72): Correctly update `ZoomableState` when `Modifier.zoomable()` is reused - [https://github.com/saket/telephoto/issues/71](https://togithub.com/saket/telephoto/issues/71): Make sure velocity tracker tracks the same pointer - [https://github.com/saket/telephoto/issues/81](https://togithub.com/saket/telephoto/issues/81): Read maximum fling velocity from composition locals Dependency updates - Compose compiler: 1.5.11 - Compose UI: 1.6.4 - Compose multiplatform: 1.6.4 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ZacSweers/CatchUp). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…1339) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [me.saket.telephoto:zoomable-image-coil](https://togithub.com/saket/telephoto) | dependencies | minor | `0.9.0` -> `0.10.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>saket/telephoto (me.saket.telephoto:zoomable-image-coil)</summary> ### [`v0.10.0`](https://togithub.com/saket/telephoto/releases/tag/0.10.0) [Compare Source](https://togithub.com/saket/telephoto/compare/0.9.0...0.10.0) Bug fixes - [https://github.com/saket/telephoto/issues/70](https://togithub.com/saket/telephoto/issues/70), [https://github.com/saket/telephoto/issues/72](https://togithub.com/saket/telephoto/issues/72): Correctly update `ZoomableState` when `Modifier.zoomable()` is reused - [https://github.com/saket/telephoto/issues/71](https://togithub.com/saket/telephoto/issues/71): Make sure velocity tracker tracks the same pointer - [https://github.com/saket/telephoto/issues/81](https://togithub.com/saket/telephoto/issues/81): Read maximum fling velocity from composition locals Dependency updates - Compose compiler: 1.5.11 - Compose UI: 1.6.4 - Compose multiplatform: 1.6.4 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yOTYuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI5Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
I'm using
Modifier.zoomable
inside aHorizontalPager
- a pretty standard use case.My issue is that after a page is composed for a second time
RealZoomableState
looses itsgestureState
synchronization for some reason, so whenZoomableNode
'sonTransformStopped
callsstate.isZoomOutsideRange()
itsval userZoomFactor = gestureState?.userZoomFactor
pretty much equals1
for me, sostate.smoothlySettleZoomOnGestureEnd()
is not called whatsoever, and no zoom bounds are enforced.A minimal repro with
coil
:Here's how it looks for users:
video5417946174109795186.mp4
The same thing happens with pages that are composed for the first time if I scroll enough pages forwards/backwards from
initialPage
. Is my usage incorrect in some way?Versions:
The text was updated successfully, but these errors were encountered: