shift click to pick cell from world
This commit is contained in:
parent
3d9fd8d311
commit
5c282a28ed
1 changed files with 8 additions and 1 deletions
|
@ -211,7 +211,14 @@ impl eframe::App for UScope {
|
||||||
let p = ((pos - bounds.min) / GRID_SIZE).floor();
|
let p = ((pos - bounds.min) / GRID_SIZE).floor();
|
||||||
let x = p.x as usize;
|
let x = p.x as usize;
|
||||||
let y = p.y 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue