JetLime
JetLime copied to clipboard
Change Icon size of point
I'm trying to use eventStyle with a custom point type and using some material icons for the icon. but the icons i'm trying to use are too big inside the point. (visibility and bookmark icon) The check icon works fine though. How can I change the icon size oder add some padding around them?
I kinda solved this with the following workaround. But would be cool if you could apply some modifiers or similar stylings :)
...
pointType = EventPointType.custom(
icon = paddedPainter(rememberVectorPainter(item.status.getIcon(true))),
tint = contentColorFor(item.status.getColor()),
)
...
fun paddedPainter(
original: Painter,
padding: Dp = 8.dp
): Painter {
return object : Painter() {
override val intrinsicSize = original.intrinsicSize
override fun DrawScope.onDraw() {
val padPx = padding.toPx()
val paddedSize = size.copy(
width = size.width - padPx * 2,
height = size.height - padPx * 2
)
withTransform({
translate(left = padPx, top = padPx)
}) {
with(original) {
draw(size = paddedSize)
}
}
}
}
}