예제 #1
0
        public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
        {
            if (resultRect == null)
            {
                resultRect = new AsRectangle();
            }
            AsMatrix transformationMatrix = targetSpace == this ? null : getTransformationMatrix(targetSpace, sHelperMatrix);

            return(mVertexData.getBounds(transformationMatrix, 0, mNumQuads * 4, resultRect));
        }
예제 #2
0
 public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
 {
     if (resultRect == null)
     {
         resultRect = new AsRectangle();
     }
     if (targetSpace == this)
     {
         mVertexData.getPosition(3, sHelperPoint);
         resultRect.setTo(0.0f, 0.0f, sHelperPoint.x, sHelperPoint.y);
     }
     else
     {
         if (targetSpace == getParent() && getRotation() == 0.0f)
         {
             float scaleX = this.getScaleX();
             float scaleY = this.getScaleY();
             mVertexData.getPosition(3, sHelperPoint);
             resultRect.setTo(getX() - getPivotX() * scaleX, getY() - getPivotY() * scaleY, sHelperPoint.x * scaleX, sHelperPoint.y * scaleY);
             if (scaleX < 0)
             {
                 resultRect.width = resultRect.width * -1;
                 resultRect.x     = resultRect.x - resultRect.width;
             }
             if (scaleY < 0)
             {
                 resultRect.height = resultRect.height * -1;
                 resultRect.y      = resultRect.y - resultRect.height;
             }
         }
         else
         {
             getTransformationMatrix(targetSpace, sHelperMatrix);
             mVertexData.getBounds(sHelperMatrix, 0, 4, resultRect);
         }
     }
     return(resultRect);
 }