@visactor/vrender-components 0.20.1-alpha.3 → 0.20.1-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/cjs/axis/base.d.ts +1 -0
  2. package/cjs/axis/base.js +4 -3
  3. package/cjs/axis/base.js.map +1 -1
  4. package/cjs/axis/config.d.ts +0 -6
  5. package/cjs/axis/config.js +1 -7
  6. package/cjs/axis/config.js.map +1 -1
  7. package/cjs/axis/constant.d.ts +1 -2
  8. package/cjs/axis/constant.js +1 -2
  9. package/cjs/axis/constant.js.map +1 -1
  10. package/cjs/axis/line.d.ts +0 -1
  11. package/cjs/axis/line.js +11 -45
  12. package/cjs/axis/line.js.map +1 -1
  13. package/cjs/axis/overlap/auto-rotate.js +3 -3
  14. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  15. package/cjs/axis/type.d.ts +4 -15
  16. package/cjs/axis/type.js.map +1 -1
  17. package/cjs/axis/util.d.ts +0 -2
  18. package/cjs/axis/util.js +4 -14
  19. package/cjs/axis/util.js.map +1 -1
  20. package/cjs/brush/type.js +2 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/indicator/indicator.js +4 -3
  25. package/cjs/indicator/indicator.js.map +1 -1
  26. package/cjs/label/line.js +7 -1
  27. package/cjs/label/line.js.map +1 -1
  28. package/cjs/poptip/contribution.js +3 -3
  29. package/cjs/poptip/contribution.js.map +1 -1
  30. package/cjs/util/align.js +31 -51
  31. package/cjs/util/align.js.map +1 -1
  32. package/dist/index.es.js +62 -126
  33. package/es/axis/base.d.ts +1 -0
  34. package/es/axis/base.js +4 -3
  35. package/es/axis/base.js.map +1 -1
  36. package/es/axis/config.d.ts +0 -6
  37. package/es/axis/config.js +0 -7
  38. package/es/axis/config.js.map +1 -1
  39. package/es/axis/constant.d.ts +1 -2
  40. package/es/axis/constant.js +1 -2
  41. package/es/axis/constant.js.map +1 -1
  42. package/es/axis/line.d.ts +0 -1
  43. package/es/axis/line.js +10 -45
  44. package/es/axis/line.js.map +1 -1
  45. package/es/axis/overlap/auto-rotate.js +3 -3
  46. package/es/axis/overlap/auto-rotate.js.map +1 -1
  47. package/es/axis/type.d.ts +4 -15
  48. package/es/axis/type.js.map +1 -1
  49. package/es/axis/util.d.ts +0 -2
  50. package/es/axis/util.js +2 -13
  51. package/es/axis/util.js.map +1 -1
  52. package/es/brush/type.js +2 -1
  53. package/es/index.d.ts +1 -1
  54. package/es/index.js +1 -1
  55. package/es/index.js.map +1 -1
  56. package/es/indicator/indicator.js +4 -3
  57. package/es/indicator/indicator.js.map +1 -1
  58. package/es/label/line.js +7 -1
  59. package/es/label/line.js.map +1 -1
  60. package/es/poptip/contribution.js +3 -3
  61. package/es/poptip/contribution.js.map +1 -1
  62. package/es/util/align.js +31 -51
  63. package/es/util/align.js.map +1 -1
  64. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAI3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,CAAC,EAAE,EAAE;IAC/C,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,OAAO,KAAK,GAAG,CAAC,EAAE;YAChB,KAAK,IAAI,GAAG,CAAC;SACd;KACF;SAAM,IAAI,KAAK,GAAG,CAAC,EAAE;QACpB,OAAO,KAAK,GAAG,GAAG,EA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vB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;SACjC;aAAM;YACL,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,EAAE;QACV,IAAI,IAAI,GAAG,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACd,CAAC","file":"util.js","sourcesContent":["import { getTextBounds } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IGraphic, IGroup, ITextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isGreater, isLess, tau, normalizeAngle, polarToCartesian, merge } from '@visactor/vutils';\nimport { traverseGroup } from '../util/common';\nimport type { Vector2 } from '../util';\n// eslint-disable-next-line no-duplicate-imports\nimport { scale, length } from '../util';\nimport type { BreakSymbol } from './type';\nimport { DEFAULT_AXIS_BREAK_SYMBOL_STYLE } from './config';\nimport type { Point } from '../core/type';\n\n// 和 vutils 版本不同\nexport const clampRadian = (angle: number = 0) => {\n if (angle < 0) {\n while (angle < 0) {\n angle += tau;\n }\n } else if (angle > 0) {\n while (angle > tau) {\n angle -= tau;\n }\n }\n return angle;\n};\n\n// 判断数值是否在制定范围内,包含误差\nexport function isInRange(a: number, min: number, max: number) {\n return !isLess(a, min, 0, 1e-6) && !isGreater(a, max, 0, 1e-6);\n}\n\nexport function getCircleLabelPosition(\n tickPosition: Point,\n tickVector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n) {\n const labelBounds = getTextBounds({\n text,\n ...style\n });\n const width = labelBounds.width();\n const height = labelBounds.height();\n const angle = clampRadian(Math.atan2(tickVector[1], tickVector[0])) - Math.PI;\n\n const PI_3_4 = (Math.PI * 3) / 4;\n const PI_1_4 = Math.PI / 4;\n const PI_1_2 = Math.PI / 2;\n\n // x\n const baseX = tickPosition.x;\n let dx = 0;\n if (isInRange(angle, -PI_3_4, -PI_1_4)) {\n dx = ((angle + PI_3_4) / PI_1_2 - 0.5) * width;\n } else if (isInRange(angle, PI_1_4, PI_3_4)) {\n dx = (0.5 - (angle - PI_1_4) / PI_1_2) * width;\n } else if (Math.cos(angle) >= 0) {\n dx = width * 0.5;\n } else {\n dx = -width * 0.5;\n }\n const x = baseX - dx;\n\n const baseY = tickPosition.y;\n let dy = 0;\n if (isInRange(angle, -PI_3_4, -PI_1_4)) {\n dy = -height * 0.5;\n } else if (isInRange(angle, PI_1_4, PI_3_4)) {\n dy = height * 0.5;\n } else if (Math.cos(angle) >= 0) {\n dy = (0.5 - (PI_1_4 - angle) / PI_1_2) * height;\n } else {\n dy = (0.5 - clampRadian(angle - PI_3_4) / PI_1_2) * height;\n }\n const y = baseY - dy;\n\n return { x, y };\n}\n\nexport function getAxisBreakSymbolAttrs(props: BreakSymbol = {}) {\n const { shape, style = {} } = props;\n const symbolStyle = merge({}, DEFAULT_AXIS_BREAK_SYMBOL_STYLE, style);\n const symbolSize = symbolStyle.size ?? DEFAULT_AXIS_BREAK_SYMBOL_STYLE.size;\n return {\n symbolType:\n shape ??\n symbolStyle.symbolType ??\n `M ${-symbolSize / 2} ${symbolSize / 2} L ${symbolSize / 2} ${-symbolSize / 2}`,\n ...symbolStyle\n };\n}\nexport function getElMap(g: IGroup) {\n const elMap: Dict<IGraphic> = {};\n traverseGroup(g, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n elMap[el.id] = el;\n }\n });\n return elMap;\n}\n\nexport function getVerticalCoord(point: Point, vector: Vector2): Point {\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n}\n\nexport function getCircleVerticalVector(\n offset: number,\n point: Point,\n center: Point,\n inside = false,\n axisInside = false\n): Vector2 {\n const vector: [number, number] = [point.x - center.x, point.y - center.y];\n return scale(vector, ((inside ? -1 : 1) * (axisInside ? -1 : 1) * offset) / length(vector));\n}\n\n/**\n * 计算对应角度下的角度轴标签定位属性\n * @param angle 弧度角,需要注意是逆时针计算的\n * @returns\n */\nexport function angleLabelOrientAttribute(angle: number) {\n let align: TextAlignType = 'center';\n let baseline: TextBaselineType = 'middle';\n\n angle = normalizeAngle(angle);\n\n // left: 5/3 - 1/3; right: 2/3 - 4/3; center: 5/3 - 1/3 & 2/3 - 4/3\n if (angle >= Math.PI * (5 / 3) || angle <= Math.PI * (1 / 3)) {\n align = 'left';\n } else if (angle >= Math.PI * (2 / 3) && angle <= Math.PI * (4 / 3)) {\n align = 'right';\n } else {\n align = 'center';\n }\n\n // bottom: 7/6 - 11/6; top: 1/6 - 5/6; middle: 11/6 - 1/6 & 5/6 - 7/6\n if (angle >= Math.PI * (7 / 6) && angle <= Math.PI * (11 / 6)) {\n baseline = 'bottom';\n } else if (angle >= Math.PI * (1 / 6) && angle <= Math.PI * (5 / 6)) {\n baseline = 'top';\n } else {\n baseline = 'middle';\n }\n\n return { align, baseline };\n}\n\nexport function getPolarAngleLabelPosition(\n angle: number,\n center: { x: number; y: number },\n radius: number,\n labelOffset: number,\n inside: boolean,\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n) {\n const point = polarToCartesian({ x: 0, y: 0 }, radius, angle);\n const labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside));\n const vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);\n return getCircleLabelPosition(labelPoint, vector, text, style);\n}\n\nexport function getCirclePoints(center: Point, count: number, radius: number, startAngle: number, endAngle: number) {\n const points: Point[] = [];\n const range = endAngle - startAngle;\n for (let i = 0; i < count; i++) {\n const angle = startAngle + (i * range) / count;\n points.push(polarToCartesian(center, radius, angle));\n }\n return points;\n}\n\nexport function getPolygonPath(points: Point[], closed: boolean) {\n let path = '';\n if (points.length === 0) {\n return path;\n }\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `L${point.x},${point.y}`;\n }\n });\n if (closed) {\n path += 'Z';\n }\n\n return path;\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIxC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,CAAC,EAAE,EAAE;IAC/C,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,OAAO,KAAK,GAAG,CAAC,EAAE;YAChB,KAAK,IAAI,GAAG,CAAC;SACd;KACF;SAAM,IAAI,KAAK,GAAG,CAAC,EAAE;QACpB,OAAO,KAAK,GAAG,GAAG,EAAE;YAClB,KAAK,IAAI,GAAG,CAAC;SACd;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAGF,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IAC3D,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,YAAmB,EACnB,UAA4B,EAC5B,IAAqB,EACrB,KAAqC;IAErC,MAAM,WAAW,GAAG,aAAa,iBAC/B,IAAI,IACD,KAAK,EACR,CAAC;IACH,MAAM,KAAK,GAAG,W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AgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;KACtD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAe,EAAE,MAAe;IAC7D,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;SACjC;aAAM;YACL,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,EAAE;QACV,IAAI,IAAI,GAAG,CAAC;KACb;IAED,OAAO,IAAI,CAAC;AACd,CAAC","file":"util.js","sourcesContent":["import { getTextBounds } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IGraphic, IGroup, ITextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isGreater, isLess, tau, normalizeAngle, polarToCartesian } from '@visactor/vutils';\nimport { traverseGroup } from '../util/common';\nimport type { Vector2 } from '../util';\n// eslint-disable-next-line no-duplicate-imports\nimport { scale, length } from '../util';\nimport type { Point } from '../core/type';\n\n// 和 vutils 版本不同\nexport const clampRadian = (angle: number = 0) => {\n if (angle < 0) {\n while (angle < 0) {\n angle += tau;\n }\n } else if (angle > 0) {\n while (angle > tau) {\n angle -= tau;\n }\n }\n return angle;\n};\n\n// 判断数值是否在制定范围内,包含误差\nexport function isInRange(a: number, min: number, max: number) {\n return !isLess(a, min, 0, 1e-6) && !isGreater(a, max, 0, 1e-6);\n}\n\nexport function getCircleLabelPosition(\n tickPosition: Point,\n tickVector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n) {\n const labelBounds = getTextBounds({\n text,\n ...style\n });\n const width = labelBounds.width();\n const height = labelBounds.height();\n const angle = clampRadian(Math.atan2(tickVector[1], tickVector[0])) - Math.PI;\n\n const PI_3_4 = (Math.PI * 3) / 4;\n const PI_1_4 = Math.PI / 4;\n const PI_1_2 = Math.PI / 2;\n\n // x\n const baseX = tickPosition.x;\n let dx = 0;\n if (isInRange(angle, -PI_3_4, -PI_1_4)) {\n dx = ((angle + PI_3_4) / PI_1_2 - 0.5) * width;\n } else if (isInRange(angle, PI_1_4, PI_3_4)) {\n dx = (0.5 - (angle - PI_1_4) / PI_1_2) * width;\n } else if (Math.cos(angle) >= 0) {\n dx = width * 0.5;\n } else {\n dx = -width * 0.5;\n }\n const x = baseX - dx;\n\n const baseY = tickPosition.y;\n let dy = 0;\n if (isInRange(angle, -PI_3_4, -PI_1_4)) {\n dy = -height * 0.5;\n } else if (isInRange(angle, PI_1_4, PI_3_4)) {\n dy = height * 0.5;\n } else if (Math.cos(angle) >= 0) {\n dy = (0.5 - (PI_1_4 - angle) / PI_1_2) * height;\n } else {\n dy = (0.5 - clampRadian(angle - PI_3_4) / PI_1_2) * height;\n }\n const y = baseY - dy;\n\n return { x, y };\n}\n\nexport function getElMap(g: IGroup) {\n const elMap: Dict<IGraphic> = {};\n traverseGroup(g, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n elMap[el.id] = el;\n }\n });\n return elMap;\n}\n\nexport function getVerticalCoord(point: Point, vector: Vector2): Point {\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n}\n\nexport function getCircleVerticalVector(\n offset: number,\n point: Point,\n center: Point,\n inside = false,\n axisInside = false\n): Vector2 {\n const vector: [number, number] = [point.x - center.x, point.y - center.y];\n return scale(vector, ((inside ? -1 : 1) * (axisInside ? -1 : 1) * offset) / length(vector));\n}\n\n/**\n * 计算对应角度下的角度轴标签定位属性\n * @param angle 弧度角,需要注意是逆时针计算的\n * @returns\n */\nexport function angleLabelOrientAttribute(angle: number) {\n let align: TextAlignType = 'center';\n let baseline: TextBaselineType = 'middle';\n\n angle = normalizeAngle(angle);\n\n // left: 5/3 - 1/3; right: 2/3 - 4/3; center: 5/3 - 1/3 & 2/3 - 4/3\n if (angle >= Math.PI * (5 / 3) || angle <= Math.PI * (1 / 3)) {\n align = 'left';\n } else if (angle >= Math.PI * (2 / 3) && angle <= Math.PI * (4 / 3)) {\n align = 'right';\n } else {\n align = 'center';\n }\n\n // bottom: 7/6 - 11/6; top: 1/6 - 5/6; middle: 11/6 - 1/6 & 5/6 - 7/6\n if (angle >= Math.PI * (7 / 6) && angle <= Math.PI * (11 / 6)) {\n baseline = 'bottom';\n } else if (angle >= Math.PI * (1 / 6) && angle <= Math.PI * (5 / 6)) {\n baseline = 'top';\n } else {\n baseline = 'middle';\n }\n\n return { align, baseline };\n}\n\nexport function getPolarAngleLabelPosition(\n angle: number,\n center: { x: number; y: number },\n radius: number,\n labelOffset: number,\n inside: boolean,\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n) {\n const point = polarToCartesian({ x: 0, y: 0 }, radius, angle);\n const labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside));\n const vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);\n return getCircleLabelPosition(labelPoint, vector, text, style);\n}\n\nexport function getCirclePoints(center: Point, count: number, radius: number, startAngle: number, endAngle: number) {\n const points: Point[] = [];\n const range = endAngle - startAngle;\n for (let i = 0; i < count; i++) {\n const angle = startAngle + (i * range) / count;\n points.push(polarToCartesian(center, radius, angle));\n }\n return points;\n}\n\nexport function getPolygonPath(points: Point[], closed: boolean) {\n let path = '';\n if (points.length === 0) {\n return path;\n }\n points.forEach((point, index) => {\n if (index === 0) {\n path = `M${point.x},${point.y}`;\n } else {\n path += `L${point.x},${point.y}`;\n }\n });\n if (closed) {\n path += 'Z';\n }\n\n return path;\n}\n"]}
package/es/brush/type.js CHANGED
@@ -4,4 +4,5 @@ export var IOperateType;
4
4
  IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
5
5
  IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
6
6
  IOperateType.brushClear = "brushClear";
7
- }(IOperateType || (IOperateType = {}));
7
+ }(IOperateType || (IOperateType = {}));
8
+ //# sourceMappingURL=type.js.map
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.20.1-alpha.3";
1
+ export declare const version = "0.20.1-alpha.5";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.20.1-alpha.3";
1
+ export const version = "0.20.1-alpha.5";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.1-alpha.3\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.1-alpha.5\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
@@ -28,12 +28,13 @@ export class Indicator extends AbstractComponent {
28
28
  }
29
29
  }
30
30
  render() {
31
- var _a;
31
+ var _a, _b;
32
32
  if (this.removeAllChild(!0), !0 !== this.attribute.visible) return;
33
33
  const {title: title = {}, content: content, size: size, limitRatio: limitRatio = 1 / 0} = this.attribute, limit = Math.min(size.width, size.height) * limitRatio, group = this.createOrUpdateChild("indicator-container", {
34
34
  x: 0,
35
35
  y: 0,
36
- zIndex: 1
36
+ zIndex: 1,
37
+ pickable: null === (_a = this.attribute.pickable) || void 0 === _a || _a
37
38
  }, "group");
38
39
  if (isValid(title) && (this._title = this._renderText(group, title, limit, limitRatio, "title.style", "indicator-title")),
39
40
  isValid(content)) {
@@ -43,7 +44,7 @@ export class Indicator extends AbstractComponent {
43
44
  })), this._content = contentComponents;
44
45
  }
45
46
  this._setGlobalAutoFit(limit), this._setYPosition();
46
- const totalHeight = null !== (_a = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _a ? _a : 0;
47
+ const totalHeight = null !== (_b = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _b ? _b : 0;
47
48
  group.setAttribute("y", size.height / 2 - totalHeight / 2), group.setAttribute("x", size.width / 2);
48
49
  }
49
50
  _setLocalAutoFit(limit, indicatorItem, indicatorItemSpec) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,sBAAsB,EAAE,CAAC;AACzB,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IAuLrB,CAAC;IAlLW,WAAW,CACnB,KAAa,EACb,KAAwB,EACxB,KAAa,EACb,UAAkB,EAClB,SAAiB,EACjB,WAAmB;QAEnB,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,EAAE;YAC3B,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,uBAAuB,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE;gBACjF,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;YACH,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;YAErG,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC;gBACzC,UAAU,CAAC,IAAI,GA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AAC;IAEO,aAAa;;QACnB,IAAI,iBAAiB,GAAG,CAAC,CAAC;QAE1B,MAAM,WAAW,GAAG,MAAA,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,0CAAE,MAAM,kDAAI,mCAAI,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAA,MAAA,IAAI,CAAC,SAAS,CAAC,KAAK,0CAAE,KAAK,mCAAI,CAAC,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC1B,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;aACpD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;;YAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC,CAAC;YAC5E,MAAM,YAAY,GAAG,MAAA,WAAW,CAAC,KAAK,mCAAI,CAAC,CAAC;YAC5C,iBAAiB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, IRichText, IText, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { createTextGraphicByType, measureTextSize } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\nimport { loadIndicatorComponent } from './register';\n\nloadIndicatorComponent();\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText | IRichText;\n private _content?: (IText | IRichText)[];\n\n protected _renderText(\n group: IGroup,\n title: IndicatorItemSpec,\n limit: number,\n limitRatio: number,\n themePath: string,\n graphicName: string\n ) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, themePath), title.style, {\n visible: title.visible\n });\n titleStyle.lineHeight = isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize;\n\n if (title.formatMethod) {\n titleStyle._originText = titleStyle.text;\n titleStyle.text = title.formatMethod(titleStyle.text, titleStyle);\n }\n const textGraphic = createTextGraphicByType(titleStyle);\n textGraphic.name = graphicName;\n group.appendChild(textGraphic);\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, textGraphic as IText, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n textGraphic.setAttribute('maxLineWidth', limit);\n }\n\n return textGraphic;\n }\n\n return undefined;\n }\n\n protected render() {\n this.removeAllChild(true);\n\n if (this.attribute.visible !== true) {\n return;\n }\n const { title = {}, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n if (isValid(title)) {\n this._title = this._renderText(group, title, limit, limitRatio, 'title.style', 'indicator-title');\n }\n\n if (isValid(content)) {\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: (IText | IRichText)[] = [];\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n contentComponents.push(\n this._renderText(group, contentItem, limit, limitRatio, 'content.style', 'indicator-content-' + i)\n );\n } else {\n }\n });\n this._content = contentComponents;\n }\n\n this._setGlobalAutoFit(limit);\n this._setYPosition();\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setLocalAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n // only apply local auto fit for default auto fit text\n if ((indicatorItemSpec.fitStrategy ?? 'default') !== 'default') {\n return;\n }\n const originWidth = measureTextSize(\n (indicatorItemSpec.style?.text ?? '') as string | number | number[] | string[],\n (indicatorItemSpec.style ?? {}) as Partial<ITextGraphicAttribute>,\n this.stage?.getTheme()?.text\n ).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n\n private _setGlobalAutoFit(limit: number) {\n // compute the inscribed rect width & height for all texts\n // the font size will be determined by the longest text\n // 1. hx^2 + hy^2 = r^2\n // 2. hy = ra * hx + h\n // -> (ra^2 + 1) * x^2 + (2 * h * ra) * x + (h^2 - r^2) = 0\n\n const r = limit / 2;\n\n // unify the initial font size for auto fit texts\n const singleHeight = 12;\n const autoFitTexts: { text: IText; spec: IndicatorItemSpec }[] = [];\n // other text height\n let otherHeight = 0;\n // non auto fit title height\n const titleSpec = this.attribute.title ?? {};\n if (titleSpec.autoFit && titleSpec.fitStrategy === 'inscribed') {\n this._title.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: this._title as IText, spec: this.attribute.title ?? {} });\n } else {\n otherHeight += this._title?.AABBBounds?.height?.() ?? 0;\n }\n const titleSpace = titleSpec.space ?? 0;\n otherHeight += titleSpace;\n // non auto fit content height\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n if (contentSpec.autoFit && contentSpec.fitStrategy === 'inscribed') {\n contentText.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: contentText as IText, spec: contentSpec });\n } else {\n otherHeight += contentText?.AABBBounds?.height?.() ?? 0;\n }\n const contentSpace = contentSpec.space ?? 0;\n otherHeight += contentSpace;\n });\n if (autoFitTexts.length <= 0) {\n return;\n }\n\n // max width for all auto fit texts\n const maxWidth = autoFitTexts.reduce((width, textItem) => {\n return Math.max(width, textItem.text.AABBBounds.width());\n }, 0);\n\n // y = x * (singleHeight / maxWidth * textCount) + otherHeight\n // hy = hx * (singleHeight / maxWidth * textCount) + otherHeight / 2\n const ra = (singleHeight / maxWidth) * autoFitTexts.length;\n const h = otherHeight / 2;\n const a = ra ** 2 + 1;\n const b = 2 * h * ra;\n const c = h ** 2 - r ** 2;\n const hx = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);\n const hy = ra * hx + h;\n const y = 2 * hy;\n const lineHeight = (y - otherHeight) / autoFitTexts.length;\n if (isValidNumber(y)) {\n autoFitTexts.forEach(textItem => {\n const specLineHeight = textItem.spec.style?.lineHeight;\n textItem.text.setAttribute('fontSize', lineHeight);\n textItem.text.setAttribute('lineHeight', isValid(specLineHeight) ? specLineHeight : lineHeight);\n });\n }\n }\n\n private _setYPosition() {\n let lastContentHeight = 0;\n\n const titleHeight = this._title?.AABBBounds?.height?.() ?? 0;\n const titleSpace = this.attribute.title?.space ?? 0;\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n contentText.setAttribute('y', titleHeight + titleSpace + lastContentHeight);\n const contentSpace = contentSpec.space ?? 0;\n lastContentHeight += contentText.AABBBounds.height() + contentSpace;\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,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CAAC;aACpD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;;YAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC,CAAC;YAC5E,MAAM,YAAY,GAAG,MAAA,WAAW,CAAC,KAAK,mCAAI,CAAC,CAAC;YAC5C,iBAAiB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, IRichText, IText, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { createTextGraphicByType, measureTextSize } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\nimport { loadIndicatorComponent } from './register';\n\nloadIndicatorComponent();\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText | IRichText;\n private _content?: (IText | IRichText)[];\n\n protected _renderText(\n group: IGroup,\n title: IndicatorItemSpec,\n limit: number,\n limitRatio: number,\n themePath: string,\n graphicName: string\n ) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, themePath), title.style, {\n visible: title.visible\n });\n titleStyle.lineHeight = isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize;\n\n if (title.formatMethod) {\n titleStyle._originText = titleStyle.text;\n titleStyle.text = title.formatMethod(titleStyle.text, titleStyle);\n }\n const textGraphic = createTextGraphicByType(titleStyle);\n textGraphic.name = graphicName;\n group.appendChild(textGraphic);\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, textGraphic as IText, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n textGraphic.setAttribute('maxLineWidth', limit);\n }\n\n return textGraphic;\n }\n\n return undefined;\n }\n\n protected render() {\n this.removeAllChild(true);\n\n if (this.attribute.visible !== true) {\n return;\n }\n const { title = {}, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild(\n 'indicator-container',\n { x: 0, y: 0, zIndex: 1, pickable: this.attribute.pickable ?? true },\n 'group'\n ) as IGroup;\n if (isValid(title)) {\n this._title = this._renderText(group, title, limit, limitRatio, 'title.style', 'indicator-title');\n }\n\n if (isValid(content)) {\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: (IText | IRichText)[] = [];\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n contentComponents.push(\n this._renderText(group, contentItem, limit, limitRatio, 'content.style', 'indicator-content-' + i)\n );\n } else {\n }\n });\n this._content = contentComponents;\n }\n\n this._setGlobalAutoFit(limit);\n this._setYPosition();\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setLocalAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n // only apply local auto fit for default auto fit text\n if ((indicatorItemSpec.fitStrategy ?? 'default') !== 'default') {\n return;\n }\n const originWidth = measureTextSize(\n (indicatorItemSpec.style?.text ?? '') as string | number | number[] | string[],\n (indicatorItemSpec.style ?? {}) as Partial<ITextGraphicAttribute>,\n this.stage?.getTheme()?.text\n ).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n\n private _setGlobalAutoFit(limit: number) {\n // compute the inscribed rect width & height for all texts\n // the font size will be determined by the longest text\n // 1. hx^2 + hy^2 = r^2\n // 2. hy = ra * hx + h\n // -> (ra^2 + 1) * x^2 + (2 * h * ra) * x + (h^2 - r^2) = 0\n\n const r = limit / 2;\n\n // unify the initial font size for auto fit texts\n const singleHeight = 12;\n const autoFitTexts: { text: IText; spec: IndicatorItemSpec }[] = [];\n // other text height\n let otherHeight = 0;\n // non auto fit title height\n const titleSpec = this.attribute.title ?? {};\n if (titleSpec.autoFit && titleSpec.fitStrategy === 'inscribed') {\n this._title.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: this._title as IText, spec: this.attribute.title ?? {} });\n } else {\n otherHeight += this._title?.AABBBounds?.height?.() ?? 0;\n }\n const titleSpace = titleSpec.space ?? 0;\n otherHeight += titleSpace;\n // non auto fit content height\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n if (contentSpec.autoFit && contentSpec.fitStrategy === 'inscribed') {\n contentText.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: contentText as IText, spec: contentSpec });\n } else {\n otherHeight += contentText?.AABBBounds?.height?.() ?? 0;\n }\n const contentSpace = contentSpec.space ?? 0;\n otherHeight += contentSpace;\n });\n if (autoFitTexts.length <= 0) {\n return;\n }\n\n // max width for all auto fit texts\n const maxWidth = autoFitTexts.reduce((width, textItem) => {\n return Math.max(width, textItem.text.AABBBounds.width());\n }, 0);\n\n // y = x * (singleHeight / maxWidth * textCount) + otherHeight\n // hy = hx * (singleHeight / maxWidth * textCount) + otherHeight / 2\n const ra = (singleHeight / maxWidth) * autoFitTexts.length;\n const h = otherHeight / 2;\n const a = ra ** 2 + 1;\n const b = 2 * h * ra;\n const c = h ** 2 - r ** 2;\n const hx = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);\n const hy = ra * hx + h;\n const y = 2 * hy;\n const lineHeight = (y - otherHeight) / autoFitTexts.length;\n if (isValidNumber(y)) {\n autoFitTexts.forEach(textItem => {\n const specLineHeight = textItem.spec.style?.lineHeight;\n textItem.text.setAttribute('fontSize', lineHeight);\n textItem.text.setAttribute('lineHeight', isValid(specLineHeight) ? specLineHeight : lineHeight);\n });\n }\n }\n\n private _setYPosition() {\n let lastContentHeight = 0;\n\n const titleHeight = this._title?.AABBBounds?.height?.() ?? 0;\n const titleSpace = this.attribute.title?.space ?? 0;\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n contentText.setAttribute('y', titleHeight + titleSpace + lastContentHeight);\n const contentSpace = contentSpec.space ?? 0;\n lastContentHeight += contentText.AABBBounds.height() + contentSpace;\n });\n }\n}\n"]}
package/es/label/line.js CHANGED
@@ -13,7 +13,13 @@ export class LineLabel extends LabelBase {
13
13
  }
14
14
  getGraphicBounds(graphic, point = {}, position = "end") {
15
15
  if (!graphic || "line" !== graphic.type && "area" !== graphic.type) return super.getGraphicBounds(graphic, point);
16
- const points = graphic.attribute.points || [ point ], index = "start" === position ? 0 : points.length - 1;
16
+ let points = graphic.attribute.points;
17
+ const segments = graphic.attribute.segments;
18
+ !points && segments && segments.length && (points = segments.reduce(((res, seg) => {
19
+ var _a;
20
+ return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
21
+ }), [])), points && 0 !== points.length || (points = [ point ]);
22
+ const index = "start" === position ? 0 : points.length - 1;
17
23
  return points[index] ? {
18
24
  x1: points[index].x,
19
25
  x2: points[index].x,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE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GAAG,CAAC;QAC1G,OAAO,kBAAkB,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;;AA/BM,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC;AA4BJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC","file":"line.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { ILine } from '@visactor/vrender-core';\nimport type { PointLocationCfg } from '../core/type';\nimport type { LineLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingLineOrArea } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { registerLabelComponent } from './data-label-register';\n\nexport class LineLabel extends LabelBase<LineLabelAttrs> {\n name = 'line-label';\n\n static defaultAttributes: Partial<LineLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'end',\n offset: 6\n };\n\n constructor(attributes: LineLabelAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, LineLabel.defaultAttributes, attributes));\n }\n\n protected getGraphicBounds(graphic: ILine, point: Partial<PointLocationCfg> = {}, position = 'end') {\n if (!graphic || (graphic.type !== 'line' && graphic.type !== 'area')) {\n return super.getGraphicBounds(graphic, point);\n }\n const points = graphic.attribute.points || [point];\n const index = position === 'start' ? 0 : points.length - 1;\n if (!points[index]) {\n return;\n }\n return {\n x1: points[index].x as number,\n x2: points[index].x as number,\n y1: points[index].y as number,\n y2: points[index].y as number\n };\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position: string = 'end', offset = 0) {\n return labelingLineOrArea(textBounds, graphicBounds, position, offset);\n }\n}\n\nexport const registerLineDataLabel = () => {\n registerLabelComponent('line', LineLabel);\n registerLabelComponent('area', LineLabel);\n};\n"]}
1
+ {"version":3,"sources":["../src/label/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAWtD,YAAY,UAA0B,EAAE,OAA0B;QAChE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAXhG,SAAI,GAAG,YAAY,CAAC;IAYpB,CAAC;IAES,gBAAgB,CAAC,OAAc,EAAE,QAAmC,EAAE,EAAE,QAAQ,GAAG,KAAK;QAChG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE;YACpE,OAAO,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;QACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;QAE5C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE;YAC1C,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAiB,EAAE,GAAa,EAAE,EAAE;;gBAC5D,OAAO,GAAG,CAAC,MAAM,CAAC,MAAA,GAAG,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC;YACtC,CAAC,EAAE,EAAE,CAAC,CAAC;SACR;QAED,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,MAAM,GAAG,CAAC,KAAmB,CAAC,CAAC;SAChC;QAED,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAClB,OAAO;SACR;QACD,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;YAC7B,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAW;SAC9B,CAAC;IACJ,CAAC;IAES,QAAQ,CAAC,UAAuB,EAAE,aAA0B,EAAE,WAAmB,KAAK,EAAE,MAAM,GAAG,CAAC;QAC1G,OAAO,kBAAkB,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;;AA5CM,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;CACV,CAAC;AAyCJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC","file":"line.js","sourcesContent":["import type { IBoundsLike, IPointLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { ILine } from '@visactor/vrender-core';\nimport type { PointLocationCfg } from '../core/type';\nimport type { LineLabelAttrs } from './type';\nimport { LabelBase } from './base';\nimport { labelingLineOrArea } from './util';\nimport type { ComponentOptions } from '../interface';\nimport { registerLabelComponent } from './data-label-register';\nimport type { ISegment } from '@visactor/vrender-core';\n\nexport class LineLabel extends LabelBase<LineLabelAttrs> {\n name = 'line-label';\n\n static defaultAttributes: Partial<LineLabelAttrs> = {\n textStyle: {\n fill: '#000'\n },\n position: 'end',\n offset: 6\n };\n\n constructor(attributes: LineLabelAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, LineLabel.defaultAttributes, attributes));\n }\n\n protected getGraphicBounds(graphic: ILine, point: Partial<PointLocationCfg> = {}, position = 'end') {\n if (!graphic || (graphic.type !== 'line' && graphic.type !== 'area')) {\n return super.getGraphicBounds(graphic, point);\n }\n\n let points = graphic.attribute.points;\n const segments = graphic.attribute.segments;\n\n if (!points && segments && segments.length) {\n points = segments.reduce((res: IPointLike[], seg: ISegment) => {\n return res.concat(seg.points ?? []);\n }, []);\n }\n\n if (!points || points.length === 0) {\n points = [point as IPointLike];\n }\n\n const index = position === 'start' ? 0 : points.length - 1;\n if (!points[index]) {\n return;\n }\n return {\n x1: points[index].x as number,\n x2: points[index].x as number,\n y1: points[index].y as number,\n y2: points[index].y as number\n };\n }\n\n protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position: string = 'end', offset = 0) {\n return labelingLineOrArea(textBounds, graphicBounds, position, offset);\n }\n}\n\nexport const registerLineDataLabel = () => {\n registerLabelComponent('line', LineLabel);\n registerLabelComponent('area', LineLabel);\n};\n"]}
@@ -18,7 +18,7 @@ function wrapPoptip(target, source) {
18
18
 
19
19
  let PopTipRenderContribution = class {
20
20
  render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
21
- var _a;
21
+ var _a, _b;
22
22
  if (1 === graphic._showPoptip) {
23
23
  const {visible: visible, visibleCb: visibleCb} = graphic.attribute.poptip || {};
24
24
  if (!1 === visible || visibleCb && !1 === visibleCb(graphic)) return;
@@ -41,9 +41,9 @@ let PopTipRenderContribution = class {
41
41
  })), drawContext.stage.tryInitInteractiveLayer();
42
42
  const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
43
43
  interactiveLayer && interactiveLayer.add(this.poptipComponent);
44
- } else 2 === graphic._showPoptip && (graphic._showPoptip = 0, this.poptipComponent && this.poptipComponent.setAttributes({
44
+ } else 2 === graphic._showPoptip && (graphic._showPoptip = 0, this.poptipComponent && (this.poptipComponent.setAttributes({
45
45
  visibleAll: !1
46
- }));
46
+ }), null === (_b = this.poptipComponent.parent) || void 0 === _b || _b.removeChild(this.poptipComponent)));
47
47
  }
48
48
  };
49
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH,EACnH,OAAa;;QAEb,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YAC7B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAI,OAAO,CAAC,SAAiB,CAAC,M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CAAC,uBAAuB,EAAE,CAAC;YAC5C,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC5C;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,eAAe;gBAClB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;SACN;IACH,CAAC;CACF,CAAA;AAhEY,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CAgEpC;SAhEY,wBAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n this.poptipComponent &&\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAAmB,EAC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,GAAG,OAAO,CAAC,iBAAiB,CAAC;YACzC,IAAI,CAAC,eAAe,CAAC,aAAa,+BAChC,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,KAAK,EACf,gBAAgB,EAAE,KAAK,IACpB,MAAM,KACT,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,IACX,CAAC;YAEH,WAAW,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAC5C,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC5C;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,MAAA,IAAI,CAAC,eAAe,CAAC,MAAM,0CAAE,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAChE;SACF;IACH,CAAC;CACF,CAAA;AAlEY,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CAkEpC;SAlEY,wBAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n if (this.poptipComponent) {\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n this.poptipComponent.parent?.removeChild(this.poptipComponent);\n }\n }\n }\n}\n"]}
package/es/util/align.js CHANGED
@@ -1,54 +1,34 @@
1
1
  export function alignAxisLabels(labels, start, containerSize, orient, align) {
2
- if ("right" === orient || "left" === orient) {
3
- if ("left" === align) {
4
- const flag = "right" === orient ? 0 : -1;
5
- labels.forEach((label => {
6
- label.setAttributes({
7
- x: start + containerSize * flag,
8
- textAlign: "left"
9
- });
10
- }));
11
- } else if ("right" === align) {
12
- const flag = "right" === orient ? 1 : 0;
13
- labels.forEach((label => {
14
- label.setAttributes({
15
- x: start + containerSize * flag,
16
- textAlign: "right"
17
- });
18
- }));
19
- } else if ("center" === align) {
20
- const flag = "right" === orient ? 1 : -1;
21
- labels.forEach((label => {
22
- label.setAttributes({
23
- x: start + .5 * containerSize * flag,
24
- textAlign: "center"
25
- });
26
- }));
27
- }
28
- } else if ("bottom" === orient || "top" === orient) if ("top" === align) {
29
- const flag = "bottom" === orient ? 0 : -1;
30
- labels.forEach((label => {
31
- label.setAttributes({
32
- y: start + containerSize * flag,
33
- textBaseline: "top"
34
- });
35
- }));
36
- } else if ("bottom" === align) {
37
- const flag = "bottom" === orient ? 1 : 0;
38
- labels.forEach((label => {
39
- label.setAttributes({
40
- y: start + containerSize * flag,
41
- textBaseline: "bottom"
42
- });
43
- }));
44
- } else if ("middle" === align) {
45
- const flag = "bottom" === orient ? 1 : -1;
46
- labels.forEach((label => {
47
- label.setAttributes({
48
- y: start + .5 * containerSize * flag,
49
- textBaseline: "middle"
50
- });
51
- }));
52
- }
2
+ "left" === orient || "right" === orient ? "left" === align ? labels.forEach((label => {
3
+ var _a;
4
+ label.setAttributes({
5
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.x1
6
+ });
7
+ })) : "right" === align ? labels.forEach((label => {
8
+ var _a;
9
+ label.setAttributes({
10
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.x2
11
+ });
12
+ })) : "center" === align && labels.forEach((label => {
13
+ var _a;
14
+ label.setAttributes({
15
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2
16
+ });
17
+ })) : "bottom" !== orient && "top" !== orient || ("top" === align ? labels.forEach((label => {
18
+ var _a;
19
+ label.setAttributes({
20
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.y1
21
+ });
22
+ })) : "bottom" === align ? labels.forEach((label => {
23
+ var _a;
24
+ label.setAttributes({
25
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.y2
26
+ });
27
+ })) : "middle" === align && labels.forEach((label => {
28
+ var _a;
29
+ label.setAttributes({
30
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2
31
+ });
32
+ })));
53
33
  }
54
34
  //# sourceMappingURL=align.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/align.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,MAAe,EAAE,KAAa,EAAE,aAAqB,EAAE,MAAc,EAAE,KAAa;IAClH,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,MAAM,EAAE;QAC3C,IAAI,KAAK,KAAK,MAAM,EAAE;YACpB,MAAM,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,CAAC,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI;oBAC/B,SAAS,EAAE,MAAM;iBAClB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,OAAO,EAAE;YAC5B,MAAM,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,CA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Y,EAAE,QAAQ;iBACvB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,IAAI,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,CAAC,EAAE,KAAK,GAAG,aAAa,GAAG,GAAG,GAAG,IAAI;oBACrC,YAAY,EAAE,QAAQ;iBACvB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC","file":"align.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\n\nexport function alignAxisLabels(labels: IText[], start: number, containerSize: number, orient: string, align: string) {\n if (orient === 'right' || orient === 'left') {\n if (align === 'left') {\n const flag = orient === 'right' ? 0 : -1;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * flag,\n textAlign: 'left'\n });\n });\n } else if (align === 'right') {\n const flag = orient === 'right' ? 1 : 0;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * flag,\n textAlign: 'right'\n });\n });\n } else if (align === 'center') {\n const flag = orient === 'right' ? 1 : -1;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * 0.5 * flag,\n textAlign: 'center'\n });\n });\n }\n } else if (orient === 'bottom' || orient === 'top') {\n if (align === 'top') {\n const flag = orient === 'bottom' ? 0 : -1;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * flag,\n textBaseline: 'top'\n });\n });\n } else if (align === 'bottom') {\n const flag = orient === 'bottom' ? 1 : 0;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * flag,\n textBaseline: 'bottom'\n });\n });\n } else if (align === 'middle') {\n const flag = orient === 'bottom' ? 1 : -1;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * 0.5 * flag,\n text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AM,KAAK,QAAQ,IAAI,MAAM,KAAK,KAAK,EAAE;QAClD,IAAI,KAAK,KAAK,KAAK,EAAE;YACnB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE;iBAC5D,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE;iBAC5E,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC;iBAC5G,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC","file":"align.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\n\nexport function alignAxisLabels(labels: IText[], start: number, containerSize: number, orient: string, align: string) {\n if (orient === 'left' || orient === 'right') {\n if (align === 'left') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start - label.AABBBounds.x1\n });\n });\n } else if (align === 'right') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize - label.AABBBounds.x2\n });\n });\n } else if (align === 'center') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2\n });\n });\n }\n } else if (orient === 'bottom' || orient === 'top') {\n if (align === 'top') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start - label.AABBBounds.y1\n });\n });\n } else if (align === 'bottom') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize - label.AABBBounds.y2\n });\n });\n } else if (align === 'middle') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2\n });\n });\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.20.1-alpha.3",
3
+ "version": "0.20.1-alpha.5",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,8 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "0.20.1-alpha.3",
16
- "@visactor/vrender-kits": "0.20.1-alpha.3",
15
+ "@visactor/vrender-core": "0.20.1-alpha.5",
16
+ "@visactor/vrender-kits": "0.20.1-alpha.5",
17
17
  "@visactor/vutils": "~0.18.14",
18
18
  "@visactor/vscale": "~0.18.14"
19
19
  },
@@ -30,8 +30,8 @@
30
30
  "typescript": "4.9.5",
31
31
  "cross-env": "^7.0.3",
32
32
  "@internal/bundler": "0.0.1",
33
- "@internal/eslint-config": "0.0.1",
34
- "@internal/ts-config": "0.0.1"
33
+ "@internal/ts-config": "0.0.1",
34
+ "@internal/eslint-config": "0.0.1"
35
35
  },
36
36
  "keywords": [
37
37
  "VisActor",