JetLime icon indicating copy to clipboard operation
JetLime copied to clipboard

Change Icon size of point

Open Ashkan-san opened this issue 9 months ago • 1 comments

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?

Ashkan-san avatar Mar 23 '25 19:03 Ashkan-san

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)
                }
            }
        }
    }
}

Ashkan-san avatar Mar 30 '25 10:03 Ashkan-san