Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ How to write it (see AGENTS.md):

## Unreleased

## 2.2.2

### Improved
- The DraftCraft logo with its name no longer sits beside the menu bar: the application button already is the logo, so the menus (File, Edit …) start at the left edge.

## 2.2.1

### New
Expand Down
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"]
# default-members

[workspace.package]
version = "2.2.1"
version = "2.2.2"
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.95"
Expand Down
13 changes: 3 additions & 10 deletions crates/ui-egui/src/menus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,19 +794,16 @@ pub fn menu_bar(app: &mut CadApp, ui: &mut egui::Ui) {
}
}

/// The web build's top row, matching DraftCraft's own title bar on Windows: the logo, the name, then
/// the menus (File … Help), above the application bar and the ribbon. A browser tab has no title
/// The web build's top row, matching DraftCraft's own title bar on Windows: the menus (File …
/// Help), above the application bar and the ribbon (whose application button is the logo). A browser tab has no title
/// bar of DraftCraft's own, so without this the menu bar sat under the ribbon.
#[cfg(target_arch = "wasm32")]
pub fn web_top_row(app: &mut CadApp, ui: &mut egui::Ui) {
let t = crate::theme::Tokens::get();
let mut clicked = None;
egui::Panel::top("cc_menubar").exact_size(WEB_TOP_ROW_H).frame(egui::Frame::NONE.fill(t.chrome_dark)).show(ui, |ui| {
let r = ui.max_rect();
let p = ui.painter().clone();
let logo_left = r.left() + 8.0;
let logo_w = crate::brand::paint_full(&p, logo_left, r.center().y, WEB_LOGO_H, t.chrome_dark);
let menus = egui::Rect::from_min_max(egui::pos2(logo_left + logo_w + 12.0, r.top()), r.max);
let menus = egui::Rect::from_min_max(egui::pos2(r.left() + 6.0, r.top()), r.max);
ui.scope_builder(egui::UiBuilder::new().max_rect(menus).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
ui.set_clip_rect(menus);
clicked = menu_titles(app, ui);
Expand All @@ -821,10 +818,6 @@ pub fn web_top_row(app: &mut CadApp, ui: &mut egui::Ui) {
#[cfg(target_arch = "wasm32")]
const WEB_TOP_ROW_H: f32 = 30.0;

/// Height of the full logo (icon and wordmark) in the web build's top row: as in the Windows title bar.
#[cfg(target_arch = "wasm32")]
const WEB_LOGO_H: f32 = 24.0;

/// The menu titles (File, Edit … Help) and their menus, in `ui`. Returns the command chosen.
pub fn menu_titles(app: &CadApp, ui: &mut egui::Ui) -> Option<String> {
let tree = tree(app);
Expand Down
16 changes: 7 additions & 9 deletions crates/ui-egui/src/window_frame.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! DraftCraft's own window frame, as Windows CAD programs draw theirs. The desktop's title bar is
//! turned off and DraftCraft draws one row in its place: the logo, the name, the menu bar (File,
//! Edit, View … Help) and the minimize, maximize and close buttons. Its empty part moves the
//! turned off and DraftCraft draws one row in its place: the menu bar (File, Edit, View … Help)
//! and the minimize, maximize and close buttons. No logo there: the application button under it
//! already is the DraftCraft logo. Its empty part moves the
//! window (a double-click maximizes it), and the window's edges and corners resize it. The menu
//! bar no longer needs a row of its own under the ribbon.
//!
Expand All @@ -16,8 +17,8 @@ use crate::theme::Tokens;
/// Height of the title bar row.
pub const TITLE_H: f32 = 30.0;

/// Height of the full logo (icon and wordmark) in the title bar, in points.
const LOGO_H: f32 = 24.0;
/// The menu bar's distance from the window's left edge.
pub const MENU_INSET: f32 = 6.0;
/// Width of each window button, as Windows draws them.
const BUTTON_W: f32 = 46.0;
/// How far in from the window's edge a press resizes it.
Expand Down Expand Up @@ -59,7 +60,7 @@ enum Caption {
Close,
}

/// The title bar row: logo, name, menu bar, the empty part that moves the window, window buttons.
/// The title bar row: menu bar, the empty part that moves the window, window buttons.
pub fn title_bar(app: &mut CadApp, ui: &mut egui::Ui) {
let t = Tokens::get();
let mut clicked = None;
Expand All @@ -70,11 +71,8 @@ pub fn title_bar(app: &mut CadApp, ui: &mut egui::Ui) {
// First, so the controls drawn over it keep their own clicks.
let title = crate::chrome::window_title(app);
craft_window::title_bar::empty_area(ui, free).on_hover_text(title.clone());
let p = ui.painter().clone();
let logo_left = r.left() + 8.0;
let logo_w = crate::brand::paint_full(&p, logo_left, r.center().y, LOGO_H, t.chrome_dark);
if app.ui.in_window_menu {
let menus = Rect::from_min_max(pos2(logo_left + logo_w + 12.0, r.top()), pos2(free.right(), r.bottom()));
let menus = Rect::from_min_max(pos2(r.left() + MENU_INSET, r.top()), pos2(free.right(), r.bottom()));
ui.scope_builder(egui::UiBuilder::new().max_rect(menus).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
ui.set_clip_rect(menus);
clicked = crate::menus::menu_titles(app, ui);
Expand Down
Loading