Pārlūkot izejas kodu

adb screen position fix

Milan Jurkulak 3 mēneši atpakaļ
vecāks
revīzija
68171178ac

+ 4 - 1
shared/src/commonMain/kotlin/org/mjdev/desktop/components/adb/AdbScreenMirror.kt

@@ -3,6 +3,7 @@ package org.mjdev.desktop.components.adb
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.gestures.detectTapGestures
 import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxHeight
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.material3.CircularProgressIndicator
 import androidx.compose.material3.Text
@@ -12,6 +13,7 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.ImageBitmap
 import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.layout.ContentScale
 import com.sun.jna.Platform.isAndroid
 import dadb.Dadb
 import kotlinx.coroutines.CoroutineScope
@@ -49,9 +51,10 @@ fun AdbScreenMirror(
                 Image(
                     bitmap = currentImage,
                     contentDescription = "Device screen",
+                    contentScale = ContentScale.Fit,
                     modifier =
                         Modifier
-                            .fillMaxSize()
+                            .fillMaxHeight()
                             .pointerInput(deviceState.dadbInstance) {
                                 detectTapGestures { offset ->
                                     deviceState.tapOnDevice(