This commit is contained in:
Nathan Sobo 2023-04-11 21:56:37 -06:00
parent e6cc132b19
commit d9e4136b02
14 changed files with 235 additions and 150 deletions

View file

@ -315,7 +315,7 @@ impl Dock {
theme: &Theme,
anchor: DockAnchor,
cx: &mut ViewContext<Workspace>,
) -> Option<ElementBox<Self>> {
) -> Option<ElementBox<Workspace>> {
let style = &theme.workspace.dock;
self.position
@ -350,7 +350,7 @@ impl Dock {
let resizable = Container::new(ChildView::new(&self.pane, cx).boxed())
.with_style(panel_style)
.with_resize_handle::<DockResizeHandle, _>(
.with_resize_handle::<DockResizeHandle>(
resize_side as usize,
resize_side,
4.,
@ -362,8 +362,8 @@ impl Dock {
);
let size = resizable.current_size();
let workspace = cx.handle();
cx.defer(move |cx| {
let workspace = cx.handle().downgrade();
cx.defer(move |_, cx| {
if let Some(workspace) = workspace.upgrade(cx) {
workspace.update(cx, |workspace, _| {
workspace.dock.panel_sizes.insert(anchor, size);
@ -374,20 +374,20 @@ impl Dock {
if anchor == DockAnchor::Right {
resizable
.constrained()
.dynamically(|constraint, cx| {
.dynamically(|constraint, _, cx| {
SizeConstraint::new(
Vector2F::new(20., constraint.min.y()),
Vector2F::new(cx.window_size.x() * 0.8, constraint.max.y()),
Vector2F::new(cx.window_size().x() * 0.8, constraint.max.y()),
)
})
.boxed()
} else {
resizable
.constrained()
.dynamically(|constraint, cx| {
.dynamically(|constraint, _, cx| {
SizeConstraint::new(
Vector2F::new(constraint.min.x(), 50.),
Vector2F::new(constraint.max.x(), cx.window_size.y() * 0.8),
Vector2F::new(constraint.max.x(), cx.window_size().y() * 0.8),
)
})
.boxed()
@ -399,21 +399,21 @@ impl Dock {
Stack::new()
.with_child(
// Render wash under the dock which when clicked hides it
MouseEventHandler::<ExpandedDockWash>::new(0, cx, |_, _| {
MouseEventHandler::<ExpandedDockWash, _>::new(0, cx, |_, _| {
Empty::new()
.contained()
.with_background_color(style.wash_color)
.boxed()
})
.capture_all()
.on_down(MouseButton::Left, |_, cx| {
.on_down(MouseButton::Left, |_, _, cx| {
cx.dispatch_action(HideDock);
})
.with_cursor_style(CursorStyle::Arrow)
.boxed(),
)
.with_child(
MouseEventHandler::<ExpandedDockPane>::new(0, cx, |_state, cx| {
MouseEventHandler::<ExpandedDockPane, _>::new(0, cx, |_state, cx| {
ChildView::new(&self.pane, cx).boxed()
})
// Make sure all events directly under the dock pane