Add and edit labels, dune board sample

This commit is contained in:
Dane Johnson 2022-05-11 17:40:15 -05:00
parent 9625fba3cc
commit 6940d46d85
4 changed files with 12 additions and 0 deletions

View File

@ -269,6 +269,18 @@ impl EditNodeDialog {
.show(ctx, |ui| {
let mut board = self.board.borrow_mut();
ui.text_edit_singleline(&mut self.node.name);
for (key, choices) in &board.labels {
let choices = choices.clone();
let default = choices.iter().next().unwrap().clone();
let current = self.node.labels.entry(key.clone()).or_insert(default);
ComboBox::from_label(key)
.selected_text(format!("{}", current))
.show_ui(ui, |ui| {
for choice in choices {
ui.selectable_value(current, choice.clone(), choice);
}
});
}
if ui.button("Ok").clicked() {
board.nodes.insert(self.id, self.node.clone());
self.open = false;

BIN
risk.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 KiB

BIN
samples/dune.board Normal file

Binary file not shown.

Binary file not shown.