Fix dock resizing (#3663)

This fixes some bugs in the display and tracking of dock resizes

Release Notes:

-
This commit is contained in:
Mikayla Maki
2023-12-14 16:20:29 -08:00
committed by GitHub
3 changed files with 31 additions and 20 deletions
+4 -4
View File
@@ -27,7 +27,7 @@ impl IntoElement for Canvas {
}
impl Element for Canvas {
type State = ();
type State = Style;
fn layout(
&mut self,
@@ -37,11 +37,11 @@ impl Element for Canvas {
let mut style = Style::default();
style.refine(&self.style);
let layout_id = cx.request_layout(&style, []);
(layout_id, ())
(layout_id, style)
}
fn paint(self, bounds: Bounds<Pixels>, _: &mut (), cx: &mut WindowContext) {
(self.paint_callback)(&bounds, cx)
fn paint(self, bounds: Bounds<Pixels>, style: &mut Style, cx: &mut WindowContext) {
style.paint(bounds, cx, |cx| (self.paint_callback)(&bounds, cx));
}
}
+2 -2
View File
@@ -213,7 +213,7 @@ pub trait InteractiveElement: Sized {
listener: impl Fn(&DragMoveEvent<T>, &mut WindowContext) + 'static,
) -> Self
where
T: Render,
T: 'static,
{
self.interactivity().mouse_move_listeners.push(Box::new(
move |event, bounds, phase, cx| {
@@ -223,7 +223,7 @@ pub trait InteractiveElement: Sized {
if cx
.active_drag
.as_ref()
.is_some_and(|drag| drag.value.type_id() == TypeId::of::<T>())
.is_some_and(|drag| (*drag.value).type_id() == TypeId::of::<T>())
{
(listener)(
&DragMoveEvent {