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

Adjust BTF2 tap behavior to BTF1 on iOS #1923

Open
wants to merge 13 commits into
base: jb-main
Choose a base branch
from

Conversation

mazunin-v-jb
Copy link

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).

@mazunin-v-jb mazunin-v-jb self-assigned this Mar 13, 2025
@mazunin-v-jb mazunin-v-jb marked this pull request as draft March 13, 2025 19:01
@mazunin-v-jb mazunin-v-jb marked this pull request as ready for review March 14, 2025 17:45
@mazunin-v-jb mazunin-v-jb changed the title (wip) Adjust BTF2 tap behavior to BTF1 on iOS Adjust BTF2 tap behavior to BTF1 on iOS Mar 14, 2025
dragBeginPosition = Offset.Unspecified
dragTotalDistance = Offset.Zero
textFieldSelectionState.directDragGestureInitiator = InputType.None
requestFocus()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requestFocus()
requestFocus()
textFieldSelectionState.clearHandleDragging()

Required for magnifier to work

textFieldSelectionState.textLayoutState.fromDecorationToTextLayout(coercedOffset)
)
}
textFieldSelectionState.showCursorHandle = true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
textFieldSelectionState.showCursorHandle = true
textFieldSelectionState.showCursorHandle = true
textFieldSelectionState.updateHandleDragging(Handle.Cursor, startPoint)

// as it does with a single tap
textFieldSelectionState.placeCursorAtNearestOffset(
textFieldSelectionState.textLayoutState.fromDecorationToTextLayout(coercedOffset)
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)
)
textFieldSelectionState.updateHandleDragging(Handle.Cursor, currentDragPosition)

private var density: Density,
private var enabled: Boolean,
private var readOnly: Boolean,
var enabled: Boolean,
Copy link
Collaborator

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(
Copy link
Collaborator

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

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

Successfully merging this pull request may close these issues.

3 participants