Move project panel's dispatch_context() to render()
This commit is contained in:
parent
f922ad9f7f
commit
9849a0a6d8
1 changed files with 35 additions and 37 deletions
|
@ -1355,7 +1355,7 @@ impl ProjectPanel {
|
|||
details: EntryDetails,
|
||||
// dragged_entry_destination: &mut Option<Arc<Path>>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Div {
|
||||
) -> ListItem {
|
||||
let kind = details.kind;
|
||||
let settings = ProjectPanelSettings::get_global(cx);
|
||||
let show_editor = details.is_editing && !details.is_processing;
|
||||
|
@ -1374,7 +1374,6 @@ impl ProjectPanel {
|
|||
})
|
||||
.unwrap_or(theme.status().info);
|
||||
|
||||
div().key_context(self.dispatch_context(cx)).child(
|
||||
ListItem::new(entry_id.to_proto() as usize)
|
||||
.indent_level(details.depth)
|
||||
.indent_step_size(px(settings.indent_size))
|
||||
|
@ -1412,8 +1411,7 @@ impl ProjectPanel {
|
|||
}))
|
||||
.on_secondary_mouse_down(cx.listener(move |this, event: &MouseDownEvent, cx| {
|
||||
this.deploy_context_menu(event.position, entry_id, cx);
|
||||
})),
|
||||
)
|
||||
}))
|
||||
// .on_drop::<ProjectEntryId>(|this, event, cx| {
|
||||
// this.move_entry(
|
||||
// *dragged_entry,
|
||||
|
@ -1426,8 +1424,8 @@ impl ProjectPanel {
|
|||
|
||||
fn dispatch_context(&self, cx: &ViewContext<Self>) -> KeyContext {
|
||||
let mut dispatch_context = KeyContext::default();
|
||||
dispatch_context.add("ProjectPanel");
|
||||
dispatch_context.add("menu");
|
||||
dispatch_context.add("not_editing");
|
||||
|
||||
let identifier = if self.filename_editor.focus_handle(cx).is_focused(cx) {
|
||||
"editing"
|
||||
|
@ -1452,7 +1450,7 @@ impl Render for ProjectPanel {
|
|||
.id("project-panel")
|
||||
.size_full()
|
||||
.relative()
|
||||
.key_context("ProjectPanel")
|
||||
.key_context(self.dispatch_context(cx))
|
||||
.on_action(cx.listener(Self::select_next))
|
||||
.on_action(cx.listener(Self::select_prev))
|
||||
.on_action(cx.listener(Self::expand_selected_entry))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue