Skip to content

Commit

Permalink
Don't listen to down/click events on inactive contexts.
Browse files Browse the repository at this point in the history
  • Loading branch information
dionjwa committed Oct 1, 2011
1 parent aae21c8 commit 67263c1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/com/pblabs/components/input/MouseInputComponent.hx
Expand Up @@ -183,6 +183,10 @@ class MouseInputComponent extends EntityComponent

function onMouseDownInternal (data :IInputData) :Void
{
if (!context.isTopContext) {
return;
}

_mouseDownThis = false;
if (isTranslatable || (_deviceDownSignaler != null || _deviceClickSignaler != null || _deviceDownSignaler != null)) {

Expand All @@ -207,6 +211,11 @@ class MouseInputComponent extends EntityComponent
function onMouseUpInternal (data :IInputData) :Void
{
destroyDeviceHeldBond();

if (!context.isTopContext) {
return;
}

if (bounds != null && data != null && data.firstObjectUnderPoint(bounds.objectMask) == _bounds) {
if (_deviceUpSignaler != null) {
_deviceUpSignaler.dispatch();
Expand All @@ -221,13 +230,22 @@ class MouseInputComponent extends EntityComponent
function onClickInternal (data :IInputData) :Void
{
destroyDeviceHeldBond();

if (!context.isTopContext) {
return;
}

if (_deviceClickSignaler != null && data.firstObjectUnderPoint(bounds.objectMask) == _bounds) {
_deviceClickSignaler.dispatch();
}
}

function onDeviceHeldDownInternal (data :IInputData) :Void
{
if (!context.isTopContext) {
return;
}

if (_deviceHeldDownSignaler != null && data.firstObjectUnderPoint(bounds.objectMask) == _bounds) {
_deviceHeldDownSignaler.dispatch();
}
Expand Down

0 comments on commit 67263c1

Please sign in to comment.