diff --git a/zoomable/api/api.txt b/zoomable/api/api.txt index 75361122..f4cb5829 100644 --- a/zoomable/api/api.txt +++ b/zoomable/api/api.txt @@ -1,6 +1,15 @@ // Signature format: 4.0 package me.saket.telephoto.zoomable { + @androidx.compose.runtime.Immutable public fun interface DoubleClickToZoomListener { + method public suspend Object? onDoubleClick(me.saket.telephoto.zoomable.ZoomableState state, long centroid, kotlin.coroutines.Continuation); + } + + public static final class DoubleClickToZoomListener.ToggleBetweenMinAndMax implements me.saket.telephoto.zoomable.DoubleClickToZoomListener { + method public suspend Object? onDoubleClick(me.saket.telephoto.zoomable.ZoomableState state, long centroid, kotlin.coroutines.Continuation); + field public static final me.saket.telephoto.zoomable.DoubleClickToZoomListener.ToggleBetweenMinAndMax INSTANCE; + } + @androidx.compose.runtime.Immutable public interface HardwareShortcutDetector { method public me.saket.telephoto.zoomable.HardwareShortcutDetector.ShortcutEvent? detectKey(android.view.KeyEvent event); method public me.saket.telephoto.zoomable.HardwareShortcutDetector.ShortcutEvent? detectScroll(androidx.compose.ui.input.pointer.PointerEvent event); @@ -133,7 +142,8 @@ package me.saket.telephoto.zoomable { } public final class ZoomableKt { - method public static androidx.compose.ui.Modifier zoomable(androidx.compose.ui.Modifier, me.saket.telephoto.zoomable.ZoomableState state, optional boolean enabled, optional kotlin.jvm.functions.Function1? onClick, optional kotlin.jvm.functions.Function1? onLongClick, optional boolean clipToBounds); + method @Deprecated public static androidx.compose.ui.Modifier zoomable(androidx.compose.ui.Modifier, me.saket.telephoto.zoomable.ZoomableState state, optional boolean enabled, optional kotlin.jvm.functions.Function1? onClick, optional kotlin.jvm.functions.Function1? onLongClick, optional boolean clipToBounds); + method public static androidx.compose.ui.Modifier zoomable(androidx.compose.ui.Modifier, me.saket.telephoto.zoomable.ZoomableState state, optional boolean enabled, optional kotlin.jvm.functions.Function1? onClick, optional kotlin.jvm.functions.Function1? onLongClick, optional boolean clipToBounds, optional me.saket.telephoto.zoomable.DoubleClickToZoomListener onDoubleClick); } @androidx.compose.runtime.Stable public sealed interface ZoomableState { @@ -143,19 +153,31 @@ package me.saket.telephoto.zoomable { method public me.saket.telephoto.zoomable.ZoomableContentTransformation getContentTransformation(); method public androidx.compose.ui.geometry.Rect getTransformedContentBounds(); method @FloatRange(from=0.0, to=1.0) public Float? getZoomFraction(); - method public suspend Object? panBy(long offset, optional boolean withAnimation, optional kotlin.coroutines.Continuation); - method public suspend Object? resetZoom(optional boolean withAnimation, optional kotlin.coroutines.Continuation); + method public me.saket.telephoto.zoomable.ZoomSpec getZoomSpec(); + method public suspend Object? panBy(long offset, optional androidx.compose.animation.core.AnimationSpec animationSpec, optional kotlin.coroutines.Continuation); + method public suspend Object? resetZoom(optional androidx.compose.animation.core.AnimationSpec animationSpec, optional kotlin.coroutines.Continuation); + method @Deprecated public default suspend Object? resetZoom(boolean withAnimation, kotlin.coroutines.Continuation); method public void setAutoApplyTransformations(boolean); method public void setContentAlignment(androidx.compose.ui.Alignment); method public suspend Object? setContentLocation(me.saket.telephoto.zoomable.ZoomableContentLocation location, kotlin.coroutines.Continuation); method public void setContentScale(androidx.compose.ui.layout.ContentScale); - method public suspend Object? zoomBy(float zoomFactor, optional long centroid, optional boolean withAnimation, optional kotlin.coroutines.Continuation); + method public suspend Object? zoomBy(float zoomFactor, optional long centroid, optional androidx.compose.animation.core.AnimationSpec animationSpec, optional kotlin.coroutines.Continuation); + method public suspend Object? zoomTo(float zoomFactor, optional long centroid, optional androidx.compose.animation.core.AnimationSpec animationSpec, optional kotlin.coroutines.Continuation); property public abstract boolean autoApplyTransformations; property public abstract androidx.compose.ui.Alignment contentAlignment; property public abstract androidx.compose.ui.layout.ContentScale contentScale; property public abstract me.saket.telephoto.zoomable.ZoomableContentTransformation contentTransformation; property public abstract androidx.compose.ui.geometry.Rect transformedContentBounds; property @FloatRange(from=0.0, to=1.0) public abstract Float? zoomFraction; + property public abstract me.saket.telephoto.zoomable.ZoomSpec zoomSpec; + field public static final me.saket.telephoto.zoomable.ZoomableState.Companion Companion; + } + + public static final class ZoomableState.Companion { + method public androidx.compose.animation.core.AnimationSpec getDefaultPanAnimationSpec(); + method public androidx.compose.animation.core.AnimationSpec getDefaultZoomAnimationSpec(); + property public final androidx.compose.animation.core.AnimationSpec DefaultPanAnimationSpec; + property public final androidx.compose.animation.core.AnimationSpec DefaultZoomAnimationSpec; } public final class ZoomableStateKt { diff --git a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt index f6d8bfcd..6e0ee7e7 100644 --- a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt +++ b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt @@ -76,6 +76,24 @@ fun Modifier.zoomable( } } +@Deprecated("Kept for binary compatibility", level = DeprecationLevel.HIDDEN) +fun Modifier.zoomable( + state: ZoomableState, + enabled: Boolean = true, + onClick: ((Offset) -> Unit)? = null, + onLongClick: ((Offset) -> Unit)? = null, + clipToBounds: Boolean = true, +): Modifier { + return this.zoomable( + state = state, + enabled = enabled, + onClick = onClick, + onLongClick = onLongClick, + clipToBounds = clipToBounds, + onDoubleClick = DoubleClickToZoomListener.ToggleBetweenMinAndMax, + ) +} + private data class ZoomableElement( private val state: RealZoomableState, private val enabled: Boolean, diff --git a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableState.kt b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableState.kt index b3d2eb56..d6ad8f71 100644 --- a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableState.kt +++ b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/ZoomableState.kt @@ -190,8 +190,8 @@ sealed interface ZoomableState { ) companion object { - val DefaultZoomAnimationSpec get() = spring(stiffness = Spring.StiffnessMediumLow) - val DefaultPanAnimationSpec get() = spring(stiffness = Spring.StiffnessMediumLow) + val DefaultZoomAnimationSpec: AnimationSpec get() = spring(stiffness = Spring.StiffnessMediumLow) + val DefaultPanAnimationSpec: AnimationSpec get() = spring(stiffness = Spring.StiffnessMediumLow) } }