Skip to content

Refactor UI code & resolve minor issues#359

Merged
KonaeAkira merged 18 commits into
previewfrom
ui-code-refactor
Jun 6, 2026
Merged

Refactor UI code & resolve minor issues#359
KonaeAkira merged 18 commits into
previewfrom
ui-code-refactor

Conversation

@augenfrosch

Copy link
Copy Markdown
Collaborator

The commit messages should hopefully give a reasonable overview of the changes. I tried making similar changes a few times before, but those attempts included more drastic changes and did not work out. This attempt is more limited in scope, so additional work can(/should, probably) be done following this.

Most of the refactor is just moving stuff around, including moving things that were previously stored (temporarily or persisted) using egui but used across different parts of the UI to structs owned by the MacroSolverApp.

Functionally everything should work the same as before. But I also resolved some minor issues that required a rework of how things are currently handled:

  • Glyphs that differ between the CJK fonts should now always display correctly depending on which locale is selected because only one of the CJK fonts is used/loaded at a time.
  • Loading a normal/custom recipe from the saved rotations now always updates the UI to show the appropriate recipe select.
  • The en spaces hack to align the progress bar text was still resulting in (very) slight shifts depending on the value. The new approach avoids this by using the actual text width to align them.

@augenfrosch augenfrosch added enhancement A-gui Area: Graphical user interface labels Jun 5, 2026

@KonaeAkira KonaeAkira left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. The UI code has always been in need of some refactoring imo. I only have a few nitpicks, the rest LGTM.

Comment thread src/solve.rs Outdated
}
}

assert!(solver_events.is_empty());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this assert

@@ -76,7 +63,7 @@ impl Simulator<'_> {
ui.label(egui::RichText::new(t!(locale, "Simulation")).strong());
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
ui.add_visible(
!self.actions.is_empty() && self.config_changed,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why you removed !self.actions.is_empty()? I think it's odd to display the config changed warning when there is no macro being displayed. I'm not necessarily against this change. I just want to know your motivation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly removed it so that the warning reappears after cancelling a solve before any intermediate solution is displayed, to basically make all cases consistent in whether they show the warning or not.

Before, starting a solve immediately updated the last solve params so it was never shown (and the behaviour was not easily changeable), after the rework the replacement of the last solve params are only updated for final solutions so I had to decide if/when the message is shown after cancelling (+ while solving).
I though the warning still fits after cancelling ("last solve" being interpreted as "last completed solve") so I chose to display it, but I can see that it can be distracting / unfitting if interpreted differently.

Comment thread src/app.rs Outdated
.data_mut(egui::util::IdTypeMap::remove_by_type::<egui::scroll_area::State>);

load_fonts(&cc.egui_ctx);
// load_fonts(&cc.egui_ctx);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 6, 2026

Copy link
Copy Markdown

Deploying raphael-rs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b25d51c
Status: ✅  Deploy successful!
Preview URL: https://c2e0c21c.raphael-rs.pages.dev
Branch Preview URL: https://ui-code-refactor.raphael-rs.pages.dev

View logs

@KonaeAkira KonaeAkira merged commit 1563ada into preview Jun 6, 2026
4 checks passed
@KonaeAkira KonaeAkira deleted the ui-code-refactor branch June 6, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-gui Area: Graphical user interface enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants