forked from 1b-agent/opencadstudio-upstream
fix: resolve offset and theme regressions
Keep OFFSET picks current across newly created entities and preserve the command after pick-first offsets. Use palette-provided contrast colors for active status controls and Alias Editor removal buttons. Refs #653 Refs #658 Refs #659
This commit is contained in:
1 parent
62818cfd7b
commit
e35348525a
4 files changed
+50
-31
No files matched your search
+16
-2
@@ -449,6 +449,20 @@ pub fn themed_primary<'a, M: 'a>(bytes: &'static [u8], size: f32) -> Element<'a,
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Render an icon with the foreground chosen for a weak primary surface.
|
||||
pub fn themed_primary_weak_text<'a, M: 'a>(
|
||||
bytes: &'static [u8],
|
||||
size: f32,
|
||||
) -> Element<'a, M> {
|
||||
svg(svg::Handle::from_memory(bytes))
|
||||
.width(size)
|
||||
.height(size)
|
||||
.style(|theme: &Theme, _| svg::Style {
|
||||
color: Some(theme.palette().primary.weak.text),
|
||||
})
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Render a positive-state chrome icon with the active Iced theme's success color.
|
||||
pub fn themed_success<'a, M: 'a>(bytes: &'static [u8], size: f32) -> Element<'a, M> {
|
||||
svg(svg::Handle::from_memory(bytes))
|
||||
@@ -569,8 +583,8 @@ pub fn themed_arrow_left<'a, M: 'a>(size: f32) -> Element<'a, M> {
|
||||
themed(TRI_LEFT, size)
|
||||
}
|
||||
|
||||
pub fn themed_primary_arrow_down<'a, M: 'a>(size: f32) -> Element<'a, M> {
|
||||
themed_primary(TRI_DOWN, size)
|
||||
pub fn themed_primary_weak_arrow_down<'a, M: 'a>(size: f32) -> Element<'a, M> {
|
||||
themed_primary_weak_text(TRI_DOWN, size)
|
||||
}
|
||||
|
||||
pub fn themed_secondary_arrow_down<'a, M: 'a>(size: f32) -> Element<'a, M> {
|
||||
|
||||
+11
-11
@@ -636,7 +636,7 @@ fn tip_node<'a>(content: Element<'a, Message>, body: Element<'a, Message>) -> El
|
||||
/// call site already wraps it with.
|
||||
fn toggle_pill(icon: &'static [u8], active: bool, msg: Message) -> Element<'static, Message> {
|
||||
let icon = if active {
|
||||
crate::ui::icons::themed_primary(icon, 17.0)
|
||||
crate::ui::icons::themed_primary_weak_text(icon, 17.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_secondary(icon, 17.0)
|
||||
};
|
||||
@@ -646,12 +646,12 @@ fn toggle_pill(icon: &'static [u8], active: bool, msg: Message) -> Element<'stat
|
||||
let mut style = button::subtle(theme, status);
|
||||
if active {
|
||||
let palette = theme.palette();
|
||||
style.background = Some(Background::Color(match status {
|
||||
button::Status::Hovered => palette.primary.base.color,
|
||||
_ => palette.primary.weak.color,
|
||||
}));
|
||||
style.background = Some(Background::Color(palette.primary.weak.color));
|
||||
style.text_color = palette.primary.weak.text;
|
||||
style.border.color = palette.primary.base.color;
|
||||
style.border.color = match status {
|
||||
button::Status::Hovered => palette.primary.strong.color,
|
||||
_ => palette.primary.base.color,
|
||||
};
|
||||
style.border.width = 1.0;
|
||||
}
|
||||
style
|
||||
@@ -724,7 +724,7 @@ fn polar_pill<'a>(
|
||||
};
|
||||
|
||||
let polar_icon = if active {
|
||||
crate::ui::icons::themed_primary(crate::ui::icons::ST_POLAR, 17.0)
|
||||
crate::ui::icons::themed_primary_weak_text(crate::ui::icons::ST_POLAR, 17.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_secondary(crate::ui::icons::ST_POLAR, 17.0)
|
||||
};
|
||||
@@ -735,7 +735,7 @@ fn polar_pill<'a>(
|
||||
let palette = theme.palette();
|
||||
text::Style {
|
||||
color: Some(if active {
|
||||
palette.primary.base.color
|
||||
palette.primary.weak.text
|
||||
} else {
|
||||
palette.background.base.text.scale_alpha(0.72)
|
||||
}),
|
||||
@@ -759,7 +759,7 @@ fn polar_pill<'a>(
|
||||
menu_tip(
|
||||
mouse_area(
|
||||
container(if active {
|
||||
crate::ui::icons::themed_primary_arrow_down(9.0)
|
||||
crate::ui::icons::themed_primary_weak_arrow_down(9.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_secondary_arrow_down(9.0)
|
||||
})
|
||||
@@ -789,7 +789,7 @@ fn osnap_btn<'a>(
|
||||
) -> Element<'a, Message> {
|
||||
let on = active || snap_enabled;
|
||||
let snap_icon = if on {
|
||||
crate::ui::icons::themed_primary(crate::ui::icons::ST_OSNAP, 17.0)
|
||||
crate::ui::icons::themed_primary_weak_text(crate::ui::icons::ST_OSNAP, 17.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_secondary(crate::ui::icons::ST_OSNAP, 17.0)
|
||||
};
|
||||
@@ -804,7 +804,7 @@ fn osnap_btn<'a>(
|
||||
menu_tip(
|
||||
mouse_area(
|
||||
container(if on {
|
||||
crate::ui::icons::themed_primary_arrow_down(9.0)
|
||||
crate::ui::icons::themed_primary_weak_arrow_down(9.0)
|
||||
} else {
|
||||
crate::ui::icons::themed_secondary_arrow_down(9.0)
|
||||
})
|
||||
|
||||
@@ -64,7 +64,7 @@ pub fn view_window(
|
||||
.size(13)
|
||||
.padding([3, 6])
|
||||
.width(sizing.width);
|
||||
let del = button(crate::ui::icons::themed_danger(crate::ui::icons::CLOSE, 12.0))
|
||||
let del = button(crate::ui::icons::themed_danger_text(crate::ui::icons::CLOSE, 12.0))
|
||||
.on_press(Message::AliasEditorRemove(idx))
|
||||
.padding([2, 6])
|
||||
.style(button::danger);
|
||||
|
||||
Reference in new issue
Block a user