UNPKG

3.22 kBSource Map (JSON)View Raw
1{"version":3,"file":"hollow-rect.js","sourceRoot":"","sources":["../../../../src/geometry/shape/interval/hollow-rect.ts"],"names":[],"mappings":";;;AAGA,gCAAwC;AACxC,wCAA+C;AAC/C,+CAAqE;AACrE,+BAA4D;AAE5D,YAAY;AACZ,IAAA,oBAAa,EAAC,UAAU,EAAE,aAAa,EAAE;IACvC,IAAI,YAAC,GAAc,EAAE,SAAiB;QACpC,IAAM,KAAK,GAAG,IAAA,oBAAQ,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,KAAK,GAAG,SAAS,CAAC;QACtB,IAAM,aAAa,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,CAAC;QACtC,IAAI,aAAa,EAAE;YACjB,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;YAC7B,IAAM,eAAe,GAAG,IAAA,kCAAsB,EAAC,GAAG,CAAC,CAAC;YACpD,IAAM,cAAc,GAAG,IAAA,4BAAqB,EAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5G,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACrB,KAAK,wCACA,eAAe,KAClB,IAAI,EAAE,cAAc,GACrB;gBACD,MAAM,EAAE,CAAC,CAAC;gBACV,IAAI,EAAE,2BAAgB;aACvB,CAAC,CAAC;SACJ;QAED,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,kBAAW,EAAC,GAAG,CAAC,MAAiB,CAAC,CAAC,CAAC;QAChE,IAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;YACnC,KAAK,wCACA,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,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,IAAI;iBACX;aACF,CAAC;SACH;QAED,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE;gBACL,CAAC,EAAE,CAAC;gBACJ,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,IAAI;aACX;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { IGroup } from '../../../dependents';\nimport { Point, ShapeInfo, ShapeMarkerCfg } from '../../../interface';\n\nimport { registerShape } from '../base';\nimport { BACKGROUND_SHAPE } from '../constant';\nimport { getBackgroundRectStyle, getStyle } from '../util/get-style';\nimport { getBackgroundRectPath, getRectPath } from './util';\n\n/** 描边柱状图 */\nregisterShape('interval', 'hollow-rect', {\n draw(cfg: ShapeInfo, container: IGroup) {\n const style = getStyle(cfg, true, false);\n let group = container;\n const backgroundCfg = cfg?.background;\n if (backgroundCfg) {\n group = container.addGroup();\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 zIndex: -1,\n name: BACKGROUND_SHAPE,\n });\n }\n\n const path = this.parsePath(getRectPath(cfg.points as Point[]));\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 stroke: color,\n fill: null,\n },\n };\n }\n\n return {\n symbol: 'square',\n style: {\n r: 4,\n stroke: color,\n fill: null,\n },\n };\n },\n});\n"]}
\No newline at end of file