GPUI change proposals
This commit is contained in:
parent
4d88088ca4
commit
b2fa511acd
5 changed files with 24 additions and 9 deletions
|
@ -306,8 +306,11 @@ impl Presenter {
|
|||
.as_ref()
|
||||
.zip(self.prev_drag_position.as_mut())
|
||||
{
|
||||
dragged_region =
|
||||
Some((clicked_region.clone(), position - *prev_drag_position));
|
||||
dragged_region = Some((
|
||||
clicked_region.clone(),
|
||||
position - *prev_drag_position,
|
||||
position,
|
||||
));
|
||||
*prev_drag_position = position;
|
||||
}
|
||||
|
||||
|
@ -366,11 +369,11 @@ impl Presenter {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((dragged_region, delta)) = dragged_region {
|
||||
if let Some((dragged_region, delta, position)) = dragged_region {
|
||||
handled = true;
|
||||
if let Some(drag_callback) = dragged_region.drag {
|
||||
event_cx.with_current_view(dragged_region.view_id, |event_cx| {
|
||||
drag_callback(delta, event_cx);
|
||||
drag_callback(delta, position, event_cx);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -648,6 +651,15 @@ impl<'a> PaintContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn paint_layer<F>(&mut self, clip_bounds: Option<RectF>, f: F)
|
||||
where
|
||||
F: FnOnce(&mut Self) -> (),
|
||||
{
|
||||
self.scene.push_layer(clip_bounds);
|
||||
f(self);
|
||||
self.scene.pop_layer();
|
||||
}
|
||||
|
||||
pub fn current_view_id(&self) -> usize {
|
||||
*self.view_stack.last().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue