As of at least dev04 (haven’t tried earlier), it l...
# compose
z
As of at least dev04 (haven’t tried earlier), it looks like
Clip
isn’t doing anything. I can implement
DrawModifier
and manually clip the canvas before drawing the children, and that works, but
Clip
doesn’t seem to have any effect whatsoever. Is this a known issue?
a
Clip
definitely works, at least for our cases. we clip Surfaces and Buttons with them. it is possible it works not as you expect in the moment in combination with some LayoutModifiers, which is expected. could you please share your code?
a
Hey. I figured out why it works like this for you. Right now Clip behaves similarly to Draw component, which means uses the parent layout size. To debug the issue I added
DrawShape(shape = RoundedCornerShape(thickness), color = Color.Cyan)
on the same level as Clip in your code and it clips, but using the size of Center component, not Box, that why the effect is not visible. To fix this right now you can wrap your Clip component inside "Wrap" layout, and this will do the trick. In the future we expect Clip will be done as a modifier and you will do something like
modifier = Clip(RoundedCornerShape(thickness)) + PictureFrameModifier(thickness, colors, cache)
, but not right now
👍 1
z
Awesome, thanks for the investigation + explanation!