Merge branch 'master' of https://github.com/DioxusLabs/dioxus into rusty-mousedata
Conflicts: packages/tui/src/hooks.rs
This commit is contained in:
commit
b7447503ea
2 files changed
+65
-61
No files matched your search
+63
-59
@@ -344,87 +344,91 @@ impl InnerInputState {
|
|||||||
|
|
||||||
{
|
{
|
||||||
// mouseup
|
// mouseup
|
||||||
let mut will_bubble = FxHashSet::default();
|
if was_released {
|
||||||
for node in dom.get_listening_sorted("mouseup") {
|
let mut will_bubble = FxHashSet::default();
|
||||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
for node in dom.get_listening_sorted("mouseup") {
|
||||||
let currently_contains = layout_contains_point(node_layout, new_pos);
|
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
||||||
|
let currently_contains = layout_contains_point(node_layout, new_pos);
|
||||||
|
|
||||||
if currently_contains && was_released {
|
if currently_contains {
|
||||||
try_create_event(
|
try_create_event(
|
||||||
"mouseup",
|
"mouseup",
|
||||||
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
||||||
&mut will_bubble,
|
&mut will_bubble,
|
||||||
resolved_events,
|
resolved_events,
|
||||||
node,
|
node,
|
||||||
dom,
|
dom,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// click
|
// click
|
||||||
let mut will_bubble = FxHashSet::default();
|
if mouse_data.trigger_button() == Some(DioxusMouseButton::Primary) && was_released {
|
||||||
for node in dom.get_listening_sorted("click") {
|
let mut will_bubble = FxHashSet::default();
|
||||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
for node in dom.get_listening_sorted("click") {
|
||||||
let currently_contains = layout_contains_point(node_layout, new_pos);
|
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
||||||
|
let currently_contains = layout_contains_point(node_layout, new_pos);
|
||||||
|
|
||||||
if currently_contains
|
if currently_contains {
|
||||||
&& was_released
|
try_create_event(
|
||||||
&& mouse_data.trigger_button() == Some(DioxusMouseButton::Primary)
|
"click",
|
||||||
{
|
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
||||||
try_create_event(
|
&mut will_bubble,
|
||||||
"click",
|
resolved_events,
|
||||||
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
node,
|
||||||
&mut will_bubble,
|
dom,
|
||||||
resolved_events,
|
);
|
||||||
node,
|
}
|
||||||
dom,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// contextmenu
|
// contextmenu
|
||||||
let mut will_bubble = FxHashSet::default();
|
if mouse_data.trigger_button() == Some(DioxusMouseButton::Secondary) && was_released
|
||||||
for node in dom.get_listening_sorted("contextmenu") {
|
{
|
||||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
let mut will_bubble = FxHashSet::default();
|
||||||
let currently_contains = layout_contains_point(node_layout, new_pos);
|
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
|
if currently_contains {
|
||||||
&& was_released
|
try_create_event(
|
||||||
&& mouse_data.trigger_button() == Some(DioxusMouseButton::Secondary)
|
"contextmenu",
|
||||||
{
|
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
||||||
try_create_event(
|
&mut will_bubble,
|
||||||
"contextmenu",
|
resolved_events,
|
||||||
Arc::new(prepare_mouse_data(mouse_data, node_layout)),
|
node,
|
||||||
&mut will_bubble,
|
dom,
|
||||||
resolved_events,
|
);
|
||||||
node,
|
}
|
||||||
dom,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// wheel
|
// wheel
|
||||||
let mut will_bubble = FxHashSet::default();
|
if let Some(w) = wheel_data {
|
||||||
for node in dom.get_listening_sorted("wheel") {
|
if wheel_delta != 0.0 {
|
||||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
let mut will_bubble = FxHashSet::default();
|
||||||
let currently_contains = layout_contains_point(node_layout, new_pos);
|
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 let Some(w) = wheel_data {
|
if currently_contains {
|
||||||
if currently_contains && wheel_delta != 0.0 {
|
try_create_event(
|
||||||
try_create_event(
|
"wheel",
|
||||||
"wheel",
|
Arc::new(w.clone()),
|
||||||
Arc::new(w.clone()),
|
&mut will_bubble,
|
||||||
&mut will_bubble,
|
resolved_events,
|
||||||
resolved_events,
|
node,
|
||||||
node,
|
dom,
|
||||||
dom,
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ fn render_vdom(
|
|||||||
terminal.clear().unwrap();
|
terminal.clear().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let to_rerender: fxhash::FxHashSet<usize> = vec![0].into_iter().collect();
|
let mut to_rerender: fxhash::FxHashSet<usize> = vec![0].into_iter().collect();
|
||||||
let mut resized = true;
|
let mut resized = true;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@@ -226,7 +226,7 @@ fn render_vdom(
|
|||||||
// update the style and layout
|
// update the style and layout
|
||||||
let mut any_map = AnyMap::new();
|
let mut any_map = AnyMap::new();
|
||||||
any_map.insert(stretch.clone());
|
any_map.insert(stretch.clone());
|
||||||
let _to_rerender = rdom.update_state(vdom, to_update, any_map).unwrap();
|
to_rerender = rdom.update_state(vdom, to_update, any_map).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user