REPAINT_CANVAS_MANUALLY

A millisecond value which, if used, will result in a canvas that never repaints on its own.

This is a value for the Canvas minDeltaMs parameter.

This can be useful for a canvas that only ever is meant to paint exactly once or one whose repaints are triggered manually by the caller via a CanvasRepainter.

If you pass in a repainter and don't explicitly set the minDeltaMs parameter, it will automatically be set to this value.

val repainter = remember { CanvasRepainter() }
Canvas2d(
500, 500,
Modifier.onClick { repainter.repaint() },
repainter = repainter // Automatically sets minDeltaMs to REPAINT_CANVAS_MANUALLY
) {
ctx.fillStyle = Color.rgb(Random.nextInt(255), Random.nextInt(255), Random.nextInt(255))
ctx.fillRect(0.0, 0.0, 500.0, 500.0)
}