Skip to content

Commit

Permalink
handle mouse buttons better / properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Dec 23, 2023
1 parent 583c26e commit 1bc0401
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions haxe/ui/backend/flixel/MouseHelper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ class MouseHelper {
event.screenY = (currentMouseY - FlxG.scaleMode.offset.y) / (FlxG.scaleMode.scale.y * initialZoom());
}

#if FLX_NO_MOUSE
event.data = -1;
#else
event.data = (e.buttonDown ? 0 : 1);
#end
event.data = -1;
if (e.type == openfl.events.MouseEvent.MOUSE_DOWN) {
event.data = 0;
} else if (e.type == openfl.events.MouseEvent.RIGHT_MOUSE_DOWN) {
event.data = 1;
}

for (l in list) {
l.fn(event);
Expand Down Expand Up @@ -173,11 +174,12 @@ class MouseHelper {
event.screenY = (currentMouseY - FlxG.scaleMode.offset.y) / (FlxG.scaleMode.scale.y * initialZoom());
}

#if FLX_NO_MOUSE
event.data = -1;
#else
event.data = (e.buttonDown ? 0 : 1);
#end
event.data = -1;
if (e.type == openfl.events.MouseEvent.MOUSE_UP) {
event.data = 0;
} else if (e.type == openfl.events.MouseEvent.RIGHT_MOUSE_UP) {
event.data = 1;
}

for (l in list) {
l.fn(event);
Expand Down

0 comments on commit 1bc0401

Please sign in to comment.