Implement drag-to-scroll in SelectionContainer#2966
Conversation
|
Vendula Švastalová (@svastven) Adding you to the PR because I also changed the implementation in The reason I needed to change it is that |
… of SelectionRegistrar.makeSelectionModifier
…k whether actual scrolling is needed to happen immediately.
| @@ -23,4 +23,4 @@ import androidx.compose.ui.layout.LayoutCoordinates | |||
| internal actual fun SelectionRegistrar.makeSelectionModifier( | |||
There was a problem hiding this comment.
If we decide that we should implement it via synthetic events (see another comment), we can ask increasing priority of this, or upstream a fix.
In the context of this issue it looks important in my opinion - the feature looks half-baked without it.
There was a problem hiding this comment.
If we decide that we should implement it via synthetic events (see another comment), we can ask increasing priority of this, or upstream a fix.
I'm already discussing it with Googlers
In the context of this issue it looks important in my opinion - the feature looks half-baked without it.
I agree, but note that this is how it currently works in text fields, for example.
| @@ -23,4 +23,4 @@ import androidx.compose.ui.layout.LayoutCoordinates | |||
| internal actual fun SelectionRegistrar.makeSelectionModifier( | |||
There was a problem hiding this comment.
Please, create a follow-up task (or don't close existing one) to support it for touch. It doesn't look like Mouse-specific feature (I checked my Android phone - it works in Chrome, but it is buggy)
There was a problem hiding this comment.
I'm working on this with Google.
It's more difficult for touch, but more critical for mouse...
There was a problem hiding this comment.
Please, don't close the original tasks or create a new one to have it tracked
| @@ -23,4 +23,4 @@ import androidx.compose.ui.layout.LayoutCoordinates | |||
| internal actual fun SelectionRegistrar.makeSelectionModifier( | |||
There was a problem hiding this comment.
Please, create a follow-up task (or don't close existing one) to support it for Android, to have the same features during cross-platform development. In YouTrack, to keep it tracked. And optionally in the Google tracker if we are ready to engage in the discussion.
There was a problem hiding this comment.
cc Ivan Matkov (@MatkovIvan) for extending the behavior on CMP platforms comparing to AOSP/Android
There was a problem hiding this comment.
|
Vendula Švastalová (@svastven) can you check & approve? |
Vendula Švastalová (svastven)
left a comment
There was a problem hiding this comment.
To me it looks good. Just two small related comments.
64e4bc5
into
jb-main
Implement scrolling the selection container when the user selects text and drags the mouse outside the text element. This is a cherry-pick of #2966 ## Testing N/A ## Release Notes ### Features - Multiple Platforms - Implemented drag-to-scroll in `SelectionContainer`. When the mouse pointer is dragged outside the element while selecting text, the text element will be scrolled accordingly. Note that this requires wrapping the content in a scrolling container/modifier, e.g. `Modifier.verticalScroll`.
Implement scrolling the selection container when the user selects text and drags the mouse outside the text element.
Note that due to https://issuetracker.google.com/issues/343917640 the scrolling continues only as long as the mouse is moved physically. It's not enough to drag outside and wait.
Also note that this only solves the problem for non-lazy scrollable containers, e.g.,
Modifier.verticalScroll().Fixes https://youtrack.jetbrains.com/issue/CMP-10039
Testing
Tested manually and added a unit test.
This should be tested by QA
Release Notes
Features - Multiple Platforms
SelectionContainer. When the mouse pointer is dragged outside the element while selecting text, the text element will be scrolled accordingly. Note that this requires wrapping the content in a scrolling modifier, e.g.Modifier.verticalScroll.