Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #686 from tobeytailor/display
Browse files Browse the repository at this point in the history
Misc changes and cleanups, fixes hit testing of bitmaps
  • Loading branch information
Tobias Schneider committed Sep 18, 2013
2 parents 8ac4fc3 + 878bccc commit ce35c9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
19 changes: 6 additions & 13 deletions src/flash/display/DisplayObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ var DisplayObjectDefinition = (function () {
{
return false;
}
if (!useShape) {
if (!useShape || !this._graphics) {
return true;
}
// TODO: move into Graphics
Expand Down Expand Up @@ -520,6 +520,7 @@ var DisplayObjectDefinition = (function () {

this._invalidate();
this._bounds = null;

this._scaleX = val;
this._updateCurrentTransform();
},
Expand All @@ -532,6 +533,7 @@ var DisplayObjectDefinition = (function () {

this._invalidate();
this._bounds = null;

this._scaleY = val;
this._updateCurrentTransform();
},
Expand Down Expand Up @@ -621,13 +623,9 @@ var DisplayObjectDefinition = (function () {
if (val === this._x) {
return;
}
this._invalidate();

if (this._bounds) {
var dx = val - this._bounds.xMin;
this._bounds.xMin += dx;
this._bounds.xMax += dx;
}
this._invalidate();
this._bounds = null;

this._x = this._currentTransform.tx = val;
},
Expand All @@ -640,12 +638,7 @@ var DisplayObjectDefinition = (function () {
}

this._invalidate();

if (this._bounds) {
var dy = val - this._bounds.yMin;
this._bounds.yMin += dy;
this._bounds.yMax += dy;
}
this._bounds = null;

this._y = this._currentTransform.ty = val;
},
Expand Down
12 changes: 7 additions & 5 deletions src/flash/display/Stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var StageDefinition = (function () {
this._invalidObjects.push(displayObject);
},

_processInvalidRegions: function() {
_processInvalidRegions: function processInvalidRegions() {
var objects = this._invalidObjects;
var regions = [];

Expand Down Expand Up @@ -165,15 +165,16 @@ var StageDefinition = (function () {
var neighbours = this._qtree.retrieve(xMin, yMin, xMax, yMax);
for (var j = 0; j < neighbours.length; j++) {
var item = neighbours[j];
var neighbour = item.obj;

if (neighbour._invalid || (xMin > item.xMax) || (xMax < item.xMin) ||
(yMin > item.yMax) || (yMax < item.yMin))
if (item.obj._invalid || (xMin > item.x + item.width) ||
(xMax < item.x) ||
(yMin > item.y + item.height) ||
(yMax < item.y))
{
continue;
}

neighbour._invalid = true;
item.obj._invalid = true;

numInvalidObjects++;
}
Expand Down Expand Up @@ -222,6 +223,7 @@ var StageDefinition = (function () {
} else {
interactiveObject = this;
}

while (ancestor) {
if (flash.display.InteractiveObject.class.isInstanceOf(ancestor) &&
!flash.display.SimpleButton.class.isInstanceOf(ancestor) &&
Expand Down

0 comments on commit ce35c9f

Please sign in to comment.