diff --git a/app/src/main/java/eu/geyskens/pdfscan/ui/screens/CropScreen.kt b/app/src/main/java/eu/geyskens/pdfscan/ui/screens/CropScreen.kt index fae76b9..4394a19 100644 --- a/app/src/main/java/eu/geyskens/pdfscan/ui/screens/CropScreen.kt +++ b/app/src/main/java/eu/geyskens/pdfscan/ui/screens/CropScreen.kt @@ -4,6 +4,7 @@ import android.graphics.Bitmap import android.graphics.PointF import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.gestures.detectDragGestures import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -104,12 +105,17 @@ fun CropScreen(vm: ScanViewModel, navController: NavController, pageId: String) val handlePx = with(density) { 32.dp.toPx() } Box( modifier = Modifier + // Position from the container's top-left, matching the Canvas + // coordinate space (the container uses contentAlignment = Center, + // which would otherwise offset handles from the middle). + .align(Alignment.TopStart) .offset( x = with(density) { (screen.x - handlePx / 2).toDp() }, y = with(density) { (screen.y - handlePx / 2).toDp() }, ) .size(32.dp) .background(Color(0xAA388BFD), CircleShape) + .border(2.dp, Color.White, CircleShape) .pointerInput(pageId, i, dispW, dispH) { detectDragGestures { change, drag -> change.consume()