mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Fix text selection of centered and right-aligned text (#8076)
* Fixes https://github.com/emilk/egui/issues/8049 * Bug introduced in https://github.com/emilk/egui/pull/7831
This commit is contained in:
@@ -1047,7 +1047,7 @@ impl Galley {
|
||||
return self.end_pos();
|
||||
};
|
||||
|
||||
let x = row.x_offset(layout_cursor.column) + row.pos.x - self.rect.left();
|
||||
let x = row.x_offset(layout_cursor.column) + row.pos.x;
|
||||
Rect::from_min_max(pos2(x, row.min_y()), pos2(x, row.max_y()))
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ impl Galley {
|
||||
if is_pos_within_row || y_dist < best_y_dist {
|
||||
best_y_dist = y_dist;
|
||||
// char_at is `Row` not `PlacedRow` relative which means we have to subtract the pos.
|
||||
let column = row.char_at(pos.x - row.pos.x + self.rect.left());
|
||||
let column = row.char_at(pos.x - row.pos.x);
|
||||
let prefer_next_row = column < row.char_count_excluding_newline();
|
||||
cursor = CCursor {
|
||||
index: ccursor_index + column,
|
||||
|
||||
Reference in New Issue
Block a user