mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Avoid double borrow of view in ProjectPanel drag and drop
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
31e906d068
commit
f12746c4b7
1 changed files with 6 additions and 11 deletions
|
@ -1156,7 +1156,6 @@ impl ProjectPanel {
|
|||
theme: &theme::ProjectPanel,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
let this = cx.handle().downgrade();
|
||||
let kind = details.kind;
|
||||
let path = details.path.clone();
|
||||
let padding = theme.container.padding.left + details.depth as f32 * theme.indent_width;
|
||||
|
@ -1231,21 +1230,17 @@ impl ProjectPanel {
|
|||
});
|
||||
}
|
||||
})
|
||||
.on_move(move |_, _, cx| {
|
||||
.on_move(move |_, this, cx| {
|
||||
if cx
|
||||
.global::<DragAndDrop<Workspace>>()
|
||||
.currently_dragged::<ProjectEntryId>(cx.window_id())
|
||||
.is_some()
|
||||
{
|
||||
if let Some(this) = this.upgrade(cx) {
|
||||
this.update(cx, |this, _| {
|
||||
this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {
|
||||
path.parent().map(|parent| Arc::from(parent))
|
||||
} else {
|
||||
Some(path.clone())
|
||||
};
|
||||
})
|
||||
}
|
||||
this.dragged_entry_destination = if matches!(kind, EntryKind::File(_)) {
|
||||
path.parent().map(|parent| Arc::from(parent))
|
||||
} else {
|
||||
Some(path.clone())
|
||||
};
|
||||
}
|
||||
})
|
||||
.as_draggable(entry_id, {
|
||||
|
|
Loading…
Reference in a new issue