1 |
- {"version":3,"file":"box.mjs","names":["Box","constructor","_ref","x","y","width","height","top","bottom","left","right","getOverflow","a","b","before","Math","max","after"],"sources":["../../src/util/box.ts"],"sourcesContent":["export class Box {\n x: number\n y: number\n width: number\n height: number\n\n constructor ({ x, y, width, height }: {\n x: number\n y: number\n width: number\n height: number\n }) {\n this.x = x\n this.y = y\n this.width = width\n this.height = height\n }\n\n get top () { return this.y }\n get bottom () { return this.y + this.height }\n get left () { return this.x }\n get right () { return this.x + this.width }\n}\n\nexport function getOverflow (a: Box, b: Box) {\n return {\n x: {\n before: Math.max(0, b.left - a.left),\n after: Math.max(0, a.right - b.right),\n },\n y: {\n before: Math.max(0, b.top - a.top),\n after: Math.max(0, a.bottom - b.bottom),\n },\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,GAAG,CAAC;EAMfC,WAAWA,CAAAC,IAAA,EAKR;IAAA,IALU;MAAEC,CAAC;MAAEC,CAAC;MAAEC,KAAK;MAAEC;IAK5B,CAAC,GAAAJ,IAAA;IACC,IAAI,CAACC,CAAC,GAAGA,CAAC;IACV,IAAI,CAACC,CAAC,GAAGA,CAAC;IACV,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;EACtB;EAEA,IAAIC,GAAGA,CAAA,EAAI;IAAE,OAAO,IAAI,CAACH,CAAC;EAAC;EAC3B,IAAII,MAAMA,CAAA,EAAI;IAAE,OAAO,IAAI,CAACJ,CAAC,GAAG,IAAI,CAACE,MAAM;EAAC;EAC5C,IAAIG,IAAIA,CAAA,EAAI;IAAE,OAAO,IAAI,CAACN,CAAC;EAAC;EAC5B,IAAIO,KAAKA,CAAA,EAAI;IAAE,OAAO,IAAI,CAACP,CAAC,GAAG,IAAI,CAACE,KAAK;EAAC;AAC5C;AAEA,OAAO,SAASM,WAAWA,CAAEC,CAAM,EAAEC,CAAM,EAAE;EAC3C,OAAO;IACLV,CAAC,EAAE;MACDW,MAAM,EAAEC,IAAI,CA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