dock: Make the panel dock open state controllable (#429)

This commit is contained in:
Floyd Wang 2024-11-20 11:24:42 +08:00 committed by GitHub
parent e6012fcc8f
commit 8b23193f8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -268,9 +268,9 @@ impl StoryWorkspace {
_ = dock_area.update(cx, |view, cx| {
view.set_version(MAIN_DOCK_AREA.version, cx);
view.set_root(dock_item, cx);
view.set_left_dock(left_panels, Some(px(350.)), cx);
view.set_bottom_dock(bottom_panels, Some(px(200.)), cx);
view.set_right_dock(right_panels, Some(px(320.)), cx);
view.set_left_dock(left_panels, Some(px(350.)), true, cx);
view.set_bottom_dock(bottom_panels, Some(px(200.)), true, cx);
view.set_right_dock(right_panels, Some(px(320.)), true, cx);
Self::save_state(&view.dump(cx)).unwrap();
});

View file

@ -270,6 +270,7 @@ impl DockArea {
&mut self,
panel: DockItem,
size: Option<Pixels>,
open: bool,
cx: &mut ViewContext<Self>,
) {
self.subscribe_item(&panel, cx);
@ -280,6 +281,7 @@ impl DockArea {
dock.set_size(size, cx);
}
dock.set_panel(panel, cx);
dock.set_open(open, cx);
dock
}));
}
@ -288,6 +290,7 @@ impl DockArea {
&mut self,
panel: DockItem,
size: Option<Pixels>,
open: bool,
cx: &mut ViewContext<Self>,
) {
self.subscribe_item(&panel, cx);
@ -298,6 +301,7 @@ impl DockArea {
dock.set_size(size, cx);
}
dock.set_panel(panel, cx);
dock.set_open(open, cx);
dock
}));
}
@ -306,6 +310,7 @@ impl DockArea {
&mut self,
panel: DockItem,
size: Option<Pixels>,
open: bool,
cx: &mut ViewContext<Self>,
) {
self.subscribe_item(&panel, cx);
@ -316,6 +321,7 @@ impl DockArea {
dock.set_size(size, cx);
}
dock.set_panel(panel, cx);
dock.set_open(open, cx);
dock
}));
}