Detect mouse clicks on the board

This commit is contained in:
Savanni D'Gerinel 2023-04-05 09:48:33 -04:00
parent b64eda7efd
commit 481226e8c6
1 changed files with 17 additions and 0 deletions

View File

@ -165,7 +165,24 @@ impl ObjectImpl for BoardPrivate {
}); });
} }
let gesture = gtk::GestureClick::new();
{
let board = self.board.clone();
let cursor = self.cursor_location.clone();
gesture.connect_released(move |_, _, _, _| {
let board = board.borrow();
let cursor = cursor.borrow();
match board.stone(cursor.row, cursor.column) {
IntersectionElement::Empty(request) => {
println!("need to send request: {:?}", request)
}
_ => {}
}
});
}
self.drawing_area.add_controller(motion_controller); self.drawing_area.add_controller(motion_controller);
self.drawing_area.add_controller(gesture);
} }
} }
impl WidgetImpl for BoardPrivate {} impl WidgetImpl for BoardPrivate {}