Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/main/kotlin/dev/isxander/zoomify/zoom/ZoomHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@ class ZoomHelper(
scrollTiers.toDouble() / Zoomify.maxScrollTiers
else 0.0
if (linearLikeSteps()) {
val curvature = 0.3
val exp = 1 / (1 - curvature)
targetZoom = 2 * (targetZoom.pow(exp) / (targetZoom.pow(exp) + (2 - targetZoom).pow(exp)))
// Use exponential scaling to make each zoom step feel equally significant
// Maps linear input (0 to 1) to exponential output
// This ensures each scroll step represents a constant multiplicative change in zoom
if (targetZoom > 0.0) {
// Base of 4.0 chosen empirically:
// - Provides good balance between early and late zoom steps
// - At 50% scroll: ~33% of max zoom (reasonable middle ground)
// - Creates perceptually linear zoom progression
val base = 4.0
targetZoom = (base.pow(targetZoom) - 1.0) / (base - 1.0)
}
}

prevScrollInterpolation = scrollInterpolation
Expand Down