Skip to content

Commit

Permalink
Pointer: fix objects in substates not being selectable
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Feb 28, 2017
1 parent e08dba2 commit 69042ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion flixel/system/debug/interaction/Interaction.hx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class Interaction extends Window
private function restoreSystemCursor():Void
{
#if FLX_MOUSE
FlxG.mouse.useSystemCursor = _wasUsingSystemCursor;
FlxG.mouse.useSystemCursor = _wasUsingSystemCursor;
FlxG.mouse.visible = _wasMouseVisible;
_customCursor.visible = false;
#end
Expand Down Expand Up @@ -455,6 +455,13 @@ class Interaction extends Window
return (_turn - value) == 1;
}

public function findItemsWithinState(items:Array<FlxBasic>, state:FlxState, area:FlxRect):Void
{
findItemsWithinArea(items, state.members, area);
if (state.subState != null)
findItemsWithinState(items, state.subState, area);
}

/**
* Find all items within an area. In order to improve performance and reduce temporary allocations,
* the method has no return, you must pass an array where items will be placed. The method decides
Expand Down
2 changes: 1 addition & 1 deletion flixel/system/debug/interaction/tools/Pointer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Pointer extends Tool
calculateSelectionArea();

if (findItems)
_brain.findItemsWithinArea(_itemsInSelectionArea, FlxG.state.members, _selectionArea);
_brain.findItemsWithinState(_itemsInSelectionArea, FlxG.state, _selectionArea);

// Clear everything
_selectionHappening = false;
Expand Down

0 comments on commit 69042ab

Please sign in to comment.