fix(ui): make modal layouts intrinsic

Pin Iced 0.15 so dialogs can measure content before distributing the resolved frame across child panels. Keep the web plugin notice compact and non-resizable.\n\nCloses #582
This commit is contained in:
Hakan Seven committed 2026-07-30 14:47:28 +03:00
1 parent 284d6ef517
commit 3ab8dc3ca5
59 files changed
+2197 -1652

No files matched your search

+18 -17
View File
@@ -9,18 +9,19 @@
use crate::app::Message;
use crate::ui::style::style_manager::{hdivider, muted_text_style, tb_button};
use iced::widget::{column, container, mouse_area, row, scrollable, text, Space};
use iced::{Background, Border, Element, Fill, Theme};
use iced::{Background, Border, Element, Theme};
/// `scales` is `(name, "paper:drawing" ratio, is_member)`. Every label is cloned
/// into the widget tree, so the returned element borrows nothing from the args.
pub fn view_window(
object_label: &str,
scales: &[(String, String, bool)],
sizing: crate::ui::modal::ModalSizing,
) -> Element<'static, Message> {
let toolbar = container(
row![
text(format!("Object: {object_label}")).size(11),
Space::new().width(Fill),
Space::new().width(sizing.width),
tb_button("Close", Message::CloseModal, true),
]
.spacing(4)
@@ -28,11 +29,11 @@ pub fn view_window(
)
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.weak.color
theme.palette().background.weak.color
)),
..Default::default()
})
.width(Fill)
.width(sizing.width)
.padding([5, 8]);
let rows: Vec<Element<'_, Message>> = scales
@@ -41,23 +42,23 @@ pub fn view_window(
let check = crate::ui::icons::themed_check_cell(*member);
let label = row![
check,
text(name.clone()).size(11).width(Fill),
text(name.clone()).size(11).width(sizing.width),
text(ratio.clone()).size(10).style(muted_text_style),
]
.spacing(4)
.align_y(iced::Center);
let cell = container(label)
.padding([4, 8])
.width(Fill);
.width(sizing.width);
mouse_area(cell)
.on_press(Message::AnnoObjectScaleToggle(name.clone()))
.into()
})
.collect();
let list = container(scrollable(column(rows).spacing(1)).height(Fill))
let list = container(scrollable(column(rows).spacing(1)).height(sizing.height))
.style(|theme: &Theme| {
let palette = theme.extended_palette();
let palette = theme.palette();
container::Style {
background: Some(Background::Color(palette.background.weak.color)),
border: Border {
@@ -68,8 +69,8 @@ pub fn view_window(
..Default::default()
}
})
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.padding(2);
let body = container(
@@ -80,20 +81,20 @@ pub fn view_window(
list,
]
.spacing(6)
.height(Fill),
.height(sizing.height),
)
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.padding(12);
container(column![toolbar, hdivider(), body])
container(column![toolbar, hdivider(sizing.width), body])
.style(|theme: &Theme| container::Style {
background: Some(Background::Color(
theme.extended_palette().background.base.color
theme.palette().background.base.color
)),
..Default::default()
})
.width(Fill)
.height(Fill)
.width(sizing.width)
.height(sizing.height)
.into()
}