Algorithm is simple-ish, I want to track the offse...
# compose
e
Algorithm is simple-ish, I want to track the offset of the current painter and draw it into the containers canvas, translating the canvas as necessary. With the
View
system I think it’ll be something like
Copy code
painters.forEach {
  canvas.withTranslate(offset.x, offset.y) {
    it.draw(canvas)
  }
  offset.y += it.heightRespectingAspectRatio
}
Not sure the equivalent in compose
n
Painters are by default already translates such that the origin is always at (0, 0). This already happens by default within compose. If you want you can create a Painter implementation that wraps another Painter and translate the canvas accordingly for it as part of its onDraw implementation