forked from 1b-agent/opencadstudio-upstream
fix(styles): make double-click inline rename actually fire
The list row wrapped a `button` inside the `mouse_area`. The button captured the press, so the parent `mouse_area` never saw the second click and `on_double_click` never fired — double-clicking a style name did nothing. Drop the inner button: the row is now a plain `mouse_area` carrying both `on_press` (select) and `on_double_click` (start rename), with selection shown via the container background. Focus the rename field on start so the user can type immediately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2dfd01795
commit
65a25033bc
3 files changed
+47
-42
No files matched your search
+1
-24
@@ -48,12 +48,6 @@ const ACCENT: Color = Color {
|
||||
b: 0.85,
|
||||
a: 1.0,
|
||||
};
|
||||
const ACTIVE: Color = Color {
|
||||
r: 0.20,
|
||||
g: 0.40,
|
||||
b: 0.70,
|
||||
a: 1.0,
|
||||
};
|
||||
const LIST: Color = Color {
|
||||
r: 0.12,
|
||||
g: 0.12,
|
||||
@@ -128,11 +122,11 @@ pub fn view<'a, 'b>(s: Scaffold<'a, 'b>) -> Element<'a, Message> {
|
||||
crate::ui::style_list::item(
|
||||
name,
|
||||
label,
|
||||
is_sel,
|
||||
s.kind,
|
||||
(s.on_select)(name.clone()),
|
||||
s.rename_active,
|
||||
s.rename_buf,
|
||||
list_item(is_sel),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
@@ -222,23 +216,6 @@ fn btn_s(accent: bool) -> impl Fn(&Theme, Status) -> Style {
|
||||
}
|
||||
}
|
||||
|
||||
fn list_item(active: bool) -> impl Fn(&Theme, Status) -> Style {
|
||||
move |_: &Theme, st| Style {
|
||||
background: Some(Background::Color(match (active, st) {
|
||||
(true, _) => ACTIVE,
|
||||
(false, Status::Hovered | Status::Pressed) => Color {
|
||||
r: 0.26,
|
||||
g: 0.26,
|
||||
b: 0.26,
|
||||
a: 1.0,
|
||||
},
|
||||
_ => Color::TRANSPARENT,
|
||||
})),
|
||||
text_color: TEXT,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn hdivider<'a>() -> Element<'a, Message> {
|
||||
container(Space::new().width(Fill).height(1))
|
||||
.width(Fill)
|
||||
|
||||
Reference in new issue
Block a user