Skip to content

Commit

Permalink
Fix alignment offset for selection in TextBox (#1769)
Browse files Browse the repository at this point in the history
The alignment offset was accidentally added instead of subtracted from
the cursor position.
  • Loading branch information
CryZe committed May 10, 2021
1 parent ec9a626 commit 1bd2245
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions druid/src/text/input_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl<T: TextStorage + EditableText> EditSession<T> {
}

fn do_mouse_down(&mut self, point: Point, mods: Modifiers, count: u8) {
let point = point + Vec2::new(self.alignment_offset, 0.0);
let point = point - Vec2::new(self.alignment_offset, 0.0);
let pos = self.layout.text_position_for_point(point);
if mods.shift() {
self.selection.active = pos;
Expand All @@ -735,7 +735,7 @@ impl<T: TextStorage + EditableText> EditSession<T> {
}

fn do_drag(&mut self, point: Point) {
let point = point + Vec2::new(self.alignment_offset, 0.0);
let point = point - Vec2::new(self.alignment_offset, 0.0);
//FIXME: this should behave differently if we were double or triple clicked
let pos = self.layout.text_position_for_point(point);
let text = match self.layout.text() {
Expand Down

0 comments on commit 1bd2245

Please sign in to comment.