multiplatform-markdown-renderer
multiplatform-markdown-renderer copied to clipboard
Provide an option to remove bad animations
About this issue
- Briefly describe the issue
- How can the issue be reproduced / sample code
Details
MarkdownBasicText contains a very bad default animation, please provide an option to remove this animation
see code here https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt#L131
Checklist
- [x] Searched for similar issues
- [x] Checked out the sample application
- [x] Read the README
- [x] Checked out the CHANGELOG
- [x] Read the FAQ
- [x] Checked out the MIGRATION GUIDE
Thank you for bringing this up. A PR to address this feature request would be greatly appreciated!
@mikepenz sorry to interrupt. I know this has been closed and implemented, I just can't get the animation disabled. I am trying with this code:
At the bottom, I add animate=false.
CompositionLocalProvider(LocalImageTransformer provides CustomImageTransformer()) {
Markdown(
...
class CustomImageTransformer : ImageTransformer {
@Composable
override fun transform(link: String): ImageData? {
return null
}
override fun placeholderConfig(density: Density, containerSize: Size, intrinsicImageSize: Size): PlaceholderConfig {
return PlaceholderConfig(
size = with(density) {
if (containerSize.isUnspecified) {
Size(180f, 180f)
} else if (intrinsicImageSize.isUnspecified) {
Size(containerSize.width.toSp().value, 180f)
} else {
val width = minOf(intrinsicImageSize.width, containerSize.width)
val height = if (intrinsicImageSize.width < containerSize.width) {
intrinsicImageSize.height
} else {
(intrinsicImageSize.height * containerSize.width) / intrinsicImageSize.width
}
Size(width.toSp().value, height.toSp().value)
}
},
animate = false
)
}
}
Besides that, I find API-wise, linking MarkdownText animations to ImageTransformer is not very intuitive name-wise, but I suppose it is done this way since the images are displayed inline. Maybe some MarkdownAnimationProvider would be nicer? But just a minor detail.
@Dima-369 can you please create a new issue for this, so it's not being lost.
While animation was only part of the image loading at this time, I agree it might be long term more fitting to make it its own config.
can you please create a new issue for this, so it's not being lost.
Sure, I created https://github.com/mikepenz/multiplatform-markdown-renderer/issues/244