darkmoon_uk
06/16/2021, 12:40 PMsvgResource
and finding that it plainly does not resize as expected. Currently only trying on Retina MacBook Pro so wondering if screen DPI is playing a part? Anyone tried this?
I set a background colour via Modifier to see the layout of the Image element and that is correct; but the SVG itself never scales within, regardless of ContentScale
passed in ๐คทIgor Demin
06/16/2021, 12:45 PMdarkmoon_uk
06/16/2021, 12:48 PM0.5.0-build225
Igor Demin
06/16/2021, 12:50 PMdarkmoon_uk
06/16/2021, 12:51 PMImage(
painter = svgResource("MyImage.svg"),
contentDescription = "",
modifier = Modifier
.requiredWidth(442.dp).requiredHeight(64.dp).background(Color.Red),
contentScale = ContentScale.FillBounds,
alignment = Alignment.Center
)
darkmoon_uk
06/16/2021, 12:51 PMdarkmoon_uk
06/16/2021, 12:51 PMdarkmoon_uk
06/16/2021, 12:52 PMdarkmoon_uk
06/16/2021, 12:53 PMContentScale
is having no effect.darkmoon_uk
06/16/2021, 12:57 PMIgor Demin
06/16/2021, 12:58 PMdarkmoon_uk
06/16/2021, 12:59 PMIgor Demin
06/16/2021, 1:01 PMI'm aware that to scale to a precise width or height myselfto preserve aspect ratio, you can use the default
ContentScale.Fit
darkmoon_uk
06/16/2021, 1:03 PMdarkmoon_uk
06/16/2021, 1:14 PMdarkmoon_uk
06/16/2021, 1:15 PMIgor Demin
06/16/2021, 1:23 PMviewBox="0 0 615 89
to the root fixes the issue.
To my shame, we didn't fix this issue. Reopened it. Trying to fix this now.darkmoon_uk
06/16/2021, 1:31 PMIgor Demin
06/16/2021, 1:48 PMdarkmoon_uk
06/16/2021, 1:51 PM