From 5c282a28edacf977da6c99e9d7cab742e03d787e Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sat, 4 May 2024 11:41:35 +0200 Subject: [PATCH] shift click to pick cell from world --- uscope/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/uscope/src/main.rs b/uscope/src/main.rs index 1b47900..d376b4a 100644 --- a/uscope/src/main.rs +++ b/uscope/src/main.rs @@ -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); + } } }); }