diff --git a/assets/locales/da.json b/assets/locales/da.json index 152bf4544..5e1d068a8 100644 --- a/assets/locales/da.json +++ b/assets/locales/da.json @@ -1529,7 +1529,6 @@ "ui.stand_up_tip": "Når en STEP- eller IGES-fil åbnes med Z opad, tilbydes en kvart omdrejning om X", "ui.start": "Start", "ui.start_over": "Start forfra", - "ui.start_radius": "Startradius", "ui.stretch": "Stræk", "ui.supersampling": "Supersampling (SSAA)", "ui.supersampling_adaptive": "Kun når visningen står stille", diff --git a/assets/locales/de.json b/assets/locales/de.json index df9f15b15..f8d8432ac 100644 --- a/assets/locales/de.json +++ b/assets/locales/de.json @@ -111,8 +111,6 @@ "Open local libraries in the desktop app. You can export this design's library here.": "Öffnen Sie lokale Bibliotheken in der Desktop-App. Die Bibliothek dieses Designs können Sie hier exportieren.", "Operator": "Operator", "Other surface (mutual trim)": "Anderer Flächenkörper (gegenseitig trimmen)", - "OUTPUT": "AUSGABE", - "Other surface (mutual trim)": "Anderer Flächenkörper (gegenseitig trimmen)", "Outside": "Außen", "Overall length": "Gesamtlänge", "Parameter": "Parameter", diff --git a/assets/locales/en.json b/assets/locales/en.json index f314d5206..b5d51025c 100644 --- a/assets/locales/en.json +++ b/assets/locales/en.json @@ -785,20 +785,20 @@ "coupling.rack": "Rack", "coupling.radius_1": "Radius 1", "coupling.radius_2": "Radius 2", - "crash.detected_time": "Detected {time} UTC", - "crash.previous_session": "An earlier SolidCraft session ended unexpectedly or hit an internal error. Reports from unclean exits are detected at startup. See Help > Crash Reports… for details.", - "crash.unclean_explanation": "Detected on a later launch; the exact exit time was not recorded. A system shutdown or forced stop can also cause an unclean exit.", "crash.announce": "SolidCraft closed unexpectedly or hit an internal error last time. A crash report was saved (Help > Crash Reports…).", "crash.copy_folder": "Copy folder path", "crash.copy_path": "Copy path", "crash.deleted": "Deleted {count} report(s).", + "crash.detected_time": "Detected {time} UTC", "crash.intro": "Crash reports stay on this computer and are never sent anywhere. Report… opens a draft you review before anything is shared.", "crash.kind_command": "Internal error in a command", "crash.kind_internal": "Internal error", "crash.kind_kernel": "Kernel error (recovered)", "crash.kind_unclean": "Closed unexpectedly", + "crash.previous_session": "An earlier SolidCraft session ended unexpectedly or hit an internal error. Reports from unclean exits are detected at startup. See Help > Crash Reports… for details.", "crash.replayable": "replayable", "crash.report": "Report…", + "crash.unclean_explanation": "Detected on a later launch; the exact exit time was not recorded. A system shutdown or forced stop can also cause an unclean exit.", "delete.and_more": "… and {count} more", "dialog.bodies_count": "{count} bodies", "dialog.clearance_invalid": "the clearance must be a length of 0 or more", @@ -807,7 +807,7 @@ "dialog.computing": "Computing… {seconds} s", "dialog.could_not_be_checked": "could not be checked", "dialog.custom_axis": "↖ Custom Axis", - "dialog.dimension_insert_hint": "Double-click another driving dimension to insert its name", + "dialog.dimension_insert_hint": "Click another driving dimension to insert its name", "dialog.dimension_name": "Dimension: {name}", "dialog.edit_title": "EDIT {title}", "dialog.select": "↖ Select", diff --git a/assets/locales/ja.json b/assets/locales/ja.json index 8d370fac4..8efc6fb85 100644 --- a/assets/locales/ja.json +++ b/assets/locales/ja.json @@ -785,20 +785,20 @@ "coupling.rack": "ラック", "coupling.radius_1": "半径 1", "coupling.radius_2": "半径 2", - "crash.detected_time": "検出日時: {time} UTC", - "crash.previous_session": "以前の SolidCraft セッションが予期せず終了したか、内部エラーが発生しました。正常終了が記録されていないセッションは起動時に検出されます。詳細は ヘルプ > クラッシュレポート… を参照してください。", - "crash.unclean_explanation": "次回以降の起動時に検出されました。正確な終了時刻は記録されていません。システムのシャットダウンや強制停止によっても、正常終了が記録されない場合があります。", "crash.announce": "前回、SolidCraftが予期せず終了したか、内部エラーが発生しました。クラッシュレポートが保存されています(ヘルプ > クラッシュレポート…)。", "crash.copy_folder": "フォルダのパスをコピー", "crash.copy_path": "パスをコピー", "crash.deleted": "{count}件のレポートを削除しました。", + "crash.detected_time": "検出日時: {time} UTC", "crash.intro": "クラッシュレポートはこのコンピュータ内に保存され、外部に送信されることはありません。「報告…」で下書きが開き、共有前に内容を確認できます。", "crash.kind_command": "コマンド内の内部エラー", "crash.kind_internal": "内部エラー", "crash.kind_kernel": "カーネルエラー(復旧済み)", "crash.kind_unclean": "予期しない終了", + "crash.previous_session": "以前の SolidCraft セッションが予期せず終了したか、内部エラーが発生しました。正常終了が記録されていないセッションは起動時に検出されます。詳細は ヘルプ > クラッシュレポート… を参照してください。", "crash.replayable": "再現可能", "crash.report": "報告…", + "crash.unclean_explanation": "次回以降の起動時に検出されました。正確な終了時刻は記録されていません。システムのシャットダウンや強制停止によっても、正常終了が記録されない場合があります。", "delete.and_more": "…ほか{count}件", "dialog.bodies_count": "{count} ボディ", "dialog.clearance_invalid": "クリアランスは 0 以上の長さにしてください", @@ -807,7 +807,7 @@ "dialog.computing": "計算中… {seconds} 秒", "dialog.could_not_be_checked": "チェックできません", "dialog.custom_axis": "↖ カスタム軸", - "dialog.dimension_insert_hint": "別の駆動寸法をダブルクリックして名前を挿入", + "dialog.dimension_insert_hint": "別の駆動寸法をクリックして名前を挿入", "dialog.dimension_name": "寸法: {name}", "dialog.edit_title": "{title}を編集", "dialog.select": "↖ 選択", diff --git a/assets/locales/ko.json b/assets/locales/ko.json index e5c59e7f1..e18fefdee 100644 --- a/assets/locales/ko.json +++ b/assets/locales/ko.json @@ -111,8 +111,6 @@ "Open local libraries in the desktop app. You can export this design's library here.": "로컬 라이브러리는 데스크톱 앱에서 여세요. 이 디자인의 라이브러리는 여기서 내보낼 수 있습니다.", "Operator": "연산자", "Other surface (mutual trim)": "다른 곡면(상호 트림)", - "OUTPUT": "출력", - "Other surface (mutual trim)": "다른 곡면(상호 트림)", "Outside": "바깥쪽", "Overall length": "전체 길이", "Parameter": "매개변수", diff --git a/assets/locales/zh.json b/assets/locales/zh.json index ee79f4112..7a266d3b3 100644 --- a/assets/locales/zh.json +++ b/assets/locales/zh.json @@ -785,20 +785,20 @@ "coupling.rack": "齿条", "coupling.radius_1": "半径 1", "coupling.radius_2": "半径 2", - "crash.detected_time": "检测时间:{time} UTC", - "crash.previous_session": "较早的 SolidCraft 会话意外结束或发生了内部错误。未正常结束的会话会在启动时被检测到。详情请参阅 帮助 > 崩溃报告…。", - "crash.unclean_explanation": "在后续启动时检测到;未记录确切的退出时间。系统关机或强制停止也可能导致会话未正常结束。", "crash.announce": "SolidCraft 上次意外关闭或发生了内部错误。崩溃报告已保存(帮助 > 崩溃报告…)。", "crash.copy_folder": "复制文件夹路径", "crash.copy_path": "复制路径", "crash.deleted": "已删除 {count} 份报告。", + "crash.detected_time": "检测时间:{time} UTC", "crash.intro": "崩溃报告保存在此计算机上,不会发送到任何地方。“报告…”会打开草稿,供您在分享前检查。", "crash.kind_command": "命令内部错误", "crash.kind_internal": "内部错误", "crash.kind_kernel": "内核错误(已恢复)", "crash.kind_unclean": "意外关闭", + "crash.previous_session": "较早的 SolidCraft 会话意外结束或发生了内部错误。未正常结束的会话会在启动时被检测到。详情请参阅 帮助 > 崩溃报告…。", "crash.replayable": "可重放", "crash.report": "报告…", + "crash.unclean_explanation": "在后续启动时检测到;未记录确切的退出时间。系统关机或强制停止也可能导致会话未正常结束。", "delete.and_more": "…以及另外 {count} 项", "dialog.bodies_count": "{count} 个实体", "dialog.clearance_invalid": "间隙必须是 0 或更大的长度", @@ -807,7 +807,7 @@ "dialog.computing": "正在计算… {seconds} 秒", "dialog.could_not_be_checked": "无法检查", "dialog.custom_axis": "↖ 自定义轴", - "dialog.dimension_insert_hint": "双击其他驱动尺寸以插入其名称", + "dialog.dimension_insert_hint": "单击其他驱动尺寸以插入其名称", "dialog.dimension_name": "尺寸:{name}", "dialog.edit_title": "编辑 {title}", "dialog.select": "↖ 选择", diff --git a/crates/ui-egui/src/crash_ui.rs b/crates/ui-egui/src/crash_ui.rs index 48d502607..44f8a8ebe 100644 --- a/crates/ui-egui/src/crash_ui.rs +++ b/crates/ui-egui/src/crash_ui.rs @@ -40,10 +40,14 @@ fn kind_label(kind: &str) -> &'static str { }) } -fn report_heading(r: &Summary) -> String { +fn report_time(r: &Summary) -> String { let time = r.time.replace('T', " "); let time = time.trim_end_matches('Z'); - let time = if r.kind == "unclean_exit" { crate::i18n::format("crash.detected_time", &[("time", time)]) } else { format!("{time} UTC") }; + if r.kind == "unclean_exit" { crate::i18n::format("crash.detected_time", &[("time", time)]) } else { format!("{time} UTC") } +} + +fn report_heading(r: &Summary) -> String { + let time = report_time(r); let times = if r.count > 1 { format!(" ×{}", r.count) } else { String::new() }; format!("{time} {}{times}", kind_label(&r.kind)) } @@ -102,24 +106,17 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) { ui.push_id(&r.id, |ui| { ui.spacing_mut().item_spacing.y = crate::theme::Tokens::get().space_6; ui.add_space(crate::theme::Tokens::get().space_10); - ui_kit::report_header( - ui, - kind_label(&r.kind), - r.count, - r.time.replace('T', " ").trim_end_matches('Z'), - &title, - |ui| { - if ui_kit::bin_button(ui, crate::i18n::tr("ui.delete")).clicked() { - delete = Some(Some(r.id.clone())); - } - ui_kit::icon_label_button(ui, crate::i18n::tr("crash.copy_path"), "copy", true, false) - .clicked() - .then(|| ctx.copy_text(r.path.clone())); - if ui_kit::icon_label_button(ui, crate::i18n::tr("crash.report"), "bug_report", true, false).clicked() { - report = Some(r.id.clone()); - } - }, - ); + ui_kit::report_header(ui, kind_label(&r.kind), r.count, &report_time(r), &title, |ui| { + if ui_kit::bin_button(ui, crate::i18n::tr("ui.delete")).clicked() { + delete = Some(Some(r.id.clone())); + } + ui_kit::icon_label_button(ui, crate::i18n::tr("crash.copy_path"), "copy", true, false) + .clicked() + .then(|| ctx.copy_text(r.path.clone())); + if ui_kit::icon_label_button(ui, crate::i18n::tr("crash.report"), "bug_report", true, false).clicked() { + report = Some(r.id.clone()); + } + }); let mut detail = r.command.clone().unwrap_or_default(); if r.replayable { let sep = if detail.is_empty() { "" } else { " · " }; @@ -331,7 +328,7 @@ mod tests { ] { assert!(crate::scenario::rect_of(rect).is_some(), "missing {rect}"); } - let title = "2026-10-12 16:23:41 Closed unexpectedly ×2"; + let title = "Detected 2026-10-12 16:23:41 UTC Closed unexpectedly ×2"; assert!(crate::scenario::handle_at(&format!("dialog:cell:{title}")).is_some()); assert!(crate::scenario::handle_at(&format!("dialog:cell:{}", d.display())).is_some()); h.step(&json!({"click":{"handle":"dialog:button::Copy folder path"}})).unwrap(); diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 43b4419b2..59593d37d 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -2299,7 +2299,9 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) { ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter)); } let body = |ui: &mut egui::Ui| { + d.sync_fillet_chain(&app.session); enter |= dense::rows(app, ctx, &mut d, ui); + d.sync_fillet_chain(&app.session); if cell_enter { ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter)); } diff --git a/crates/ui-egui/src/dialogs_dense.rs b/crates/ui-egui/src/dialogs_dense.rs index 6fe064ea0..3ed097db7 100644 --- a/crates/ui-egui/src/dialogs_dense.rs +++ b/crates/ui-egui/src/dialogs_dense.rs @@ -40,6 +40,7 @@ pub(super) fn command(kind: &Kind) -> Option<&'static str> { Kind::Construct { command, .. } => Some(command), Kind::PathPlane { .. } => Some("construct.plane.along_path"), Kind::Split => Some("solid.split_body"), + Kind::DeleteFaces => Some("face.delete"), Kind::Move { .. } => Some("solid.move"), Kind::Thread { .. } => Some("solid.thread"), Kind::ReplaceFace => Some("solid.replace_face"), diff --git a/crates/ui-egui/src/file_load_ui_tests.rs b/crates/ui-egui/src/file_load_ui_tests.rs index cfcbf354f..938f5255a 100644 --- a/crates/ui-egui/src/file_load_ui_tests.rs +++ b/crates/ui-egui/src/file_load_ui_tests.rs @@ -310,7 +310,14 @@ fn an_opened_design_shows_its_bodies_as_they_are_meshed() { // Framed from the meshes now, as a synchronous open frames it. let framed = w.app.cam; w.app.fit_view(); - assert_eq!(w.app.cam, framed); + // Floating viewport framing can round the same bounds by a few ulps. + let refitted = w.app.cam; + assert!((refitted.target - framed.target).len() < 1e-9); + assert!((refitted.distance - framed.distance).abs() < 1e-9); + assert_eq!( + (refitted.yaw, refitted.pitch, refitted.roll, refitted.fov, refitted.up), + (framed.yaw, framed.pitch, framed.roll, framed.fov, framed.up) + ); // An edit after that: the viewport draws the session's world again. w.app.session.execute("solid.box", &json!({"length": 5, "width": 5, "height": 5, "operation": "new"})).unwrap(); w.frame(vec![]); diff --git a/crates/ui-egui/src/fonts.rs b/crates/ui-egui/src/fonts.rs index 476c40dde..2ea924f7f 100644 --- a/crates/ui-egui/src/fonts.rs +++ b/crates/ui-egui/src/fonts.rs @@ -1064,7 +1064,7 @@ mod tests { ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear(); ctx.fonts(|f| f.definitions().families[&egui::FontFamily::Proportional].clone()) }; - let latin = egui::FontDefinitions::default().families[&egui::FontFamily::Proportional][0].clone(); + let latin = base_font_definitions().families[&egui::FontFamily::Proportional][0].clone(); for language in ["uk", "en", "de"] { let list = installed(language); assert_eq!(list.first(), Some(&latin), "{language} keeps the Latin face first: {list:?}"); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index e1df765b1..36c334595 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -93,10 +93,10 @@ pub mod messages; #[cfg(test)] mod pattern_arrow_tests; #[cfg(test)] -mod scale_tests; -#[cfg(test)] mod prompt_cards_tests; #[cfg(test)] +mod scale_tests; +#[cfg(test)] mod surface_clamp_tests; #[cfg(test)] mod surface_errors_tests; diff --git a/crates/ui-egui/src/mouse_gesture.rs b/crates/ui-egui/src/mouse_gesture.rs index 55c8f9594..f85a8ba86 100644 --- a/crates/ui-egui/src/mouse_gesture.rs +++ b/crates/ui-egui/src/mouse_gesture.rs @@ -344,12 +344,20 @@ pub(crate) fn paint(painter: &Painter, c: Pos2, scale: f32, studio: Studio, item } } match hot.and_then(|k| items.get(k)).filter(|i| i.enabled) { - Some(item) => { - painter.text(c, Align2::CENTER_CENTER, crate::i18n::tr_label(&item.label), FontId::proportional((20.0 * scale).max(9.0)), t.text) - } - None => { - painter.text(c, Align2::CENTER_CENTER, crate::i18n::tr_label(studio.label()), FontId::proportional((16.0 * scale).max(9.0)), t.text_dim) - } + Some(item) => painter.text( + c, + Align2::CENTER_CENTER, + crate::i18n::tr_label(&item.label), + FontId::proportional((t.font_title * scale).max(t.font_badge)), + t.text, + ), + None => painter.text( + c, + Align2::CENTER_CENTER, + crate::i18n::tr_label(studio.label()), + FontId::proportional((t.font_intro * scale).max(t.font_badge)), + t.text_dim, + ), }; } @@ -565,13 +573,13 @@ fn apply(list: &mut Vec, op: Op) -> bool { pub(crate) fn nav_rows(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) { let note = |ui: &mut egui::Ui, s: &str| { ui.label(""); - ui.add(egui::Label::new(egui::RichText::new(crate::i18n::tr_label(s)).size(11.0).color(t.text_dim)).wrap()); + ui.add(egui::Label::new(egui::RichText::new(crate::i18n::tr_label(s)).size(t.font_small).color(t.text_dim)).wrap()); ui.end_row(); }; ui.label(crate::i18n::tr_label("Mouse gestures")); ui.horizontal(|ui| { - ui.checkbox(&mut app.preferences.mouse_gestures.enabled, crate::i18n::tr_label("Ring of tools on the right button")); - if ui.button(crate::i18n::tr_label("Customize…")).clicked() { + crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut app.preferences.mouse_gestures.enabled); + if crate::ui_kit::button(ui, crate::i18n::tr_label("Customize…"), crate::ui_kit::Button::Normal).clicked() { app.gesture.editor.open = true; app.gesture.editor.studio = Studio::of(app); } @@ -584,7 +592,7 @@ pub(crate) fn nav_rows(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) { t.warning, crate::i18n::tr_label("Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans)."), ); - if ui.button(crate::i18n::tr_label("Use the SolidWorks mouse mode")).clicked() { + if crate::ui_kit::button(ui, crate::i18n::tr_label("Use the SolidWorks mouse mode"), crate::ui_kit::Button::Normal).clicked() { app.preferences.nav = MOUSE_MODE.to_string(); app.preferences.zoom_reverse = crate::prefs::nav_preset(MOUSE_MODE).reverse_zoom; } @@ -612,7 +620,7 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) { .id(egui::Id::new("sc_gesture_editor")) .open(&mut open) .show(ctx, |ui| { - ui.checkbox(&mut config.enabled, crate::i18n::tr_label("Ring of tools on the right button")); + crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut config.enabled); if app.preferences.nav != MOUSE_MODE { ui.colored_label( t.warning, @@ -621,12 +629,23 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) { } ui.horizontal(|ui| { ui.label(crate::i18n::tr_label("Studio")); - egui::ComboBox::from_id_salt("gesture_studio").selected_text(crate::i18n::tr_label(studio.label())).show_ui(ui, |ui| { - for s in Studio::ALL { - ui.selectable_value(&mut studio, s, crate::i18n::tr_label(s.label())); - } + ui.scope(|ui| { + ui.set_max_width(200.0); + crate::ui_kit::dropdown_menu(ui, "gesture_studio", crate::i18n::tr_label(studio.label()), |ui| { + for s in Studio::ALL { + if crate::ui_kit::list_picker(ui, s.label(), crate::i18n::tr_label(s.label()), studio == s).clicked() { + studio = s; + } + } + }); }); - if ui.add_enabled(config.is_custom(studio), egui::Button::new(crate::i18n::tr_label("Restore this studio's tools"))).clicked() { + if crate::ui_kit::button( + ui, + crate::i18n::tr_label("Restore this studio's tools"), + crate::ui_kit::Button::Enabled(config.is_custom(studio)), + ) + .clicked() + { config.reset(studio); } }); @@ -639,45 +658,50 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) { ui.set_min_width(330.0); ui.label( egui::RichText::new(format!("{} {}/{}", crate::i18n::tr_label("Tools, clockwise from the top"), list.len(), MAX_TOOLS)) - .size(11.0) + .size(t.font_small) .color(t.text_dim), ); for i in 0..list.len() { ui.horizontal(|ui| { ui.label(format!("{}", i + 1)); let shown = label_of(&list[i]).unwrap_or_default(); - egui::ComboBox::from_id_salt(("gesture_tool", i)).selected_text(shown).width(200.0).show_ui(ui, |ui| { - let filter_id = ui.id().with("filter"); - let mut filter: String = ui.data_mut(|d| d.get_temp(filter_id).unwrap_or_default()); - ui.add(egui::TextEdit::singleline(&mut filter).hint_text(crate::i18n::tr_label("Filter…"))); - ui.data_mut(|d| d.insert_temp(filter_id, filter.clone())); - let needle = filter.trim().to_lowercase(); - egui::ScrollArea::vertical().max_height(260.0).show(ui, |ui| { - for (id, label) in &catalog { - if !needle.is_empty() && !label.to_lowercase().contains(&needle) && !id.to_lowercase().contains(&needle) { - continue; + ui.scope(|ui| { + ui.set_max_width(200.0); + crate::ui_kit::dropdown_menu(ui, ("gesture_tool", i), &shown, |ui| { + let filter_id = ui.id().with("filter"); + let mut filter: String = ui.data_mut(|d| d.get_temp(filter_id).unwrap_or_default()); + crate::ui_kit::text_field(ui, &mut filter, crate::i18n::tr_label("Filter…")); + ui.data_mut(|d| d.insert_temp(filter_id, filter.clone())); + let needle = filter.trim().to_lowercase(); + egui::ScrollArea::vertical().max_height(260.0).show(ui, |ui| { + for (id, label) in &catalog { + if !needle.is_empty() && !label.to_lowercase().contains(&needle) && !id.to_lowercase().contains(&needle) { + continue; + } + let taken = list.contains(id) && *id != list[i]; + let r = ui.add_enabled_ui(!taken, |ui| crate::ui_kit::list_picker(ui, id, label, *id == list[i])).inner; + if r.clicked() { + op = Some(Op::Set(i, id.clone())); + ui.close(); + } } - let taken = list.contains(id) && *id != list[i]; - let r = ui.add_enabled(!taken, egui::Button::selectable(*id == list[i], label.as_str())); - if r.clicked() { - op = Some(Op::Set(i, id.clone())); - ui.close(); - } - } + }); }); }); - if ui.add_enabled(i > 0, egui::Button::new("↑")).clicked() { + if crate::ui_kit::button(ui, "↑", crate::ui_kit::Button::Enabled(i > 0)).clicked() { op = Some(Op::Up(i)); } - if ui.add_enabled(i + 1 < list.len(), egui::Button::new("↓")).clicked() { + if crate::ui_kit::button(ui, "↓", crate::ui_kit::Button::Enabled(i + 1 < list.len())).clicked() { op = Some(Op::Down(i)); } - if ui.add_enabled(list.len() > 1, egui::Button::new("×")).clicked() { + if crate::ui_kit::button(ui, "×", crate::ui_kit::Button::Enabled(list.len() > 1)).clicked() { op = Some(Op::Remove(i)); } }); } - if ui.add_enabled(list.len() < MAX_TOOLS, egui::Button::new(crate::i18n::tr_label("Add a tool"))).clicked() { + if crate::ui_kit::button(ui, crate::i18n::tr_label("Add a tool"), crate::ui_kit::Button::Enabled(list.len() < MAX_TOOLS)) + .clicked() + { op = Some(Op::Add); } }); diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 9f0c7e028..6d280a41b 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -544,11 +544,11 @@ fn file_menu(app: &mut SolveApp, ctx: &egui::Context) { close = true; } // The browser build: a copy as a downloaded file, whatever Save does. - if app.services.download_design.is_some() && item_if(ui, "Download design", "", shown) { + if app.services.download_design.is_some() && item_if(ui, "Download design", "", "export", shown) { download_design(app); close = true; } - if app.services.browser_files.is_some() && item(ui, "Files in this browser…", "") { + if app.services.browser_files.is_some() && item(ui, "Files in this browser…", "", "open") { if let Some(show) = &app.services.browser_files { show(); } diff --git a/crates/ui-egui/src/ui_kit_guard_tests.rs b/crates/ui-egui/src/ui_kit_guard_tests.rs index 592120737..7dfcce537 100644 --- a/crates/ui-egui/src/ui_kit_guard_tests.rs +++ b/crates/ui-egui/src/ui_kit_guard_tests.rs @@ -218,7 +218,7 @@ fn floating_window_helper_has_only_its_live_consumers() { } } callers.sort(); - assert_eq!(callers, ["bom_panel.rs", "messages.rs", "space_mouse_calibration.rs"]); + assert_eq!(callers, ["bom_panel.rs", "messages.rs", "mouse_gesture.rs", "space_mouse_calibration.rs"]); } #[test] diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index 4cf6e35b9..f9eb81915 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -5130,7 +5130,7 @@ mod tests { #[test] fn device_navigation_allows_face_clicks_and_preserves_modifier_selection() { for gpu in [false, true] { - for (modifiers, add) in [(egui::Modifiers::NONE, false), (egui::Modifiers::SHIFT, true), (egui::Modifiers::CTRL, true)] { + for (modifiers, add) in [(egui::Modifiers::NONE, false), (egui::Modifiers::SHIFT, true), (egui::Modifiers::COMMAND, true)] { let ctx = crate::fonts::test_context(); let mut app = device_face_app(gpu); let existing = Sel::Body { name: "Body1".into() }; diff --git a/crates/ui-egui/tests/point_alignment.rs b/crates/ui-egui/tests/point_alignment.rs index 5e526d868..3614eef38 100644 --- a/crates/ui-egui/tests/point_alignment.rs +++ b/crates/ui-egui/tests/point_alignment.rs @@ -195,6 +195,9 @@ fn shift_picks_midpoint_in_either_order_and_persists_ordinary_constraints() { h.app.run("sketch.line", json!({"points":[[10,10],[30,20]],"infer":false,"connect":false})).unwrap(); h.app.run("sketch.circle.center", json!({"center":target,"radius":3})).unwrap(); h.call("ui.view", json!({"view":"top"})); + // Keep both picks in the clear viewport beside the floating cards. + h.app.fit_view(); + h.frames(3); h.step(&json!({"start":"sketch.constraint.horizontal_vertical"})).unwrap(); let before = h.app.session.doc.to_json(); let undo = h.app.session.undo.len(); @@ -277,6 +280,9 @@ fn shift_can_align_two_midpoints_and_reveal_one_from_anywhere_on_the_line() { h.app.run("sketch.line", json!({"points":points,"infer":false,"connect":false})).unwrap(); } h.call("ui.view", json!({"view":"top"})); + // Keep both picks in the clear viewport beside the floating cards. + h.app.fit_view(); + h.frames(3); h.step(&json!({"start":"sketch.constraint.horizontal_vertical"})).unwrap(); h.step(&json!({"move":{"sketch":[13,11.5]},"shift":true})).unwrap(); let hover = h.app.tool.as_ref().unwrap().hover.as_ref().unwrap(); @@ -324,6 +330,9 @@ fn conflicting_midpoint_pick_keeps_pending_preview_without_creating_geometry() { h.app.run("sketch.circle.center", json!({"center":[24,50],"radius":3})).unwrap(); h.app.run("sketch.constraint.fix", json!({"entities":["l1","c1"]})).unwrap(); h.call("ui.view", json!({"view":"top"})); + // Keep both picks in the clear viewport beside the floating cards. + h.app.fit_view(); + h.frames(3); h.step(&json!({"start":"sketch.constraint.horizontal_vertical"})).unwrap(); let before = h.app.session.doc.to_json(); let undo = h.app.session.undo.len();