Finished selections for now
This commit is contained in:
parent
5a1797cb21
commit
1fab7be4b5
1 changed files with 8 additions and 3 deletions
|
@ -244,9 +244,15 @@ impl Element for TerminalEl {
|
||||||
//TODO: Better way of doing this?
|
//TODO: Better way of doing this?
|
||||||
let mutex1 = terminal_mutex.clone();
|
let mutex1 = terminal_mutex.clone();
|
||||||
let mutex2 = terminal_mutex.clone();
|
let mutex2 = terminal_mutex.clone();
|
||||||
|
let mutex3 = terminal_mutex.clone();
|
||||||
|
|
||||||
cx.scene.push_mouse_region(MouseRegion {
|
cx.scene.push_mouse_region(MouseRegion {
|
||||||
view_id: self.view.id(),
|
view_id: self.view.id(),
|
||||||
|
mouse_down: Some(Rc::new(move |pos, _| {
|
||||||
|
let (point, side) = mouse_to_cell_data(pos, origin, cur_size, display_offset);
|
||||||
|
mutex3.lock().selection =
|
||||||
|
Some(Selection::new(SelectionType::Simple, point, side))
|
||||||
|
})),
|
||||||
click: Some(Rc::new(move |pos, click_count, cx| {
|
click: Some(Rc::new(move |pos, click_count, cx| {
|
||||||
let (point, side) = mouse_to_cell_data(pos, origin, cur_size, display_offset);
|
let (point, side) = mouse_to_cell_data(pos, origin, cur_size, display_offset);
|
||||||
|
|
||||||
|
@ -263,7 +269,8 @@ impl Element for TerminalEl {
|
||||||
|
|
||||||
let mut term = mutex1.lock();
|
let mut term = mutex1.lock();
|
||||||
term.selection = selection;
|
term.selection = selection;
|
||||||
cx.focus_parent_view()
|
cx.focus_parent_view();
|
||||||
|
cx.notify();
|
||||||
})),
|
})),
|
||||||
bounds: visible_bounds,
|
bounds: visible_bounds,
|
||||||
drag: Some(Rc::new(move |_delta, pos, cx| {
|
drag: Some(Rc::new(move |_delta, pos, cx| {
|
||||||
|
@ -273,8 +280,6 @@ impl Element for TerminalEl {
|
||||||
if let Some(mut selection) = term.selection.take() {
|
if let Some(mut selection) = term.selection.take() {
|
||||||
selection.update(point, side);
|
selection.update(point, side);
|
||||||
term.selection = Some(selection);
|
term.selection = Some(selection);
|
||||||
} else {
|
|
||||||
term.selection = Some(Selection::new(SelectionType::Simple, point, side));
|
|
||||||
}
|
}
|
||||||
cx.notify();
|
cx.notify();
|
||||||
})),
|
})),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue