Skip to content

Commit

Permalink
refactor(world_map): simplify mouse button handling
Browse files Browse the repository at this point in the history
- Remove unnecessary braces for mouse button matching
- Use a single line for each case to make the code more concise
  • Loading branch information
ShenMian committed Jan 3, 2025
1 parent 0aab4ac commit 05fd88a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/widgets/world_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ pub async fn handle_mouse_events(event: MouseEvent, app: &mut App) -> Result<()>
.get_nearest_object(Utc::now(), lon, lat);
if let MouseEventKind::Down(buttom) = event.kind {
match buttom {
MouseButton::Left => {
app.world_map_state.selected_object = nearest_object;
}
MouseButton::Right => {
app.world_map_state.selected_object = None;
}
MouseButton::Left => app.world_map_state.selected_object = nearest_object,
MouseButton::Right => app.world_map_state.selected_object = None,
_ => {}
}
}
Expand Down

0 comments on commit 05fd88a

Please sign in to comment.