Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop releases randomly on large items #57

Closed
RicardasBivainis opened this issue Nov 6, 2024 · 19 comments
Closed

Drag and drop releases randomly on large items #57

RicardasBivainis opened this issue Nov 6, 2024 · 19 comments

Comments

@RicardasBivainis
Copy link

So this issue post compose update to 1.7.0.
When trying to drag large items somehow it releases automaticly and drops randomly.

In video I use:

  • Android 13
  • 5.3 720x1480 screen size
  • Maximized display item size and text

I used other resolutions for testing and the same bug appears.

Screen_recording_20241106_080151.webm
Screen_recording_20241106_080015.webm

image

@Calvin-LL
Copy link
Owner

What's the version of compose in your project and which version of this library are you using?

@RicardasBivainis
Copy link
Author

It's your demo project:

activityCompose = "1.9.3"
agp = "8.3.2"
compose = "1.7.0"
kotlin = "2.0.0"
mavenPublish = "0.29.0"
precompose = "1.6.1"
uiTooling = "1.7.5"

group = "sh.calvin.reorderable"
version = "2.4.0"

@RicardasBivainis
Copy link
Author

It seems that the main thing is the size (or maybe zoom(display item size maximization))

@Calvin-LL
Copy link
Owner

Hmm I'll take a look. I thought it was solved already

@RicardasBivainis
Copy link
Author

Sorry last issue that I opened just did not have time at that moment to provide more information. My bad.

@RicardasBivainis
Copy link
Author

Hey, did you managed to reproduce the issues? Any update?

@Calvin-LL
Copy link
Owner

It's a busy week. I'll try to take a deeper look soon. It's not immediately obvious in the code what's wrong.

@bkonrad-check
Copy link

bkonrad-check commented Nov 20, 2024

We got the same issue.
Happens also with the sample project, if you do this:

package sh.calvin.reorderable.demo

data class Item(val id: Int, val text: String, val size: Int)

val items = (0..200).map {
    Item(id = it, text = "Item #$it", size = if (it % 2 == 0) 70 else if(it == 15) 1000 else 100)
}

Debugged it a big, it seems like in fun Modifier.draggable for some reason the DisposableEffect is called and then everything is getting cleared. Maybe some behavior changes in the new compose version?

Did you maybe get some insights @Calvin-LL?

@Calvin-LL
Copy link
Owner

So the problem is the dragging item's actual position on the list can't be moved off screen. Once it's moved off screen, LazyColumn disposes it. I had something in the stroller to make sure a dragging item is never scrolled off screen but I'm not sure why it's not working. I'll have to wait till I have a free day to take a deeper look. Feel free to dig into it and see if you can solve it.

@RicardasBivainis
Copy link
Author

Hello, any updates on this issue?

@Calvin-LL
Copy link
Owner

I think I finally figured out what's wrong with it but I've been too busy to dig into it 😢

@RicardasBivainis
Copy link
Author

@Calvin-LL don't want to push you or something, but do you know when will you have some time to dig more into it?

@Calvin-LL
Copy link
Owner

I think this weekend hopefully. Ask me again next week if I haven't.

@RicardasBivainis
Copy link
Author

Hello, @Calvin-LL any updates?

@dat-rbh
Copy link

dat-rbh commented Dec 11, 2024

Having the same issue with scrolling the Large item to the top. Any updates on this Calvin?

@Calvin-LL
Copy link
Owner

Thank y'all for reminding me. Took a deep look today and I think I have a fix. Will polish and push an update tomorrow.

@Calvin-LL
Copy link
Owner

Calvin-LL commented Dec 12, 2024

v2.4.2 is out. Sorry for the wait. It took me the whole day.

@bkonrad-check
Copy link

It works better now, however, it's not completely fixed.
If you have big items, e.g. 800 dp or bigger, it still releases sometimes.

Not sure, if there is a workaround you can do, since it's something google should fix.
Filled a bug there as well https://issuetracker.google.com/issues/380805022

@Calvin-LL
Copy link
Owner

There's a limit to what it can handle with large items. Lazy Layouts only compose items that are on the screen, and this library offsets them to achieve dragging. If the items are so big that only one is rendered on screen, and the dragging item's original location is no longer on screen, then the item will disappear under your finger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants