-
Notifications
You must be signed in to change notification settings - Fork 84
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
Adjust BTF2 tap behavior to BTF1 on iOS #1923
base: jb-main
Are you sure you want to change the base?
Conversation
… implementing custom iOS behavior
…InputBtf2` in SelectionGestures.kt
dragBeginPosition = Offset.Unspecified | ||
dragTotalDistance = Offset.Zero | ||
textFieldSelectionState.directDragGestureInitiator = InputType.None | ||
requestFocus() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requestFocus() | |
requestFocus() | |
textFieldSelectionState.clearHandleDragging() |
Required for magnifier to work
textFieldSelectionState.textLayoutState.fromDecorationToTextLayout(coercedOffset) | ||
) | ||
} | ||
textFieldSelectionState.showCursorHandle = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textFieldSelectionState.showCursorHandle = true | |
textFieldSelectionState.showCursorHandle = true | |
textFieldSelectionState.updateHandleDragging(Handle.Cursor, startPoint) |
// as it does with a single tap | ||
textFieldSelectionState.placeCursorAtNearestOffset( | ||
textFieldSelectionState.textLayoutState.fromDecorationToTextLayout(coercedOffset) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
) | |
textFieldSelectionState.updateHandleDragging(Handle.Cursor, currentDragPosition) |
private var density: Density, | ||
private var enabled: Boolean, | ||
private var readOnly: Boolean, | ||
var enabled: Boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be set
private?
} | ||
|
||
/** Runs platform-specific text selection gestures logic. */ | ||
internal expect suspend fun PointerInputScope.getTextFieldSelectionGestures( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be also implemented in the android target
Changes in BTF2:
Added iOS-like tap behavior
Added iOS-like long-tap behavior
Added iOS-like double and triple taps selection
Added context menu calling in BTF2
Fixes: https://youtrack.jetbrains.com/issue/CMP-628
Testing
Manually, should be tested by QA
Release Notes
Features - iOS
Added native behavior for tap, long tap and multiple tap to
BasicTextField(TextFieldState)
.