AttachmentsPreview: set zoomable state
This commit is contained in:
parent
e9e99918be
commit
aff9943f24
1 changed files with 16 additions and 5 deletions
|
|
@ -44,7 +44,10 @@ import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.theme.components.Scaffold
|
import io.element.android.libraries.designsystem.theme.components.Scaffold
|
||||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||||
import io.element.android.libraries.mediaviewer.api.local.LocalMediaView
|
import io.element.android.libraries.mediaviewer.api.local.LocalMediaView
|
||||||
|
import io.element.android.libraries.mediaviewer.api.local.rememberLocalMediaViewState
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
import me.saket.telephoto.zoomable.ZoomSpec
|
||||||
|
import me.saket.telephoto.zoomable.rememberZoomableState
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AttachmentsPreviewView(
|
fun AttachmentsPreviewView(
|
||||||
|
|
@ -127,11 +130,19 @@ private fun AttachmentPreviewContent(
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
when (attachment) {
|
when (attachment) {
|
||||||
is Attachment.Media -> LocalMediaView(
|
is Attachment.Media -> {
|
||||||
modifier = Modifier.fillMaxSize(),
|
val localMediaViewState = rememberLocalMediaViewState(
|
||||||
localMedia = attachment.localMedia,
|
zoomableState = rememberZoomableState(
|
||||||
onClick = {}
|
zoomSpec = ZoomSpec(maxZoomFactor = 4f, preventOverOrUnderZoom = false)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
LocalMediaView(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
localMedia = attachment.localMedia,
|
||||||
|
localMediaViewState = localMediaViewState,
|
||||||
|
onClick = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AttachmentsPreviewBottomActions(
|
AttachmentsPreviewBottomActions(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue