shift click to pick cell from world

This commit is contained in:
Crispy 2024-05-04 11:41:35 +02:00
parent 3d9fd8d311
commit 5c282a28ed

View file

@ -211,7 +211,14 @@ impl eframe::App for UScope {
let p = ((pos - bounds.min) / GRID_SIZE).floor();
let x = p.x as usize;
let y = p.y as usize;
self.dish.set_cell(x, y, self.brush);
let pick = ui.input(|i| i.modifiers.shift);
if pick {
if let Some(clicked_cell) = self.dish.get_cell(x, y) {
self.brush = clicked_cell;
}
} else {
self.dish.set_cell(x, y, self.brush);
}
}
});
}