svenjacobs
04/03/2025, 4:52 PMPath
and a Rect
, where Path
is a subset of Rect
, meaning the path fits into the rectangle, how can one calculate either the amount of pixels or percentage of the path occupying the rectangle? Or in other words, how many percent does the path fill the rectangle?svenjacobs
04/03/2025, 4:52 PMBox
and want the user to be able to draw onto the box. I added a pointerInput
modifier and whenever I receive a Press
or Move
event, I add a circle (addOval()
) to the path at the position of the touch event. Then in a drawWithContent
modifier I draw the path onto the box. This all works nicely and the user can draw onto the box.
What I now want to achieve is to display how many percent the user has filled out the box.
Any ideas?svenjacobs
04/03/2025, 4:53 PMBox
. I just said Rect
for simplification 🙂romainguy
04/03/2025, 5:00 PMsvenjacobs
04/03/2025, 5:01 PMromainguy
04/03/2025, 5:01 PMromainguy
04/03/2025, 5:01 PMromainguy
04/03/2025, 5:02 PMromainguy
04/03/2025, 5:03 PMsvenjacobs
04/03/2025, 5:04 PMromainguy
04/03/2025, 5:05 PMromainguy
04/03/2025, 5:05 PMromainguy
04/03/2025, 5:42 PMromainguy
04/03/2025, 5:43 PMromainguy
04/03/2025, 5:49 PMromainguy
04/03/2025, 5:49 PMcomputeNonOverlappingArea()
svenjacobs
04/03/2025, 5:55 PMromainguy
04/03/2025, 5:58 PMromainguy
04/03/2025, 5:59 PMsvenjacobs
04/03/2025, 6:08 PMsvenjacobs
04/04/2025, 7:19 AMcomputeArea()
because I actually build a union of Paths like
path += Path().apply {
addOval(…)
}
but apart from that your solution works perfectly 🎉