mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-17 04:31:16 +08:00
Merge branch 'master' of github.com:Tencent/QMUI_Android
This commit is contained in:
@@ -38,6 +38,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.graphics.painter.BitmapPainter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import androidx.core.view.WindowCompat
|
||||
@@ -163,6 +164,7 @@ open class QMUIPhotoViewerActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun pullExitMiniTranslateY(): Dp = 72.dp
|
||||
|
||||
@OptIn(ExperimentalPagerApi::class)
|
||||
@Composable
|
||||
@@ -183,6 +185,7 @@ open class QMUIPhotoViewerActivity : AppCompatActivity() {
|
||||
initRect = initRect,
|
||||
shouldTransitionEnter = shouldTransitionEnter,
|
||||
transitionTarget = transitionTarget,
|
||||
pullExitMiniTranslateY = pullExitMiniTranslateY(),
|
||||
onBeginPullExit = {
|
||||
true
|
||||
},
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.compose.ui.input.pointer.positionChangeConsumed
|
||||
import androidx.compose.ui.input.pointer.positionChanged
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.abs
|
||||
@@ -40,6 +41,7 @@ fun QMUIGesturePhoto(
|
||||
shouldTransitionExit: Boolean = true,
|
||||
transitionTarget: Boolean = true,
|
||||
transitionDurationMs: Int = 360,
|
||||
pullExitMiniTranslateY: Dp = 72.dp,
|
||||
panEdgeProtection: Rect = Rect(
|
||||
0f,
|
||||
0f,
|
||||
@@ -346,7 +348,7 @@ fun QMUIGesturePhoto(
|
||||
}
|
||||
|
||||
if (isExitPanning) {
|
||||
if (photoTargetScale > 0.9f) {
|
||||
if (photoTargetTranslateY - photoTargetNormalTranslateY < pullExitMiniTranslateY.toPx()) {
|
||||
reset()
|
||||
} else {
|
||||
transitionTargetState = false
|
||||
|
||||
Reference in New Issue
Block a user