Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jan 30, 2022
1 parent 368a516 commit 75c616c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions haxe/ui/backend/ComponentImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ class ComponentImpl extends ComponentBase {
#if !haxeui_notouch
if (EventMapper.MOUSE_TO_TOUCH.get(type) != null) {
#if (haxe_ver <= 4.0)
element.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent);
//element.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent);
#else
element.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent, { passive: true } );
//element.addEventListener(EventMapper.MOUSE_TO_TOUCH.get(type), __onMouseEvent, { passive: true } );
#end
}
#end
Expand Down Expand Up @@ -564,6 +564,7 @@ class ComponentImpl extends ComponentBase {
}
}

private var _over:Bool = false;
@:noCompletion
@:access(haxe.ui.core.Screen)
private function __onMouseEvent(event:js.html.Event) {
Expand Down Expand Up @@ -603,6 +604,19 @@ class ComponentImpl extends ComponentBase {
mouseEvent.shiftKey = me.shiftKey;
}

// js dom events fire mouse outs when you mouse over a child, lets fix that
if (type == MouseEvent.MOUSE_OUT && hitTest(mouseEvent.screenX, mouseEvent.screenY) == true) {
return;
} else if (type == MouseEvent.MOUSE_OVER && _over == true) {
return;
}

if (type == MouseEvent.MOUSE_OVER) {
_over = true;
} else if (type == MouseEvent.MOUSE_OUT) {
_over = false;
}

fn(mouseEvent);
}
}
Expand Down

0 comments on commit 75c616c

Please sign in to comment.