Commit 9566ced2 authored by rockyl's avatar rockyl

修复包围盒计算的问题

parent a2a8ee9a
......@@ -439,7 +439,7 @@ export default class Container extends DisplayObject {
this._lastBoundsID = this._boundsID
this._bounds.clear();
//算自己的
this._calculateBounds();
if(!this._calculateBounds()){
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (!child.visible || !child.renderable) {
......@@ -466,14 +466,13 @@ export default class Container extends DisplayObject {
Rectangle.createFromRects(this._bounds, child._bounds);
}
}
}
}
/**
* 加"_"的方法基本是为了自己特殊处理
*/
protected _calculateBounds() {
protected _calculateBounds(): boolean {
//子类自己重写
//let wp = this.worldMatrix.transformPoint(this.x, this.y);
......@@ -496,7 +495,10 @@ export default class Container extends DisplayObject {
matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3);
matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4);
Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4);
return true;
}
return false;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment