Improve mouse interaction
This commit is contained in:
parent
b1f60894ed
commit
04fac2ddb2
@ -66,17 +66,11 @@ pub fn set_boat_layout<B: Backend>(
|
||||
// Start mouse action
|
||||
if MouseEventKind::Down(MouseButton::Left) == mouse.kind {
|
||||
is_moving_boat = if let Some(pos) = coordinates_mapper.get(&src_pos) {
|
||||
match model.layout.find_boat_at_position(*pos).cloned() {
|
||||
// Change of selected boat
|
||||
Some(b) if b != model.layout.0[model.curr_boat] => {
|
||||
model.curr_boat =
|
||||
model.layout.0.iter().position(|s| s == &b).unwrap();
|
||||
false
|
||||
if let Some(b) = model.layout.find_boat_at_position(*pos) {
|
||||
model.curr_boat = model.layout.0.iter().position(|s| s == b).unwrap();
|
||||
}
|
||||
|
||||
// Move current boat
|
||||
_ => true,
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user