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BACD,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,CAAC,CAAC;gBACV,IAAI,EAAE,gBAAgB;aACvB,CAAC,CAAC;SACJ;QAED,IAAI,IAAI,CAAC;QACT,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAC1C,IAAI,GAAG,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7F;aAAM;YACL,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAiB,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;SACnG;QAED,IAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;YACnC,KAAK,wBACA,KAAK,KACR,IAAI,MAAA,GACL;YACD,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACvC,CAAC;IACD,SAAS,YAAC,SAAyB;QACzB,IAAA,KAAK,GAAgB,SAAS,MAAzB,EAAE,SAAS,GAAK,SAAS,UAAd,CAAe;QACvC,IAAI,SAAS,EAAE;YACb,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE;oBACL,CAAC,EAAE,GAAG;oBACN,IAAI,EAAE,KAAK;iBACZ;aACF,CAAC;SACH;QAED,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE;gBACL,CAAC,EAAE,CAAC;gBACJ,IAAI,EAAE,KAAK;aACZ;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC","sourcesContent":["import { IGroup } from '../../../dependents';\nimport { Point, ShapeInfo, ShapeMarkerCfg, ShapePoint } from '../../../interface';\n\nimport { registerShape, registerShapeFactory } from '../base';\nimport { BACKGROUND_SHAPE } from '../constant';\nimport { getBackgroundRectStyle, getStyle } from '../util/get-style';\nimport { getBackgroundRectPath, getIntervalRectPath, getRectPoints, getRectWithCornerRadius } from './util';\n\n/** Interval 的 shape 工厂 */\nconst IntervalShapeFactory = registerShapeFactory('interval', {\n defaultShapeType: 'rect',\n getDefaultPoints(pointInfo: ShapePoint): Point[] {\n return getRectPoints(pointInfo);\n },\n});\n\n/** Inerval 默认 shape,填充的矩形 */\nregisterShape('interval', 'rect', {\n draw(cfg: ShapeInfo, container: IGroup) {\n const style = getStyle(cfg, false, true);\n let group = container;\n\n const backgroundCfg = cfg?.background;\n if (backgroundCfg) {\n group = container.addGroup({\n name: 'interval-group',\n });\n const backgroundStyle = getBackgroundRectStyle(cfg);\n const backgroundPath = getBackgroundRectPath(cfg, this.parsePoints(cfg.points) as Point[], this.coordinate);\n group.addShape('path', {\n attrs: {\n ...backgroundStyle,\n path: backgroundPath,\n },\n capture: false,\n zIndex: -1,\n name: BACKGROUND_SHAPE,\n });\n }\n\n let path;\n if (style.radius && this.coordinate.isRect) {\n path = getRectWithCornerRadius(this.parsePoints(cfg.points), this.coordinate, style.radius);\n } else {\n path = this.parsePath(getIntervalRectPath(cfg.points as Point[], style.lineCap, this.coordinate));\n }\n\n const shape = group.addShape('path', {\n attrs: {\n ...style,\n path,\n },\n name: 'interval',\n });\n\n return backgroundCfg ? group : shape;\n },\n getMarker(markerCfg: ShapeMarkerCfg) {\n const { color, isInPolar } = markerCfg;\n if (isInPolar) {\n return {\n symbol: 'circle',\n style: {\n r: 4.5,\n fill: color,\n },\n };\n }\n\n return {\n symbol: 'square',\n style: {\n r: 4,\n fill: color,\n },\n };\n },\n});\n\nexport default IntervalShapeFactory;\n"]}