From 447e85fcd8e37bc8d0790f6923e169b76b17ccba Mon Sep 17 00:00:00 2001 From: "ismail.mohamed" Date: Thu, 5 Mar 2026 19:34:09 +0000 Subject: [PATCH] fix(ScannerController): make torchEnabled and zoomRatio read-only --- kscan/build.gradle.kts | 2 +- .../kotlin/org/ncgroup/kscan/ScannerController.kt | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/kscan/build.gradle.kts b/kscan/build.gradle.kts index b461041..f53526c 100644 --- a/kscan/build.gradle.kts +++ b/kscan/build.gradle.kts @@ -37,7 +37,7 @@ kotlin { mavenPublishing { publishToMavenCentral() signAllPublications() - coordinates("io.github.ismai117", "KScan", "0.7.0") + coordinates("io.github.ismai117", "KScan", "0.7.1") pom { name.set(project.name) diff --git a/kscan/src/commonMain/kotlin/org/ncgroup/kscan/ScannerController.kt b/kscan/src/commonMain/kotlin/org/ncgroup/kscan/ScannerController.kt index 4b05568..1bfc16a 100644 --- a/kscan/src/commonMain/kotlin/org/ncgroup/kscan/ScannerController.kt +++ b/kscan/src/commonMain/kotlin/org/ncgroup/kscan/ScannerController.kt @@ -12,16 +12,21 @@ import androidx.compose.runtime.setValue * updates in response to scanner state modifications. * * @property torchEnabled A boolean indicating whether the torch is currently enabled. - * Defaults to `false`. Can be observed for changes. + * Defaults to `false`. This property is read-only and can be observed for changes. + * Use [setTorch] to toggle the torch. * @property zoomRatio The current zoom ratio of the scanner. Defaults to `1f`. - * Can be observed for changes. The valid range is typically between 1f and `maxZoomRatio`. + * This property is read-only and can be observed for changes. + * The valid range is typically between 1f and [maxZoomRatio]. + * Use [setZoom] to change the zoom level. * @property maxZoomRatio The maximum zoom ratio supported by the scanner. Defaults to `1f`. - * This property is read-only from outside the `kscan` package and is set internally. + * This property is read-only and is set internally. */ class ScannerController { var torchEnabled by mutableStateOf(false) + internal set var zoomRatio by mutableStateOf(1f) + internal set var maxZoomRatio by mutableStateOf(1f) internal set