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AAO,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AAxCD,IAwCC","sourcesContent":["/**\n * Rectangle helper class.\n *\n * @public\n * {@docCategory Rectangle}\n */\nexport class Rectangle {\n public top: number;\n public bottom: number;\n public left: number;\n public right: number;\n\n constructor(left: number = 0, right: number = 0, top: number = 0, bottom: number = 0) {\n this.top = top;\n this.bottom = bottom;\n this.left = left;\n this.right = right;\n }\n\n /**\n * Calculated automatically by subtracting the right from left\n */\n public get width(): number {\n return this.right - this.left;\n }\n\n /**\n * Calculated automatically by subtracting the bottom from top.\n */\n public get height(): number {\n return this.bottom - this.top;\n }\n\n /**\n * Tests if another rect is approximately equal to this rect (within 4 decimal places.)\n */\n public equals(rect: Rectangle): boolean {\n // Fixing to 4 decimal places because it allows enough precision and will handle cases when something\n // should be rounded, like .999999 should round to 1.\n return (\n parseFloat(this.top.toFixed(4)) === parseFloat(rect.top.toFixed(4)) &&\n parseFloat(this.bottom.toFixed(4)) === parseFloat(rect.bottom.toFixed(4)) &&\n parseFloat(this.left.toFixed(4)) === parseFloat(rect.left.toFixed(4)) &&\n parseFloat(this.right.toFixed(4)) === parseFloat(rect.right.toFixed(4))\n );\n }\n}\n"]} |