is it possible to clip a `Placeable` , before plac...
# compose
p
is it possible to clip a
Placeable
, before placing it? I would like to have it's height, limited by some height substraction, affected by scroll. In the following example, I would like to have expanded height to be
expanded.width - scrollOffset
Copy code
@Composable
private fun X(scrollOffset: Int) {
    Layout(
        content = {
           collapsedContent()
           expandedContent()
        }
    ) { measurables, constraints ->
        val collapsed = measurables[0].measure(constraints)
        val expanded = measurables[1].measure(constraints)

        val width = maxOf(collapsed.width, expanded.width)
        val height = maxOf(collapsed.height, expanded.height)

        layout(width, height) {
            collapsed.place(0, 0)
            expanded.place(0, 0)
        }
    }
}
Following doesn't seem to work
Copy code
val collapsed = measurables[0].measure(constraints)
val expanded = measurables[1].measure(constraints)
val expandedHeight = (expanded.height - scrollOffset).coerceAtLeast(0)

val width = maxOf(collapsed.width, expanded.width)
val height = maxOf(collapsed.height, expandedHeight)

layout(width, height) {
    collapsed.place(0, 0)
    expanded.place(0, 0)
 }
a
you can call placeWithLayer and specify the shape to clip in the lambda block
p
Ah, I noticed the
clip
, but not sure how I missed the `shape.`Thanks!