Skip to content

Commit

Permalink
feat: Add images to buttons in node UI
Browse files Browse the repository at this point in the history
The code changes in `src/node.rs` modify the UI for nodes by adding images to the buttons. This improves the visual appearance and enhances the user experience. The images used are `add_node.png`, `delete_subtree.png`, `resume.png`, and `generate.png`. These changes align with the recent user commits that added hotkeys, markdown formatting, and a tree navigation bar.
  • Loading branch information
mdegans committed Jun 12, 2024
1 parent 21a8a3d commit 85763fb
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 11 deletions.
Binary file added resources/add_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/add_node.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/delete_subtree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/delete_subtree.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/generate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/generate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/resume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/resume.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl App {
}
}
RightSidebarPage::Tree => {
let lock_topology = !self.generation_in_progress;
let lock_topology = self.generation_in_progress;
let layout = self.settings.layout.clone();
if let Some(story) = self.story_mut() {
if let Some(action) =
Expand Down
34 changes: 24 additions & 10 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,20 @@ impl Node<Meta> {
) -> egui::Response {
let resp = ui.horizontal(|ui| {
let add_child = ui
.button("Add Child")
.add(egui::Button::image(egui::include_image!(
"../resources/add_node.png"
)))
.on_hover_text_at_pointer("Add an empty child node.");
if add_child.clicked() {
self.new_child_below();
}
let delete = ui.button("Delete").on_hover_text_at_pointer(
"Delete this node and all its children.",
);
let delete = ui
.add(egui::Button::image(egui::include_image!(
"../resources/delete_subtree.png"
)))
.on_hover_text_at_pointer(
"Delete this node and all its children.",
);
if delete.clicked() {
// Tell caller to delete this node.
*action = Some(Action {
Expand All @@ -732,19 +738,27 @@ impl Node<Meta> {
}
// FIXME: The terminology here could be improved. These are
// confusing. We should find new names.
let continue_ = ui.button("Continue").on_hover_text_at_pointer(
"Continue generating the current node.",
);
let continue_ = ui
.add(egui::Button::image(egui::include_image!(
"../resources/resume.png"
)))
.on_hover_text_at_pointer(
"Continue generating the current node.",
);
if continue_.clicked() {
// Tell caller to continue generation on this node.
*action = Some(Action {
continue_: true,
..Default::default()
});
}
let generate = ui.button("Generate").on_hover_text_at_pointer(
"Create a new node, select it, and continue generation.",
);
let generate = ui
.add(egui::Button::image(egui::include_image!(
"../resources/generate.png"
)))
.on_hover_text_at_pointer(
"Create a new node, select it, and continue generation.",
);
if generate.clicked() {
// Tell caller to generate a new node.
*action = Some(Action {
Expand Down

0 comments on commit 85763fb

Please sign in to comment.