Skip to content

Improve drag-to-select text (add margins) #5797

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

Merged
merged 3 commits into from
Mar 30, 2025

Conversation

hankjordan
Copy link
Contributor

@hankjordan hankjordan commented Mar 13, 2025

Might want to draw from interaction.interact_radius style instead of hard-coding the margin, but I didn't want to create a breaking change. If desired, I can follow up with a separate PR to address that concern.

@hankjordan hankjordan changed the title Add Galley cursor selection interact margin Fix: Galley cursor selection interact margin Mar 17, 2025
Comment on lines 826 to 832
if let Some(first_row) = self.rows.first() {
if pos.y < first_row.min_y() {
if pos.y < first_row.min_y() - 5.0 {
return self.begin();
}
}
if let Some(last_row) = self.rows.last() {
if last_row.max_y() < pos.y {
if last_row.max_y() + 5.0 < pos.y {
Copy link
Owner

Choose a reason for hiding this comment

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

Let's give the 5.0 a name (const VMARGIN: f32 or something) and explain why its there 🙏

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5797-hjgalley-interact-margin
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@hankjordan hankjordan requested a review from emilk March 28, 2025 17:38
@emilk emilk changed the title Fix: Galley cursor selection interact margin Improve drag-to-select text (add margins) Mar 30, 2025
@emilk emilk added egui epaint bug Something is broken labels Mar 30, 2025
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Thanks!

@emilk emilk merged commit 943e361 into emilk:master Mar 30, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui epaint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Erratic selection in TextEdit
2 participants