WIP
This commit is contained in:
parent
be3c0ff419
commit
676f6f490e
3 changed files with 11 additions and 18 deletions
|
@ -1221,10 +1221,8 @@ impl Interactivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg!("!!!!!!!!!!!!");
|
|
||||||
let interactive_bounds = interactive_bounds.clone();
|
let interactive_bounds = interactive_bounds.clone();
|
||||||
cx.on_mouse_event(move |event: &MouseUpEvent, phase, cx| {
|
cx.on_mouse_event(move |event: &MouseUpEvent, phase, cx| {
|
||||||
dbg!("hey");
|
|
||||||
if phase == DispatchPhase::Bubble
|
if phase == DispatchPhase::Bubble
|
||||||
&& interactive_bounds.visibly_contains(&event.position, cx)
|
&& interactive_bounds.visibly_contains(&event.position, cx)
|
||||||
{
|
{
|
||||||
|
@ -1259,7 +1257,6 @@ impl Interactivity {
|
||||||
&global_element_id,
|
&global_element_id,
|
||||||
|element_state, _cx| {
|
|element_state, _cx| {
|
||||||
if let Some(element_state) = element_state {
|
if let Some(element_state) = element_state {
|
||||||
dbg!("setting pending mouse down");
|
|
||||||
element_state.pending_mouse_down = Some(event.clone());
|
element_state.pending_mouse_down = Some(event.clone());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1456,10 +1453,10 @@ impl Interactivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(group) = self.group.clone() {
|
if let Some(group) = self.group.clone() {
|
||||||
GroupBounds::push(group, bounds, cx);
|
GroupBounds::push(group, bounds, cx);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let scroll_offset = element_state
|
let scroll_offset = element_state
|
||||||
|
@ -1510,10 +1507,8 @@ impl Interactivity {
|
||||||
cx.with_element_id(self.element_id.clone(), |global_element_id, cx| {
|
cx.with_element_id(self.element_id.clone(), |global_element_id, cx| {
|
||||||
if let Some(global_element_id) = global_element_id {
|
if let Some(global_element_id) = global_element_id {
|
||||||
cx.with_element_state(&global_element_id, |element_state, cx| {
|
cx.with_element_state(&global_element_id, |element_state, cx| {
|
||||||
let mut element_state = element_state.get_or_insert_with(|| {
|
let mut element_state = element_state
|
||||||
println!("default InteractiveElementState");
|
.get_or_insert_with(|| Box::<InteractiveElementState>::default());
|
||||||
Box::<InteractiveElementState>::default()
|
|
||||||
});
|
|
||||||
f(self, Some((&global_element_id, &mut element_state)), cx)
|
f(self, Some((&global_element_id, &mut element_state)), cx)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
Bounds, Element, ElementId, InteractiveElement, InteractiveElementState, Interactivity,
|
Bounds, Element, ElementId, InteractiveElement, Interactivity, IntoElement, LayoutId, Pixels,
|
||||||
IntoElement, LayoutId, Pixels, SharedString, StyleRefinement, Styled, WindowContext,
|
SharedString, StyleRefinement, Styled, WindowContext,
|
||||||
};
|
};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
|
||||||
|
@ -33,12 +33,8 @@ impl Element for Svg {
|
||||||
(layout_id, ())
|
(layout_id, ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paint(
|
fn paint(&mut self, bounds: Bounds<Pixels>, _: &mut Self::FrameState, cx: &mut WindowContext)
|
||||||
&mut self,
|
where
|
||||||
bounds: Bounds<Pixels>,
|
|
||||||
element_state: &mut Self::FrameState,
|
|
||||||
cx: &mut WindowContext,
|
|
||||||
) where
|
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
self.interactivity
|
self.interactivity
|
||||||
|
|
|
@ -1465,7 +1465,9 @@ extern "C" fn display_layer(this: &Object, _: Sel, _: id) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let window_state = get_window_state(this);
|
let window_state = get_window_state(this);
|
||||||
let mut draw = window_state.lock().draw.take().unwrap();
|
let mut draw = window_state.lock().draw.take().unwrap();
|
||||||
|
let t0 = std::time::Instant::now();
|
||||||
let scene = draw().log_err();
|
let scene = draw().log_err();
|
||||||
|
eprintln!("window draw: {:?}", t0.elapsed());
|
||||||
let mut window_state = window_state.lock();
|
let mut window_state = window_state.lock();
|
||||||
window_state.draw = Some(draw);
|
window_state.draw = Some(draw);
|
||||||
if let Some(scene) = scene {
|
if let Some(scene) = scene {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue