fix: make full titlebar strip draggable in dock and sidebar

This commit is contained in:
2026-11-09 10:04:57 +07:00
parent 7784e8d570
commit 6815585528
4 changed files with 49 additions and 37 deletions
+29 -22
View File
@@ -286,36 +286,43 @@ fn sidebar_region(
.h(strip_height)
.bg(strip_background)
.items_center()
.justify_end()
.map(|strip| titlebar_strip(strip, window, cx))
.map(|strip| match side {
Side::Left => strip.when(cfg!(target_os = "macos"), |strip| {
strip.pl(px(TRAFFIC_LIGHT_PAD))
}),
Side::Right => strip.child(WindowControls::new("sidebar-window-controls")),
Side::Right => strip,
})
.px(padding_x)
.child(
Button::new(SharedString::from(format!(
"sidebar-toggle-{}",
side.name()
)))
.icon(side.toggle_icon())
.variant(ButtonVariant::Ghost)
.small()
.accessibility_label(side.toggle_label())
.on_click({
let state = state.clone();
move |_, _, cx| match side {
Side::Left => {
.child(titlebar_strip(
div()
.id(SharedString::from(format!(
"sidebar-strip-drag-{}",
side.name()
)))
.flex_1()
.self_stretch(),
window,
cx,
))
.map(|strip| match side {
Side::Left => strip.child(
Button::new(SharedString::from(format!(
"sidebar-toggle-{}",
side.name()
)))
.icon(side.toggle_icon())
.variant(ButtonVariant::Ghost)
.small()
.accessibility_label(side.toggle_label())
.on_click({
let state = state.clone();
move |_, _, cx| {
state.update(cx, |state, cx| state.set_left_sidebar_visible(false, cx))
}
Side::Right => {
state.update(cx, |state, cx| state.set_right_sidebar_visible(false, cx))
}
}
}),
);
}),
),
Side::Right => strip.child(WindowControls::new("sidebar-window-controls")),
});
v_flex()
.w(width)