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