mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-08 23:08:39 +01:00
parent
5e39a7a9a6
commit
c1064665e6
@ -22,8 +22,10 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.FilterQuality
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.l10n.LocalXmlStrings
|
||||
|
||||
@ -47,7 +49,7 @@ fun ZoomableImage(
|
||||
) {
|
||||
val transformableState =
|
||||
rememberTransformableState { zoomChange, panChange, _ ->
|
||||
scale = (scale * zoomChange).coerceIn(1f, 5f)
|
||||
scale = (scale * zoomChange).coerceIn(1f, 16f)
|
||||
|
||||
val extraWidth = (scale - 1) * constraints.maxWidth
|
||||
val extraHeight = (scale - 1) * constraints.maxHeight
|
||||
@ -74,6 +76,8 @@ fun ZoomableImage(
|
||||
)
|
||||
.transformable(transformableState),
|
||||
url = url,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
quality = FilterQuality.High,
|
||||
autoload = autoLoadImages,
|
||||
onFailure = {
|
||||
Text(
|
||||
|
@ -33,9 +33,7 @@ data class PostModel(
|
||||
)
|
||||
|
||||
val PostModel.imageUrl: String
|
||||
get() = url?.takeIf { it.looksLikeAnImage }?.takeIf { it.isNotEmpty() } ?: run {
|
||||
thumbnailUrl
|
||||
}.orEmpty()
|
||||
get() = (thumbnailUrl?.takeIf { it.isNotEmpty() } ?: url?.takeIf { it.looksLikeAnImage }).orEmpty()
|
||||
|
||||
val PostModel.videoUrl: String
|
||||
get() = url?.takeIf { it.looksLikeAVideo }?.takeIf { it.isNotEmpty() }.orEmpty()
|
||||
|
Loading…
x
Reference in New Issue
Block a user