|
@@ -335,76 +335,60 @@ impl InnerInputState {
|
|
|
|
|
|
{
|
|
|
// mouseup
|
|
|
- let mut will_bubble = FxHashSet::default();
|
|
|
- for node in dom.get_listening_sorted("mouseup") {
|
|
|
- let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
- let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
+ if released {
|
|
|
+ let mut will_bubble = FxHashSet::default();
|
|
|
+ for node in dom.get_listening_sorted("mouseup") {
|
|
|
+ let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
+ let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
|
|
|
- if currently_contains && released {
|
|
|
- try_create_event(
|
|
|
- "mouseup",
|
|
|
- Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
- &mut will_bubble,
|
|
|
- resolved_events,
|
|
|
- node,
|
|
|
- dom,
|
|
|
- );
|
|
|
+ if currently_contains {
|
|
|
+ try_create_event(
|
|
|
+ "mouseup",
|
|
|
+ Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
+ &mut will_bubble,
|
|
|
+ resolved_events,
|
|
|
+ node,
|
|
|
+ dom,
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
{
|
|
|
// click
|
|
|
- let mut will_bubble = FxHashSet::default();
|
|
|
- for node in dom.get_listening_sorted("click") {
|
|
|
- let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
- let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
+ if mouse_data.button == 0 && released {
|
|
|
+ let mut will_bubble = FxHashSet::default();
|
|
|
+ for node in dom.get_listening_sorted("click") {
|
|
|
+ let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
+ let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
|
|
|
- if currently_contains && released && mouse_data.button == 0 {
|
|
|
- try_create_event(
|
|
|
- "click",
|
|
|
- Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
- &mut will_bubble,
|
|
|
- resolved_events,
|
|
|
- node,
|
|
|
- dom,
|
|
|
- );
|
|
|
+ if currently_contains {
|
|
|
+ try_create_event(
|
|
|
+ "click",
|
|
|
+ Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
+ &mut will_bubble,
|
|
|
+ resolved_events,
|
|
|
+ node,
|
|
|
+ dom,
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
{
|
|
|
// contextmenu
|
|
|
- let mut will_bubble = FxHashSet::default();
|
|
|
- for node in dom.get_listening_sorted("contextmenu") {
|
|
|
- let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
- let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
-
|
|
|
- if currently_contains && released && mouse_data.button == 2 {
|
|
|
- try_create_event(
|
|
|
- "contextmenu",
|
|
|
- Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
- &mut will_bubble,
|
|
|
- resolved_events,
|
|
|
- node,
|
|
|
- dom,
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- {
|
|
|
- // wheel
|
|
|
- let mut will_bubble = FxHashSet::default();
|
|
|
- for node in dom.get_listening_sorted("wheel") {
|
|
|
- let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
- let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
+ if mouse_data.button == 2 && released {
|
|
|
+ let mut will_bubble = FxHashSet::default();
|
|
|
+ for node in dom.get_listening_sorted("contextmenu") {
|
|
|
+ let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
+ let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
|
|
|
- if let Some(w) = wheel_data {
|
|
|
- if currently_contains && wheel_delta != 0.0 {
|
|
|
+ if currently_contains {
|
|
|
try_create_event(
|
|
|
- "wheel",
|
|
|
- Arc::new(w.clone()),
|
|
|
+ "contextmenu",
|
|
|
+ Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
|
|
&mut will_bubble,
|
|
|
resolved_events,
|
|
|
node,
|
|
@@ -415,6 +399,31 @@ impl InnerInputState {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ {
|
|
|
+ // wheel
|
|
|
+ if let Some(w) = wheel_data {
|
|
|
+ if wheel_delta != 0.0 {
|
|
|
+ let mut will_bubble = FxHashSet::default();
|
|
|
+ for node in dom.get_listening_sorted("wheel") {
|
|
|
+ let node_layout =
|
|
|
+ layout.layout(node.state.layout.node.unwrap()).unwrap();
|
|
|
+ let currently_contains = layout_contains_point(node_layout, new_pos);
|
|
|
+
|
|
|
+ if currently_contains {
|
|
|
+ try_create_event(
|
|
|
+ "wheel",
|
|
|
+ Arc::new(w.clone()),
|
|
|
+ &mut will_bubble,
|
|
|
+ resolved_events,
|
|
|
+ node,
|
|
|
+ dom,
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
{
|
|
|
// mouseleave
|
|
|
let mut will_bubble = FxHashSet::default();
|