mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
fixed merge errors
This commit is contained in:
parent
133c194f4a
commit
ab9f073443
3 changed files with 74 additions and 110 deletions
|
@ -284,15 +284,11 @@ impl Presenter {
|
|||
{
|
||||
events_to_send.push((
|
||||
clicked_region.clone(),
|
||||
<<<<<<< HEAD
|
||||
MouseRegionEvent::Drag(*prev_drag_position, *e),
|
||||
=======
|
||||
MouseRegionEvent::Drag(DragRegionEvent {
|
||||
region: clicked_region.bounds,
|
||||
prev_drag_position: *prev_drag_position,
|
||||
platform_event: e.clone(),
|
||||
}),
|
||||
>>>>>>> 4bd8a4b0 (wip tab drag and drop)
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -313,7 +309,7 @@ impl Presenter {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
let (invalidated_views, dispatch_directives, handled) = {
|
||||
let (invalidated_views, handled) = {
|
||||
let mut event_cx = self.handle_hover_events(&event, cx);
|
||||
event_cx.process_region_events(events_to_send);
|
||||
|
||||
|
@ -321,25 +317,9 @@ impl Presenter {
|
|||
event_cx.handled = event_cx.dispatch_event(root_view_id, &event);
|
||||
}
|
||||
|
||||
if let Some(callback) = region.handlers.get(&event.handler_key()) {
|
||||
event_cx.with_current_view(region.view_id, |event_cx| {
|
||||
callback(event, event_cx);
|
||||
})
|
||||
}
|
||||
|
||||
(
|
||||
event_cx.invalidated_views,
|
||||
event_cx.dispatched_actions,
|
||||
event_cx.handled,
|
||||
)
|
||||
(event_cx.invalidated_views, event_cx.handled)
|
||||
};
|
||||
|
||||
if !handled {
|
||||
handled = event_cx.dispatch_event(root_view_id, &event);
|
||||
}
|
||||
|
||||
invalidated_views.extend(event_cx.invalidated_views);
|
||||
|
||||
for view_id in invalidated_views {
|
||||
cx.notify_view(self.window_id, view_id);
|
||||
}
|
||||
|
@ -400,23 +380,23 @@ impl Presenter {
|
|||
}
|
||||
}
|
||||
} else if let Some(region_id) = region.id() {
|
||||
if self.hovered_region_ids.contains(®ion_id) {
|
||||
let region_event = if pressed_button.is_some() {
|
||||
MouseRegionEvent::DragOver(DragOverRegionEvent {
|
||||
region: region.bounds,
|
||||
started: false,
|
||||
platform_event: e.clone(),
|
||||
})
|
||||
} else {
|
||||
MouseRegionEvent::Hover(HoverRegionEvent {
|
||||
region: region.bounds,
|
||||
started: false,
|
||||
platform_event: e.clone(),
|
||||
})
|
||||
};
|
||||
events_to_send.push((region.clone(), region_event));
|
||||
self.hovered_region_ids.remove(®ion_id);
|
||||
}
|
||||
if self.hovered_region_ids.contains(®ion_id) {
|
||||
let region_event = if pressed_button.is_some() {
|
||||
MouseRegionEvent::DragOver(DragOverRegionEvent {
|
||||
region: region.bounds,
|
||||
started: false,
|
||||
platform_event: e.clone(),
|
||||
})
|
||||
} else {
|
||||
MouseRegionEvent::Hover(HoverRegionEvent {
|
||||
region: region.bounds,
|
||||
started: false,
|
||||
platform_event: e.clone(),
|
||||
})
|
||||
};
|
||||
events_to_send.push((region.clone(), region_event));
|
||||
self.hovered_region_ids.remove(®ion_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,75 +421,60 @@ impl TerminalEl {
|
|||
let drag_connection = self.terminal;
|
||||
cx.scene.push_mouse_region(
|
||||
MouseRegion::new(view_id, None, visible_bounds)
|
||||
.on_down(
|
||||
MouseButton::Left,
|
||||
move |MouseButtonEvent { position, .. }, cx| {
|
||||
if let Some(conn_handle) = mouse_down_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
.on_down(MouseButton::Left, move |e, cx| {
|
||||
if let Some(conn_handle) = mouse_down_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
e.position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
|
||||
terminal.mouse_down(point, side);
|
||||
terminal.mouse_down(point, side);
|
||||
|
||||
cx.notify();
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
.on_click(
|
||||
MouseButton::Left,
|
||||
move |MouseButtonEvent {
|
||||
position,
|
||||
click_count,
|
||||
..
|
||||
},
|
||||
cx| {
|
||||
cx.focus_parent_view();
|
||||
if let Some(conn_handle) = click_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
cx.notify();
|
||||
})
|
||||
}
|
||||
})
|
||||
.on_click(MouseButton::Left, move |e, cx| {
|
||||
cx.focus_parent_view();
|
||||
if let Some(conn_handle) = click_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
e.position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
|
||||
terminal.click(point, side, click_count);
|
||||
terminal.click(point, side, e.click_count);
|
||||
|
||||
cx.notify();
|
||||
});
|
||||
}
|
||||
},
|
||||
)
|
||||
.on_click(
|
||||
MouseButton::Right,
|
||||
move |MouseButtonEvent { position, .. }, cx| {
|
||||
cx.dispatch_action(DeployContextMenu { position });
|
||||
},
|
||||
)
|
||||
.on_drag(
|
||||
MouseButton::Left,
|
||||
move |_, MouseMovedEvent { position, .. }, cx| {
|
||||
if let Some(conn_handle) = drag_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
cx.notify();
|
||||
});
|
||||
}
|
||||
})
|
||||
.on_click(MouseButton::Right, move |e, cx| {
|
||||
cx.dispatch_action(DeployContextMenu {
|
||||
position: e.position,
|
||||
});
|
||||
})
|
||||
.on_drag(MouseButton::Left, move |e, cx| {
|
||||
if let Some(conn_handle) = drag_connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
let (point, side) = TerminalEl::mouse_to_cell_data(
|
||||
e.position,
|
||||
origin,
|
||||
cur_size,
|
||||
display_offset,
|
||||
);
|
||||
|
||||
terminal.drag(point, side);
|
||||
terminal.drag(point, side);
|
||||
|
||||
cx.notify()
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
cx.notify()
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ use gpui::{
|
|||
impl_actions, impl_internal_actions,
|
||||
platform::{CursorStyle, NavigationDirection},
|
||||
AnyViewHandle, AnyWeakViewHandle, AppContext, AsyncAppContext, Entity, EventContext,
|
||||
ModelHandle, MouseButton, MouseButtonEvent, MutableAppContext, PromptLevel, Quad,
|
||||
RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
ModelHandle, MouseButton, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
use serde::Deserialize;
|
||||
|
@ -1143,12 +1143,11 @@ impl View for Pane {
|
|||
},
|
||||
)
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_down(
|
||||
MouseButton::Left,
|
||||
|MouseButtonEvent { position, .. }, cx| {
|
||||
cx.dispatch_action(DeployNewMenu { position });
|
||||
},
|
||||
)
|
||||
.on_down(MouseButton::Left, |e, cx| {
|
||||
cx.dispatch_action(DeployNewMenu {
|
||||
position: e.position,
|
||||
});
|
||||
})
|
||||
.boxed(),
|
||||
MouseEventHandler::new::<SplitIcon, _, _>(
|
||||
1,
|
||||
|
|
Loading…
Reference in a new issue