Skip to content

Commit

Permalink
simulate mouse events when states switch to mop up any visual styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Dec 21, 2023
1 parent d70232e commit 69dc988
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions haxe/ui/backend/flixel/MouseHelper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,18 @@ class MouseHelper {
}

private static function onPreStateSwitched() {
onMouseUp(null);
onMouseMove(null);
// simulate mouse events when states switch to mop up any visual styles
var e = new openfl.events.MouseEvent(openfl.events.MouseEvent.MOUSE_DOWN);
e.stageX = currentMouseX;
e.stageY = currentMouseY;
e.buttonDown = false;
onMouseUp(e);

var e = new openfl.events.MouseEvent(openfl.events.MouseEvent.MOUSE_MOVE);
e.stageX = currentMouseX;
e.stageY = currentMouseY;
e.buttonDown = false;
onMouseMove(e);
}

private static function onMouseDown(e:openfl.events.MouseEvent) {
Expand Down

0 comments on commit 69dc988

Please sign in to comment.