forked from 1b-agent/opencadstudio-upstream
fix(styles): re-seed missing Standard styles on open; titled modals (#366)
Deleting/renaming Standard was already blocked in the five style managers, but a file saved without the built-ins (foreign or damaged) opened with broken style dropdowns and nothing to reference — re-seed missing Standard text/dim/table/mleader/mline styles on every open. Every modal dialog now shows its name in the title bar: centred at 15px across the dialog width, with the move grip and close button overlaid at the right edge. The bar takes an explicit width from the caller — a Fill child inside the Shrink frame would blow the dialog out to the full screen. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
bd27ee31d0
commit
ac14e0041d
7 files changed
+127
-1
No files matched your search
+24
-1
@@ -45,6 +45,8 @@ const GRIP_C: Color = Color {
|
||||
/// title bar; pass `Vector::ZERO` to keep it centred.
|
||||
pub fn modal<'a>(
|
||||
base: impl Into<Element<'a, Message>>,
|
||||
title: &'a str,
|
||||
title_width: f32,
|
||||
content: impl Into<Element<'a, Message>>,
|
||||
on_close: Message,
|
||||
offset: Vector,
|
||||
@@ -83,7 +85,28 @@ pub fn modal<'a>(
|
||||
.on_press(Message::ModalGrab)
|
||||
.interaction(iced::mouse::Interaction::Grab);
|
||||
|
||||
let title_bar = row![grip, close].spacing(6).align_y(iced::Center);
|
||||
// The dialog name is centred across the dialog width with the grip + ✕
|
||||
// overlaid at the right edge. The bar takes an explicit `title_width`
|
||||
// (the caller's content width) instead of `Fill` — a Fill child inside
|
||||
// the Shrink frame would blow the dialog out to the full screen.
|
||||
let title_text = iced::widget::text(title).size(15).color(Color {
|
||||
r: 0.88,
|
||||
g: 0.88,
|
||||
b: 0.88,
|
||||
a: 1.0,
|
||||
});
|
||||
let title_bar = stack![
|
||||
container(title_text)
|
||||
.width(Length::Fixed(title_width))
|
||||
.height(Length::Fixed(24.0))
|
||||
.align_x(iced::alignment::Horizontal::Center)
|
||||
.align_y(iced::alignment::Vertical::Center),
|
||||
container(row![grip, close].spacing(6).align_y(iced::Center))
|
||||
.width(Length::Fixed(title_width))
|
||||
.height(Length::Fixed(24.0))
|
||||
.align_x(iced::alignment::Horizontal::Right)
|
||||
.align_y(iced::alignment::Vertical::Center),
|
||||
];
|
||||
|
||||
let panel_style = |_: &Theme| container::Style {
|
||||
background: Some(Background::Color(PANEL)),
|
||||
|
||||
Reference in new issue
Block a user