diff --git a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickListener.kt b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickToZoomListener.kt similarity index 82% rename from zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickListener.kt rename to zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickToZoomListener.kt index 041b2446..f8ce6603 100644 --- a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickListener.kt +++ b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/DoubleClickToZoomListener.kt @@ -2,7 +2,7 @@ package me.saket.telephoto.zoomable import androidx.compose.runtime.Immutable import androidx.compose.ui.geometry.Offset -import me.saket.telephoto.zoomable.DoubleClickListener.ToggleBetweenMinAndMax +import me.saket.telephoto.zoomable.DoubleClickToZoomListener.ToggleBetweenMinAndMax import me.saket.telephoto.zoomable.internal.maxScale /** @@ -10,7 +10,7 @@ import me.saket.telephoto.zoomable.internal.maxScale * By default, [ToggleBetweenMinAndMax] is used. */ @Immutable -fun interface DoubleClickListener { +fun interface DoubleClickToZoomListener { suspend fun onDoubleClick( state: ZoomableState, centroid: Offset, @@ -19,7 +19,7 @@ fun interface DoubleClickListener { /** * Toggles between [ZoomSpec.maxZoomFactor] and the minimum zoom factor on double clicks. */ - data object ToggleBetweenMinAndMax : DoubleClickListener { + data object ToggleBetweenMinAndMax : DoubleClickToZoomListener { override suspend fun onDoubleClick(state: ZoomableState, centroid: Offset) { val zoomFraction = state.zoomFraction ?: return // Content isn't ready yet. state.zoomTo( 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 e2a34eca..f6d8bfcd 100644 --- a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt +++ b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt @@ -49,7 +49,7 @@ fun Modifier.zoomable( onClick: ((Offset) -> Unit)? = null, onLongClick: ((Offset) -> Unit)? = null, clipToBounds: Boolean = true, - onDoubleClick: DoubleClickListener = DoubleClickListener.ToggleBetweenMinAndMax, + onDoubleClick: DoubleClickToZoomListener = DoubleClickToZoomListener.ToggleBetweenMinAndMax, ): Modifier { check(state is RealZoomableState) return this @@ -81,7 +81,7 @@ private data class ZoomableElement( private val enabled: Boolean, private val onClick: ((Offset) -> Unit)?, private val onLongClick: ((Offset) -> Unit)?, - private val onDoubleClick: DoubleClickListener, + private val onDoubleClick: DoubleClickToZoomListener, ) : ModifierNodeElement() { override fun create(): ZoomableNode = ZoomableNode( @@ -114,7 +114,7 @@ private data class ZoomableElement( @OptIn(ExperimentalFoundationApi::class) private class ZoomableNode( private var state: RealZoomableState, - private var suspendableOnDoubleClick: DoubleClickListener, + private var suspendableOnDoubleClick: DoubleClickToZoomListener, enabled: Boolean, onClick: ((Offset) -> Unit)?, onLongClick: ((Offset) -> Unit)?, @@ -180,7 +180,7 @@ private class ZoomableNode( enabled: Boolean, onClick: ((Offset) -> Unit)?, onLongClick: ((Offset) -> Unit)?, - onDoubleClick: DoubleClickListener, + onDoubleClick: DoubleClickToZoomListener, ) { if (this.state != state) { // Note to self: when the state is updated, the delegated