• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Drag Composable only inside given boundries with Jetpack Compose

Resolved: Drag Composable only inside given boundries with Jetpack Compose

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

so I have a black box (rectangle) inside another box (boundary) and the rectangle is set as draggable
But now I can drag the rectangle around the whole window, but I want that if the rectangle “leaves” the boundary it should disappear behind it. Is there another modifier I can use for it?
Here a bit context:
My code looks like this:
When I drag the rectangle outside the boundary it looks like this:
Unwanted behavior
But it should more like this:
Wanted behavior

Answer:

On the composable whose contents you want to clip add the clipToBounds() modifier.

If you have better answer, please add a comment about this, thank you!

compose-desktop kotlin
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: how to get and read an xml file in a zip file using xml.etree

02/04/2023

Resolved: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. cors error not resolving

02/04/2023

Resolved: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘crm.email’ doesn’t exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.