Improve mouse interaction
This commit is contained in:
		@@ -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
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            // Move current boat
 | 
			
		||||
                            _ => true,
 | 
			
		||||
                        if let Some(b) = model.layout.find_boat_at_position(*pos) {
 | 
			
		||||
                            model.curr_boat = model.layout.0.iter().position(|s| s == b).unwrap();
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        true
 | 
			
		||||
                    } else {
 | 
			
		||||
                        false
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user