If I scroll through a LazyColumn by emulating Touc...
# compose-desktop
t
If I scroll through a LazyColumn by emulating Touch (Drag-n-Drop) the scrolling studders and the fling animation is not visible. Is this intended behavior on Desktop or a bug? (Behaivior shown in video in the Thread)
Source code:
Copy code
@Composable
fun MainContent() {
    val data = (0 until 1000).map { "Item $it" }
    LazyColumn(Modifier.fillMaxSize()) {
        items(data) { text ->
            Text(
                text,
                Modifier
                    .clickable { println("Element $text clicked!") }
                    .padding(14.dp)
                    .fillMaxWidth()
            )
        }
    }
}
c
not sure but you can try using
remember
on
data
because maybe doing a thousands times the
map
operation on each compose is impacting performance ?
t
No nothing changed when wrapping
data
into a remember or collect it to a List (
.toList()
)
😕 1
i
How do you emulate touch? All scrollable components (including LazyColumn) only work (for now) with mouse-wheel-scroll events on desktop (touchpads on notebooks are also produce mouse-wheel events). Scrollable components shouldn't react on mouse drag/move.
t
I tested it with my Microsoft Surface touchscreen and by drag with a normal PC mouse and both time it scrolls but dosn't display the velocity updates
i
Oh, there is a bug in build150/build152. Will be fixed in the tomorrow release. We accidentally enable scrolling by mouse drag (we should scroll only by "touch" drag, true touch drag isn't supported on desktop yet). How will build149 work on Microsoft Surface?
t
Why do you not want to support mouse drag? And also it would be nice to have smooth scralling like in IntelliJ. I think it emulates smooth scrolling by animating from one step to the next step.
t
@Igor Demin was running on 0.3.0-build152 just tested build149 and touch is not working at all for scrolling
@Timo Drick there are some notes in the source code of compose that suggests that the diffrent pointer types (like mouse, touch, etc.) aren't fully implemented yet
👍 1
i
Why do you not want to support mouse drag
We support mouse drag, just not for scrollable components. Scrollable components reacting to mouse drag look strange on desktop.
I think it emulates smooth scrolling by animating from one step to the next step.
Yes, we want to implement smooth scrolling, but it is not in our priority.
just tested build149 and touch is not working at all for scrolling
So Microsoft Surface doesn't emulate scroll events 🤔. Good to know, thanks! True touch support isn't in our priority too, but we will eventually support this.
🙏 2
t
Update: Build 153 fixes the problem as described + scrolling on the Surface's touchscreen doesn't work anymore (as expacted)