mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Part of #1358: the Image Trace section no longer widens the Properties panel
Its View row asked for the row's whole width for its menu before its label was laid out, so the row ran past the panel, the panel's content grew and the start of every label was cut off.
This commit is contained in:
1 parent
f97b24b388
commit
268a4452f9
1 file changed
+27
-1
@@ -114,7 +114,8 @@ fn set_view(app: &mut VectorcraftApp, view: TraceView) {
|
||||
/// The selected Image Trace object's View row (Control bar, Properties).
|
||||
pub(crate) fn view_row(app: &mut VectorcraftApp, ui: &mut Ui, current: TraceView, width: f32) {
|
||||
widgets::dim_label(ui, tl!("View:"));
|
||||
if let Some(v) = view_dropdown(ui, current, width) {
|
||||
// No wider than what the label leaves of the row (#1358).
|
||||
if let Some(v) = view_dropdown(ui, current, width.min(ui.available_width())) {
|
||||
set_view(app, v);
|
||||
}
|
||||
}
|
||||
@@ -419,6 +420,31 @@ mod tests {
|
||||
app
|
||||
}
|
||||
|
||||
/// #1358: in Properties the View row fits the panel, so the panel doesn't widen and clip its
|
||||
/// labels (the row took the panel's whole width for its menu, beside its label).
|
||||
#[test]
|
||||
fn the_view_row_fits_the_properties_panel() {
|
||||
let mut app = traced_app();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
// Where the panel's content ends after a few frames.
|
||||
let right = |app: &mut VectorcraftApp| {
|
||||
let mut right = 0.0;
|
||||
for _ in 0..3 {
|
||||
let screen = Rect::from_min_size(Pos2::ZERO, vec2(280.0, 700.0));
|
||||
let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| {
|
||||
crate::panels::properties::show(app, ui);
|
||||
right = ui.min_rect().right();
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
right
|
||||
};
|
||||
let traced = right(&mut app);
|
||||
app.run("select.none", json!({})).unwrap();
|
||||
assert_eq!(traced, right(&mut app));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn advanced_is_a_section_that_stays_as_it_was_left() {
|
||||
let mut app = traced_app();
|
||||
|
||||
Reference in new issue
Block a user