Compose-Image icon indicating copy to clipboard operation
Compose-Image copied to clipboard

Support 2 zoom level

Open Ten-Wang opened this issue 2 years ago • 0 comments

Hello,

I noticed the source code for calculating zoom levels, as shown below:

internal fun calculateZoom(
    zoomLevel: ZoomLevel,
    initial: Float,
    min: Float,
    max: Float
): Pair<ZoomLevel, Float> {

    val newZoomLevel: ZoomLevel
    val newZoom: Float

    when (zoomLevel) {
        ZoomLevel.Mid -> {
            newZoomLevel = ZoomLevel.Max
            newZoom = max.coerceAtMost(3f)
        }
        ZoomLevel.Max -> {
            newZoomLevel = ZoomLevel.Min
            newZoom = if (min == initial) initial else min
        }
        else -> {
            newZoomLevel = ZoomLevel.Mid
            newZoom = if (min == initial) (min + max.coerceAtMost(3f)) / 2 else initial
        }
    }
    return Pair(newZoomLevel, newZoom)
}

Is it possible for the library to support not only three zoom levels but also two zoom levels?

Thank you.

Ten-Wang avatar Oct 13 '23 02:10 Ten-Wang