diff --git a/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/ViewConfig.kt b/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/ViewConfig.kt index 2108cb0..aca3d4f 100644 --- a/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/ViewConfig.kt +++ b/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/ViewConfig.kt @@ -8,6 +8,7 @@ public data class ViewConfig( val dragHandle: DragHandle? = null, val onViewChange: ViewPoint.() -> Unit = {}, val onSelect: (Rectangle) -> Unit = {}, - val zoomOnSelect: Boolean = true, val onCanvasSizeChange: (DpSize) -> Unit = {}, + val zoomOnSelect: Boolean = true, + val zoomOnDoubleClick: Boolean = true ) \ No newline at end of file diff --git a/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/mapControls.kt b/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/mapControls.kt index c4d7fa4..5aec2fa 100644 --- a/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/mapControls.kt +++ b/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/mapControls.kt @@ -19,7 +19,6 @@ import kotlin.math.min public fun Modifier.mapControls( state: CoordinateViewScope, features: FeatureGroup, - zoomOnDoubleClick: Boolean = true, ): Modifier = with(state) { // //selecting all tapabales ahead of time @@ -48,8 +47,8 @@ public fun Modifier.mapControls( } }.pointerInput(Unit) { detectClicks( - onDoubleClick = { event -> - if (zoomOnDoubleClick) { + onDoubleClick = if (state.config.zoomOnDoubleClick) { + { event -> val invariant = event.position.toCoordinates(this) viewPoint = with(space) { viewPoint.zoomBy( @@ -58,7 +57,7 @@ public fun Modifier.mapControls( ) } } - }, + } else null, onClick = { event -> val coordinates = event.position.toCoordinates(this) val point = space.ViewPoint(coordinates, zoom)