Introduce ReorderBehavior to pane, and address drag and drop offset error

This commit is contained in:
K Simmons 2022-08-23 15:41:59 -07:00
parent 9d20b66f2e
commit de3acbd75b
4 changed files with 141 additions and 93 deletions

View file

@ -1535,7 +1535,9 @@ impl Workspace {
.map(|ix| (pane.clone(), ix))
});
if let Some((pane, ix)) = result {
pane.update(cx, |pane, cx| pane.activate_item(ix, true, true, false, cx));
pane.update(cx, |pane, cx| {
pane.activate_item(ix, true, true, ReorderBehavior::None, cx)
});
true
} else {
false
@ -3004,7 +3006,7 @@ mod tests {
let close_items = workspace.update(cx, |workspace, cx| {
pane.update(cx, |pane, cx| {
pane.activate_item(1, true, true, false, cx);
pane.activate_item(1, true, true, ReorderBehavior::None, cx);
assert_eq!(pane.active_item().unwrap().id(), item2.id());
});
@ -3106,7 +3108,7 @@ mod tests {
workspace.add_item(Box::new(cx.add_view(|_| item.clone())), cx);
}
left_pane.update(cx, |pane, cx| {
pane.activate_item(2, true, true, false, cx);
pane.activate_item(2, true, true, ReorderBehavior::None, cx);
});
workspace