{"version":3,"file":"limit-in-shape.js","sourceRoot":"","sources":["../../../../src/geometry/label/layout/limit-in-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,MAAgB,EAAE,MAA2B,EAAE,MAAY;IAC1G,IAAI,CAAC,MAAM,EAAE,UAAC,KAAK,EAAE,KAAK;QACxB,IAAM,SAAS,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,YAAY;QACrD,IAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC1C,IACE,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;YAC/B,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;YAC/B,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;YAC/B,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,EAC/B;YACA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAC9B;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { each } from '@antv/util';\nimport { BBox, IGroup, IShape } from '../../../dependents';\nimport { LabelItem } from '../interface';\n\n/**\n * @ignore\n * 根据图形元素以及 label 的 bbox 进行调整,如果 label 超出了 shape 的 bbox 则不展示\n */\nexport function limitInShape(items: LabelItem[], labels: IGroup[], shapes: IShape[] | IGroup[], region: BBox) {\n each(labels, (label, index) => {\n const labelBBox = label.getCanvasBBox(); // 文本有可能发生旋转\n const shapeBBox = shapes[index].getBBox();\n if (\n labelBBox.minX < shapeBBox.minX ||\n labelBBox.minY < shapeBBox.minY ||\n labelBBox.maxX > shapeBBox.maxX ||\n labelBBox.maxY > shapeBBox.maxY\n ) {\n label.remove(true); // 超出则不展示\n }\n });\n}\n"]}