SmartToolFactory / Compose-Extended-Gestures

Counterpart of onTouchEvent, TouchDelegate, Transform gestures that notifies start, end, main pointer, pointers and option to consume PointerInputChange which defines whether other gestures should receive or not.
Apache License 2.0
93 stars 8 forks source link

PointerInputChange's `scrollData` is always `Offset.Zero` #6

Closed cybercoder-naj closed 4 months ago

cybercoder-naj commented 5 months ago

Reproduction

    Canvas(
        modifier = modifier
            .clipToBounds()
            .pointerMotionEvents(
                onDown = {
                    motionEvent = MotionEvent.Down
                    Log.d("TAG", "Down Position: ${it.position}")
                    it.consume()
                },
                onMove = {
                    motionEvent = MotionEvent.Move
                    Log.d("TAG", "Move Position: ${it.position}")
                    Log.d("TAG", "Move Scroll: ${it.scrollDelta}")
                    it.consume()
                },
                onUp = {
                    motionEvent = MotionEvent.Up
                    Log.d("TAG", "Up Position: ${it.position}")
                    it.consume()
                }
            )
    ) { /* Drawing elements */ }

Bug description

When I touch my Canvas and scroll it vertically or horizontally, I always get Offset(0.0, 0.0) in the logcat.

2024-04-19_21-56

SmartToolFactory commented 4 months ago

This has nothing to do with modifier. You should assign a size for Canvas.

cybercoder-naj commented 4 months ago

Hello. I'm sorry I do not understand your comment. Can you please elaborate on the solution to this?