From 66b8f5563fb3326d76a26261de567af5d15cd6cb Mon Sep 17 00:00:00 2001 From: xsilen Date: Fri, 28 Oct 2016 12:15:38 +0800 Subject: [PATCH] bugfix(make rectangle inflate and inflatePoint behave same as flash "http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/Rectangle.html#inflate()") --- lib/geom/Rectangle.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/geom/Rectangle.ts b/lib/geom/Rectangle.ts index e5f1cd6b..69e23e3f 100644 --- a/lib/geom/Rectangle.ts +++ b/lib/geom/Rectangle.ts @@ -304,10 +304,10 @@ export class Rectangle */ public inflate(dx:number, dy:number):void { - this.x -= dx/2; - this.y -= dy/2; - this.width += dx/2; - this.height += dy/2; + this.x -= dx; + this.y -= dy; + this.width += 2 * dx; + this.height += 2 * dy; } /** @@ -324,10 +324,10 @@ export class Rectangle */ public inflatePoint(point:Point):void { - this.x -= point.x/2; - this.y -= point.y/2; - this.width += point.x/2; - this.height += point.y/2; + this.x -= point.x; + this.y -= point.y; + this.width += 2 * point.x; + this.height += 2 * point.y; } /**