pub fn mouse_down_event(map: &mut Map, mouse_btn: mouse::MouseButton, x: i32, y: i32)
{
    let xind = x as usize / CELL_WIDTH;
    let yind = y as usize / CELL_HEIGHT;
    let cell = map.get_mut_cell(xind, yind).unwrap();

    match mouse_btn {
        mouse::MouseButton::Left => {
            cell.state = match cell.state {
                CellState::Empty => CellState::Conductor,
                CellState::Conductor => CellState::ElectronHead,
                _ => CellState::Empty,
            };
        }
        mouse::MouseButton::Right => cell.state = CellState::Empty,
        _ => (),
    }
}
/// Handles the event of left mouse click and performs a modification in the
/// `Cell`'s state at cursor pos.
/// Turns it into a `Conductor` if it was `Empty`, otherwise makes it `Empty`.
Handles the event of left mouse click and performs a modification in the
`Cell`'s state at cursor pos.
Handles the event of left mouse click and performs a modification in the ` Cell ` ' s state at cursor pos .
pub fn mouse_down_event(map: &mut Map, mouse_btn: mouse::MouseButton, x: i32, y: i32)
{
    let xind = x as usize / CELL_WIDTH;
    let yind = y as usize / CELL_HEIGHT;
    let cell = map.get_mut_cell(xind, yind).unwrap();
    match mouse_btn {
        mouse::MouseButton::Left => {
            cell.state = match cell.state {
                CellState::Empty => CellState::Conductor,
                CellState::Conductor => CellState::ElectronHead,
                _ => CellState::Empty,
            };
        }
        mouse::MouseButton::Right => cell.state = CellState::Empty,
        _ => (),
    }
}
pub fn mouse_down_event ( map : & mut Map , mouse_btn : mouse :: MouseButton , x : i32 , y : i32 ) { let xind = x as usize / CELL_WIDTH ; let yind = y as usize / CELL_HEIGHT ; let cell = map . get_mut_cell ( xind , yind ) . unwrap ( ) ; match mouse_btn { mouse :: MouseButton :: Left => { cell . state = match cell . state { CellState :: Empty => CellState :: Conductor , CellState :: Conductor => CellState :: ElectronHead , _ => CellState :: Empty , } ; } mouse :: MouseButton :: Right => cell . state = CellState :: Empty , _ => ( ) , } }
Handles the event of left mouse click and performs a modification in the
`Cell`'s state at cursor pos.
Handles the event of left mouse click and performs a modification in the ` Cell ` ' s state at cursor pos .
map
&mut Map
mouse_btn
mouse::MouseButton
x
i32
y
i32
map
&mut Map
mouse_btn
mouse::MouseButton
x
i32
y
i32