forked from 1b-agent/opencadstudio-upstream
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:
1 parent
284d6ef517
commit
3ab8dc3ca5
59 files changed
+2197
-1652
No files matched your search
@@ -34,7 +34,7 @@ impl canvas::Program<Message> for GlyphCanvas {
|
||||
_cursor: mouse::Cursor,
|
||||
) -> Vec<canvas::Geometry> {
|
||||
let mut frame = canvas::Frame::new(renderer, bounds.size());
|
||||
let glyph = theme.extended_palette().background.base.text;
|
||||
let glyph = theme.palette().background.base.text;
|
||||
let (cx, cy) = (bounds.width * 0.5, bounds.height * 0.5);
|
||||
let r = bounds.width.min(bounds.height) * 0.30;
|
||||
let stroke = canvas::Stroke {
|
||||
@@ -83,7 +83,7 @@ fn cell<'a>(value: i16, selected: bool) -> Element<'a, Message> {
|
||||
.padding(0)
|
||||
.on_press(Message::PointStyleSetMode(value))
|
||||
.style(move |theme: &Theme, status| {
|
||||
let palette = theme.extended_palette();
|
||||
let palette = theme.palette();
|
||||
let pair = if selected {
|
||||
palette.primary.strong
|
||||
} else if matches!(status, button::Status::Hovered | button::Status::Pressed) {
|
||||
@@ -106,7 +106,7 @@ fn cell<'a>(value: i16, selected: bool) -> Element<'a, Message> {
|
||||
}
|
||||
|
||||
fn field_style(theme: &Theme, status: text_input::Status) -> text_input::Style {
|
||||
let palette = theme.extended_palette();
|
||||
let palette = theme.palette();
|
||||
let border = match status {
|
||||
text_input::Status::Focused { .. } => palette.primary.base.color,
|
||||
_ => palette.background.neutral.color,
|
||||
@@ -127,11 +127,18 @@ fn field_style(theme: &Theme, status: text_input::Status) -> text_input::Style {
|
||||
|
||||
fn muted_style(theme: &Theme) -> iced::widget::text::Style {
|
||||
iced::widget::text::Style {
|
||||
color: Some(theme.extended_palette().background.base.text.scale_alpha(0.68)),
|
||||
color: Some(theme.palette().background.base.text.scale_alpha(0.68)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn view_window<'a>(pdmode: i16, relative: bool, size_buf: &str) -> Element<'a, Message> {
|
||||
pub fn view_window<'a>(
|
||||
pdmode: i16,
|
||||
relative: bool,
|
||||
size_buf: &str,
|
||||
sizing: crate::ui::modal::ModalSizing,
|
||||
) -> Element<'a, Message> {
|
||||
let width = sizing.width;
|
||||
let height = sizing.height;
|
||||
// Glyph grid: a row per enclosure, a cell per shape.
|
||||
let mut grid = column![].spacing(6);
|
||||
for enc in ENCLOSURES {
|
||||
@@ -192,16 +199,20 @@ pub fn view_window<'a>(pdmode: i16, relative: bool, size_buf: &str) -> Element<'
|
||||
Space::new().height(8),
|
||||
radios,
|
||||
Space::new().height(12),
|
||||
row![Space::new().width(Length::Fill), ok],
|
||||
row![Space::new().width(width), ok].width(width),
|
||||
]
|
||||
.spacing(4)
|
||||
.padding(20),
|
||||
.padding(20)
|
||||
.width(width)
|
||||
.height(height),
|
||||
)
|
||||
.style(|theme: &Theme| container::Style {
|
||||
background: Some(Background::Color(
|
||||
theme.extended_palette().background.base.color
|
||||
theme.palette().background.base.color
|
||||
)),
|
||||
..Default::default()
|
||||
})
|
||||
.width(width)
|
||||
.height(height)
|
||||
.into()
|
||||
}
|
||||
Reference in new issue
Block a user