diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index 1beb85f..8a245f7 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -288,6 +288,11 @@ InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest ) { + if(!displayObject.interactiveChildren || !displayObject.visible) + { + return false; + } + var children = displayObject.children; var hit = false; @@ -558,7 +563,7 @@ { var touchEvent = changedTouches[i]; //TODO POOL - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; @@ -583,7 +588,7 @@ { var touchEvent = changedTouches[i]; - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; @@ -614,7 +619,7 @@ { var touchEvent = changedTouches[i]; - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index 1beb85f..8a245f7 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -288,6 +288,11 @@ InteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest ) { + if(!displayObject.interactiveChildren || !displayObject.visible) + { + return false; + } + var children = displayObject.children; var hit = false; @@ -558,7 +563,7 @@ { var touchEvent = changedTouches[i]; //TODO POOL - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; @@ -583,7 +588,7 @@ { var touchEvent = changedTouches[i]; - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; @@ -614,7 +619,7 @@ { var touchEvent = changedTouches[i]; - var touchData = getTouchData( touchEvent ); + var touchData = this.getTouchData( touchEvent ); touchData.originalEvent = event; diff --git a/src/interaction/interactiveTarget.js b/src/interaction/interactiveTarget.js index dbecaa4..2fa0bf7 100644 --- a/src/interaction/interactiveTarget.js +++ b/src/interaction/interactiveTarget.js @@ -4,8 +4,10 @@ core.DisplayObject.prototype.interactive = false; core.DisplayObject.prototype.buttomMode = false; +core.DisplayObject.prototype.interactiveChildren = true; core.DisplayObject.prototype.defaultCursor = 'pointer'; + core.Sprite.prototype.hitTest = function( point ) { this.worldTransform.applyInverse(point, tempPoint); @@ -15,18 +17,18 @@ var x1 = -width * this.anchor.x; var y1; - if (tempPoint.x > x1 && tempPoint.x < x1 + width) + if ( tempPoint.x > x1 && tempPoint.x < x1 + width ) { y1 = -height * this.anchor.y; - if (tempPoint.y > y1 && tempPoint.y < y1 + height) + if ( tempPoint.y > y1 && tempPoint.y < y1 + height ) { return true; } } return false; -} +}; core.Graphics.prototype.hitTest = function( point ) @@ -35,7 +37,7 @@ var graphicsData = this.graphicsData; - for (i = 0; i < graphicsData.length; i++) + for (var i = 0; i < graphicsData.length; i++) { var data = graphicsData[i]; @@ -47,7 +49,7 @@ // only deal with fills.. if (data.shape) { - if (data.shape.contains(x, y)) + if ( data.shape.contains( tempPoint.x, tempPoint.y ) ) { return true; } @@ -55,6 +57,6 @@ } return false; -} +}; module.exports = {};