Skip to content

Commit

Permalink
Temporary fix for #422
Browse files Browse the repository at this point in the history
  • Loading branch information
geom3trik committed Oct 20, 2023
1 parent 43b2ec6 commit f3864de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions crates/vizia_core/src/events/event_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,21 @@ fn internal_state_updates(context: &mut Context, window_event: &WindowEvent, met
}

WindowEvent::MouseMove(x, y) => {
context.mouse.previous_cursorx = context.mouse.cursorx;
context.mouse.previous_cursory = context.mouse.cursory;
context.mouse.cursorx = *x;
context.mouse.cursory = *y;
if !x.is_nan() && !y.is_nan() {
context.mouse.previous_cursorx = context.mouse.cursorx;
context.mouse.previous_cursory = context.mouse.cursory;
context.mouse.cursorx = *x;
context.mouse.cursory = *y;

mutate_direct_or_up(meta, context.captured, context.hovered, false);
}

// if context.mouse.cursorx != context.mouse.previous_cursorx
// || context.mouse.cursory != context.mouse.previous_cursory
// {
// }

hover_system(context);
mutate_direct_or_up(meta, context.captured, context.hovered, false);
// if let Some(dropped_file) = context.dropped_file.take() {
// emit_direct_or_up(
// context,
Expand Down
2 changes: 1 addition & 1 deletion crates/vizia_core/src/systems/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub(crate) fn layout_system(cx: &mut Context) {
// A relayout, retransform, or reclip, can cause the element under the cursor to change. So we push a mouse move event here to force
// a new event cycle and the hover system to trigger.
if let Some(proxy) = &cx.event_proxy {
let event = Event::new(WindowEvent::MouseMove(cx.mouse.cursorx, cx.mouse.cursory))
let event = Event::new(WindowEvent::MouseMove(f32::NAN, f32::NAN))
.target(Entity::root())
.origin(Entity::root())
.propagate(Propagation::Up);
Expand Down

0 comments on commit f3864de

Please sign in to comment.