Skip to content

Add WebAssembly (Wasm) support for zoomable module.#132

Merged
saket merged 1 commit intosaket:trunkfrom
Sieveo:trunk
Mar 28, 2025
Merged

Add WebAssembly (Wasm) support for zoomable module.#132
saket merged 1 commit intosaket:trunkfrom
Sieveo:trunk

Conversation

@Phaestion
Copy link
Contributor

Hi @saket

Thanks for an awesome library! We're developing quite a bit of Kotlin Multiplatform apps and we have a strong focus on rendering documents using KMP. Even though most of our users would typically use Android and iOS we have quite a bit of internal config tools that we run on web via WASM.

Given that your library doesn't support WASM yet we couldn't use it for our base libraries that our products and ultimately our config tools depend on.

So I endeavoured to add WASM support specifically for the zoomable module, it turned out to be pretty easy. The build seems to work fine for all existing modules. I built a snapshot version and published to mavenLocal and tested it out with one of our configuration tools, this seems to work well with the double click to zoom function.

See attached recording showing it works in browser with one of our config tools.
Templar config tool + telephoto demo

Copy link
Owner

@saket saket left a comment

Choose a reason for hiding this comment

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

This is great, thank you @Phaestion!

@saket saket enabled auto-merge (rebase) March 7, 2025 22:12
@emulator-wtf
Copy link

emulator-wtf bot commented Mar 7, 2025

:zoomable-image:core - Tests were flaky!

✅ 163 passed / ⚠️ 1 flaky / 🚫 1 skipped

First failure encountered:

me.saket.telephoto.zoomable.ZoomableImageTest.do_not_incorrectly_retain_pan_when_state_is_restored click for details

java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
at androidx.compose.runtime.snapshots.SnapshotKt.readError(Snapshot.kt:2059)
at androidx.compose.runtime.snapshots.SnapshotKt.current(Snapshot.kt:2402)
at androidx.compose.runtime.DerivedSnapshotState.current(DerivedState.kt:167)
at androidx.compose.runtime.DerivedSnapshotState$ResultRecord.readableHash(DerivedState.kt:142)
at androidx.compose.runtime.DerivedSnapshotState$ResultRecord.isValid(DerivedState.kt:114)
at androidx.compose.runtime.DerivedSnapshotState.currentRecord(DerivedState.kt:175)
at androidx.compose.runtime.DerivedSnapshotState.current(DerivedState.kt:167)
at androidx.compose.runtime.DerivedSnapshotState$ResultRecord.readableHash(DerivedState.kt:142)
at androidx.compose.runtime.DerivedSnapshotState$ResultRecord.isValid(DerivedState.kt:114)
at androidx.compose.runtime.DerivedSnapshotState.currentRecord(DerivedState.kt:175)
at androidx.compose.runtime.DerivedSnapshotState.getValue(DerivedState.kt:272)
at me.saket.telephoto.zoomable.ZoomableImageState.isImageDisplayedInFullQuality(ZoomableImageState.kt:58)
at me.saket.telephoto.zoomable.ZoomableImageTest$do_not_incorrectly_retain_pan_when_state_is_restored$5.invoke(ZoomableImageTest.kt:338)
at me.saket.telephoto.zoomable.ZoomableImageTest$do_not_incorrectly_retain_pan_when_state_is_restored$5.invoke(ZoomableImageTest.kt:337)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment$AndroidComposeUiTestImpl.waitUntil(ComposeUiTest.android.kt:434)
at androidx.compose.ui.test.junit4.AndroidComposeTestRule.waitUntil(AndroidComposeTestRule.android.kt:306)
at me.saket.telephoto.util.WaitUntilKt.waitUntil-8Mi8wO0(waitUntil.kt:7)
at me.saket.telephoto.zoomable.ZoomableImageTest.do_not_incorrectly_retain_pan_when_state_is_restored(ZoomableImageTest.kt:337)

There were more failures, click for details

@Phaestion
Copy link
Contributor Author

Hi @saket. I see one screenshot test failed, but this does not look like this has anything to do with the wasm parts I added.
Is that just a flaky test? I cannot seem to run that test locally. Do you think it has something to do with the parts I added? Or is this just a fluke?

@saket saket disabled auto-merge March 28, 2025 15:19
@saket
Copy link
Owner

saket commented Mar 28, 2025

Yea I'm not sure what's up with that test. I was hoping to set aside some time, but life has kept me busy in the past few weeks. Let me merge this -- I'll investigate the test later.

@saket saket merged commit 5ccba91 into saket:trunk Mar 28, 2025
4 of 6 checks passed
@Phaestion
Copy link
Contributor Author

Thanks! I totally know what you mean @saket. Could you make a release? I would very much like to use an upstream release in our apps.

@saket
Copy link
Owner

saket commented May 20, 2025

@Phaestion 0.16.0 is now available: https://github.com/saket/telephoto/releases/tag/0.16.0

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