wip: refactor

This commit is contained in:
2025-02-01 14:54:53 +07:00
parent 944d3b9e46
commit 09a0d089bc
6 changed files with 34 additions and 61 deletions

View File

@@ -54,7 +54,7 @@ pub struct DockArea {
/// The panel style, default is [`PanelStyle::Default`](PanelStyle::Default).
pub(crate) panel_style: PanelStyle,
_subscriptions: Vec<Subscription>,
subscriptions: Vec<Subscription>,
}
/// DockItem is a tree structure that represents the layout of the dock.
@@ -316,7 +316,7 @@ impl DockArea {
bottom_dock: None,
is_locked: false,
panel_style: PanelStyle::Default,
_subscriptions: vec![],
subscriptions: vec![],
};
this.subscribe_panel(&stack_panel, window, cx);
@@ -535,6 +535,7 @@ impl DockArea {
cx: &mut Context<Self>,
) {
let weak_self = cx.entity().downgrade();
match placement {
DockPlacement::Left => {
if let Some(dock) = self.left_dock.as_ref() {
@@ -590,7 +591,7 @@ impl DockArea {
self.subscribe_item(item, window, cx);
}
self._subscriptions.push(cx.subscribe_in(
self.subscriptions.push(cx.subscribe_in(
view,
window,
move |_, _, event, window, cx| {
@@ -601,6 +602,7 @@ impl DockArea {
});
})
.detach();
cx.emit(DockEvent::LayoutChanged);
}
},
@@ -656,7 +658,7 @@ impl DockArea {
},
);
self._subscriptions.push(subscription);
self.subscriptions.push(subscription);
}
/// Returns the ID of the dock area.