@visactor/vrender-components 0.23.0-alpha.3 → 1.0.0-alpha.1

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 (122) hide show
  1. package/cjs/animation/animate-component.d.ts +22 -0
  2. package/cjs/animation/animate-component.js +29 -0
  3. package/cjs/animation/animate-component.js.map +1 -0
  4. package/cjs/animation/axis-animate.d.ts +10 -0
  5. package/cjs/animation/axis-animate.js +71 -0
  6. package/cjs/animation/axis-animate.js.map +1 -0
  7. package/cjs/animation/label-animate.d.ts +10 -0
  8. package/cjs/animation/label-animate.js +80 -0
  9. package/cjs/animation/label-animate.js.map +1 -0
  10. package/cjs/axis/animate/config.d.ts +6 -0
  11. package/cjs/axis/animate/config.js +10 -0
  12. package/cjs/axis/animate/config.js.map +1 -0
  13. package/cjs/axis/animate/group-transition.d.ts +2 -1
  14. package/cjs/axis/animate/group-transition.js +2 -2
  15. package/cjs/axis/animate/group-transition.js.map +1 -1
  16. package/cjs/axis/base.d.ts +7 -2
  17. package/cjs/axis/base.js +70 -5
  18. package/cjs/axis/base.js.map +1 -1
  19. package/cjs/axis/line.js.map +1 -1
  20. package/cjs/axis/register.js +2 -2
  21. package/cjs/axis/register.js.map +1 -1
  22. package/cjs/axis/type.d.ts +4 -0
  23. package/cjs/axis/type.js.map +1 -1
  24. package/cjs/brush/config.js +1 -2
  25. package/cjs/brush/type.js +2 -1
  26. package/cjs/crosshair/rect.js +1 -2
  27. package/cjs/crosshair/type.js +2 -1
  28. package/cjs/index.d.ts +1 -1
  29. package/cjs/index.js +1 -1
  30. package/cjs/index.js.map +1 -1
  31. package/cjs/indicator/register.js +1 -2
  32. package/cjs/jsx/index.js +2 -1
  33. package/cjs/label/animate/animate.d.ts +1 -12
  34. package/cjs/label/animate/animate.js +1 -78
  35. package/cjs/label/animate/animate.js.map +1 -1
  36. package/cjs/label/base.d.ts +4 -3
  37. package/cjs/label/base.js +40 -32
  38. package/cjs/label/base.js.map +1 -1
  39. package/cjs/label/dataLabel.js +1 -1
  40. package/cjs/label/overlap/scaler.js +3 -3
  41. package/cjs/label/overlap/scaler.js.map +1 -1
  42. package/cjs/label/register.d.ts +1 -0
  43. package/cjs/label/register.js +8 -4
  44. package/cjs/label/register.js.map +1 -1
  45. package/cjs/label-item/index.js +1 -1
  46. package/cjs/label-item/label-item.js +1 -1
  47. package/cjs/label-item/label-item.js.map +1 -1
  48. package/cjs/label-item/register.js +1 -1
  49. package/cjs/label-item/type.js +1 -1
  50. package/cjs/poptip/contribution.js +4 -2
  51. package/cjs/poptip/contribution.js.map +1 -1
  52. package/cjs/poptip/poptip.d.ts +5 -0
  53. package/cjs/poptip/poptip.js +87 -18
  54. package/cjs/poptip/poptip.js.map +1 -1
  55. package/cjs/poptip/type.d.ts +4 -1
  56. package/cjs/poptip/type.js.map +1 -1
  57. package/cjs/tag/tag.js +60 -56
  58. package/cjs/tag/tag.js.map +1 -1
  59. package/cjs/weather/weather-box.d.ts +1 -2
  60. package/cjs/weather/weather-box.js.map +1 -1
  61. package/dist/index.es.js +2389 -1786
  62. package/es/animation/animate-component.d.ts +22 -0
  63. package/es/animation/animate-component.js +21 -0
  64. package/es/animation/animate-component.js.map +1 -0
  65. package/es/animation/axis-animate.d.ts +10 -0
  66. package/es/animation/axis-animate.js +60 -0
  67. package/es/animation/axis-animate.js.map +1 -0
  68. package/es/animation/label-animate.d.ts +10 -0
  69. package/es/animation/label-animate.js +69 -0
  70. package/es/animation/label-animate.js.map +1 -0
  71. package/es/axis/animate/config.d.ts +6 -0
  72. package/es/axis/animate/config.js +6 -0
  73. package/es/axis/animate/config.js.map +1 -0
  74. package/es/axis/animate/group-transition.d.ts +2 -1
  75. package/es/axis/animate/group-transition.js +3 -1
  76. package/es/axis/animate/group-transition.js.map +1 -1
  77. package/es/axis/base.d.ts +7 -2
  78. package/es/axis/base.js +75 -9
  79. package/es/axis/base.js.map +1 -1
  80. package/es/axis/line.js.map +1 -1
  81. package/es/axis/register.js +3 -1
  82. package/es/axis/register.js.map +1 -1
  83. package/es/axis/type.d.ts +4 -0
  84. package/es/axis/type.js.map +1 -1
  85. package/es/brush/config.js +1 -2
  86. package/es/brush/type.js +2 -1
  87. package/es/crosshair/rect.js +1 -2
  88. package/es/crosshair/type.js +2 -1
  89. package/es/index.d.ts +1 -1
  90. package/es/index.js +1 -1
  91. package/es/index.js.map +1 -1
  92. package/es/indicator/register.js +1 -2
  93. package/es/jsx/index.js +2 -1
  94. package/es/label/animate/animate.d.ts +1 -12
  95. package/es/label/animate/animate.js +0 -76
  96. package/es/label/animate/animate.js.map +1 -1
  97. package/es/label/base.d.ts +4 -3
  98. package/es/label/base.js +42 -32
  99. package/es/label/base.js.map +1 -1
  100. package/es/label/dataLabel.js +1 -1
  101. package/es/label/overlap/scaler.js +1 -1
  102. package/es/label/overlap/scaler.js.map +1 -1
  103. package/es/label/register.d.ts +1 -0
  104. package/es/label/register.js +7 -1
  105. package/es/label/register.js.map +1 -1
  106. package/es/label-item/index.js +1 -1
  107. package/es/label-item/label-item.js +1 -1
  108. package/es/label-item/label-item.js.map +1 -1
  109. package/es/label-item/register.js +1 -1
  110. package/es/label-item/type.js +1 -1
  111. package/es/poptip/contribution.js +4 -2
  112. package/es/poptip/contribution.js.map +1 -1
  113. package/es/poptip/poptip.d.ts +5 -0
  114. package/es/poptip/poptip.js +85 -19
  115. package/es/poptip/poptip.js.map +1 -1
  116. package/es/poptip/type.d.ts +4 -1
  117. package/es/poptip/type.js.map +1 -1
  118. package/es/tag/tag.js +59 -56
  119. package/es/tag/tag.js.map +1 -1
  120. package/es/weather/weather-box.d.ts +1 -2
  121. package/es/weather/weather-box.js.map +1 -1
  122. package/package.json +7 -7
@@ -65,4 +65,4 @@ class DataLabel extends base_1.AbstractComponent {
65
65
  exports.DataLabel = DataLabel, DataLabel.defaultAttributes = {
66
66
  pickable: !1
67
67
  };
68
- //# sourceMappingURL=dataLabel.js.map
68
+ //# sourceMappingURL=dataLabel.js.map
@@ -19,9 +19,9 @@ function bitmapTool(width, height, padding = {
19
19
  }
20
20
 
21
21
  function clampRangeByBitmap($, range) {
22
- const {x1: x1, x2: x2, y1: y1, y2: y2} = range, _x1 = (0, vutils_1.clamp)(x1, 0, $.width), _x2 = (0,
23
- vutils_1.clamp)(x2, 0, $.width), _y1 = (0, vutils_1.clamp)(y1, 0, $.height), _y2 = (0,
24
- vutils_1.clamp)(y2, 0, $.height);
22
+ const {x1: x1, x2: x2, y1: y1, y2: y2} = range, {top: top = 0, left: left = 0, right: right = 0, bottom: bottom = 0} = $.padding, _x1 = (0,
23
+ vutils_1.clamp)(x1, -left, $.width + right), _x2 = (0, vutils_1.clamp)(x2, -left, $.width + right), _y1 = (0,
24
+ vutils_1.clamp)(y1, -top, $.height + bottom), _y2 = (0, vutils_1.clamp)(y2, -top, $.height + bottom);
25
25
  return {
26
26
  x1: $.x(_x1),
27
27
  x2: $.x(_x2),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/overlap/scaler.ts"],"names":[],"mappings":";;;AACA,6CAAuD;AACvD,qCAAkC;AAiClC,SAAgB,UAAU,CACxB,KAAa,EACb,MAAc,EACd,UAA4E,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IAEpH,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IACrD,MAA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GAAG,IAAA,cAAU,EAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACb,CAAC;AACJ,CAAC;AAZD,gDAYC;AAED,SAAgB,YAAY,CAAC,CAAa,EAAE,KAAkB,EAAE,QAAiB,KAAK;IACpF,IAAI,KAAK,EAAE;QACT,OAAO,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;KACrC;IAED,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;KAClB,CAAC;AACJ,CAAC;AAXD,oCAWC","file":"scaler.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { clamp as clampRange } from '@visactor/vutils';\nimport { bitmap } from './bitmap';\n\n/**\n * 防重叠逻辑参考 https://github.com/vega/vega/\n * Copyright (c) 2015-2023, University of Washington Interactive Data Lab\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of the copyright holder nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport function bitmapTool(\n width: number,\n height: number,\n padding: { top?: number; left?: number; right?: number; bottom?: number } = { top: 0, left: 0, right: 0, bottom: 0 }\n) {\n const { top = 0, left = 0, right = 0, bottom = 0 } = padding;\n const ratio = Math.max(1, Math.sqrt((width * height) / 1e6));\n const w = ~~((width + left + right + ratio) / ratio);\n const h = ~~((height + top + bottom + ratio) / ratio);\n const scale = (_: number) => ~~(_ / ratio);\n\n scale.bitmap = () => bitmap(w, h);\n scale.x = (_: number) => ~~((_ + left) / ratio);\n scale.y = (_: number) => ~~((_ + top) / ratio);\n\n scale.ratio = ratio;\n scale.padding = padding;\n scale.width = width;\n scale.height = height;\n\n return scale;\n}\n\nexport function clampRangeByBitmap($: BitmapTool, range: IBoundsLike) {\n const { x1, x2, y1, y2 } = range;\n const _x1 = clampRange(x1, 0, $.width);\n const _x2 = clampRange(x2, 0, $.width);\n const _y1 = clampRange(y1, 0, $.height);\n const _y2 = clampRange(y2, 0, $.height);\n return {\n x1: $.x(_x1),\n x2: $.x(_x2),\n y1: $.y(_y1),\n y2: $.y(_y2)\n };\n}\n\nexport function boundToRange($: BitmapTool, bound: IBoundsLike, clamp: boolean = false) {\n if (clamp) {\n return clampRangeByBitmap($, bound);\n }\n\n return {\n x1: $.x(bound.x1),\n x2: $.x(bound.x2),\n y1: $.y(bound.y1),\n y2: $.y(bound.y2)\n };\n}\n\nexport type BitmapTool = ReturnType<typeof bitmapTool>;\n"]}
1
+ {"version":3,"sources":["../src/label/overlap/scaler.ts"],"names":[],"mappings":";;;AACA,6CAAuD;AACvD,qCAAkC;AAiClC,SAAgB,UAAU,CACxB,KAAa,EACb,MAAc,EACd,UAA4E,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IAEpH,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAE3C,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE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AAC,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACZ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACb,CAAC;AACJ,CAAC;AAbD,gDAaC;AAED,SAAgB,YAAY,CAAC,CAAa,EAAE,KAAkB,EAAE,QAAiB,KAAK;IACpF,IAAI,KAAK,EAAE;QACT,OAAO,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;KACrC;IAED,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;KAClB,CAAC;AACJ,CAAC;AAXD,oCAWC","file":"scaler.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { clamp as clampRange } from '@visactor/vutils';\nimport { bitmap } from './bitmap';\n\n/**\n * 防重叠逻辑参考 https://github.com/vega/vega/\n * Copyright (c) 2015-2023, University of Washington Interactive Data Lab\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of the copyright holder nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport function bitmapTool(\n width: number,\n height: number,\n padding: { top?: number; left?: number; right?: number; bottom?: number } = { top: 0, left: 0, right: 0, bottom: 0 }\n) {\n const { top = 0, left = 0, right = 0, bottom = 0 } = padding;\n const ratio = Math.max(1, Math.sqrt((width * height) / 1e6));\n const w = ~~((width + left + right + ratio) / ratio);\n const h = ~~((height + top + bottom + ratio) / ratio);\n const scale = (_: number) => ~~(_ / ratio);\n\n scale.bitmap = () => bitmap(w, h);\n scale.x = (_: number) => ~~((_ + left) / ratio);\n scale.y = (_: number) => ~~((_ + top) / ratio);\n\n scale.ratio = ratio;\n scale.padding = padding;\n scale.width = width;\n scale.height = height;\n\n return scale;\n}\n\nexport function clampRangeByBitmap($: BitmapTool, range: IBoundsLike) {\n const { x1, x2, y1, y2 } = range;\n const { top = 0, left = 0, right = 0, bottom = 0 } = $.padding;\n const _x1 = clampRange(x1, -left, $.width + right);\n const _x2 = clampRange(x2, -left, $.width + right);\n const _y1 = clampRange(y1, -top, $.height + bottom);\n const _y2 = clampRange(y2, -top, $.height + bottom);\n return {\n x1: $.x(_x1),\n x2: $.x(_x2),\n y1: $.y(_y1),\n y2: $.y(_y2)\n };\n}\n\nexport function boundToRange($: BitmapTool, bound: IBoundsLike, clamp: boolean = false) {\n if (clamp) {\n return clampRangeByBitmap($, bound);\n }\n\n return {\n x1: $.x(bound.x1),\n x2: $.x(bound.x2),\n y1: $.y(bound.y1),\n y2: $.y(bound.y2)\n };\n}\n\nexport type BitmapTool = ReturnType<typeof bitmapTool>;\n"]}
@@ -1 +1,2 @@
1
1
  export declare function loadLabelComponent(): void;
2
+ export declare function loadLabelAnimate(): void;
@@ -2,14 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.loadLabelComponent = void 0;
5
+ }), exports.loadLabelAnimate = exports.loadLabelComponent = void 0;
6
6
 
7
- const vrender_kits_1 = require("@visactor/vrender-kits");
7
+ const vrender_kits_1 = require("@visactor/vrender-kits"), label_animate_1 = require("../animation/label-animate");
8
8
 
9
9
  function loadLabelComponent() {
10
10
  (0, vrender_kits_1.registerGroup)(), (0, vrender_kits_1.registerText)(), (0, vrender_kits_1.registerRichtext)(),
11
- (0, vrender_kits_1.registerLine)();
11
+ (0, vrender_kits_1.registerLine)(), (0, label_animate_1.registerLabelAnimate)();
12
12
  }
13
13
 
14
- exports.loadLabelComponent = loadLabelComponent;
14
+ function loadLabelAnimate() {
15
+ (0, label_animate_1.registerLabelAnimate)();
16
+ }
17
+
18
+ exports.loadLabelComponent = loadLabelComponent, exports.loadLabelAnimate = loadLabelAnimate;
15
19
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/register.ts"],"names":[],"mappings":";;;AAAA,yDAAqG;AAErG,SAAgB,kBAAkB;IAChC,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,2BAAY,GAAE,CAAC;AACjB,CAAC;AALD,gDAKC","file":"register.js","sourcesContent":["import { registerGroup, registerLine, registerRichtext, registerText } from '@visactor/vrender-kits';\n\nexport function loadLabelComponent() {\n registerGroup();\n registerText();\n registerRichtext();\n registerLine();\n}\n"]}
1
+ {"version":3,"sources":["../src/label/register.ts"],"names":[],"mappings":";;;AAAA,yDAAqG;AACrG,8DAAkE;AAElE,SAAgB,kBAAkB;IAChC,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,oCAAoB,GAAE,CAAC;AACzB,CAAC;AAND,gDAMC;AAED,SAAgB,gBAAgB;IAC9B,IAAA,oCAAoB,GAAE,CAAC;AACzB,CAAC;AAFD,4CAEC","file":"register.js","sourcesContent":["import { registerGroup, registerLine, registerRichtext, registerText } from '@visactor/vrender-kits';\nimport { registerLabelAnimate } from '../animation/label-animate';\n\nexport function loadLabelComponent() {\n registerGroup();\n registerText();\n registerRichtext();\n registerLine();\n registerLabelAnimate();\n}\n\nexport function loadLabelAnimate() {\n registerLabelAnimate();\n}\n"]}
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./label-item"), exports), __exportStar(require("./type"), exports);
21
- //# sourceMappingURL=index.js.map
21
+ //# sourceMappingURL=index.js.map
@@ -160,4 +160,4 @@ exports.StoryLabelItem = StoryLabelItem, StoryLabelItem.defaultAttributes = {
160
160
  },
161
161
  theme: "default"
162
162
  };
163
- //# sourceMappingURL=label-item.js.map
163
+ //# sourceMappingURL=label-item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label-item/label-item.ts"],"names":[],"mappings":";;;AAUA,uCAAiD;AAGjD,6CAA8C;AAE9C,MAAa,cAAe,SAAQ,wBAAiD;IA6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;QACd,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,OAAO;KACsB;IAErC,qBAAqB,EAAE;QACrB,UAAU,EAAE,iDAAiD;QAC7D,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,OAAO;KACoB;IACrC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClB,kBAAkB,EAAE;QAClB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IAED,KAAK,EAAE,SAAS;CACjB,CAAC","file":"label-item.js","sourcesContent":["import type {\n IGroup,\n ILine,\n ILineGraphicAttribute,\n IRect,\n ISymbol,\n ISymbolGraphicAttribute,\n IText\n} from '@visactor/vrender-core';\nimport { InputText } from '@visactor/vrender-animate';\nimport { AbstractComponent } from '../core/base';\nimport type { IStoryLabelItemAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { max, merge } from '@visactor/vutils';\n\nexport class StoryLabelItem extends AbstractComponent<Required<IStoryLabelItemAttrs>> {\n name: 'labelItem';\n _line?: ILine;\n _symbolStart: ISymbol;\n _symbolEnd: ISymbol;\n _symbolStartOuter: ISymbol;\n _titleTop: IText;\n _titleBottom: IText;\n _titleTopPanel: IRect;\n _titleBottomPanel: IRect;\n\n static defaultAttributes: Partial<IStoryLabelItemAttrs> = {\n // 内容在X上的偏移量\n contentOffsetX: 100,\n // 内容在Y上的偏移量\n contentOffsetY: -60,\n titleTopStyle: {\n fontSize: 12,\n fill: 'white'\n },\n titleBottomStyle: {\n fontSize: 12,\n fill: 'white'\n },\n lineStyle: {\n stroke: 'white',\n lineWidth: 1\n } as ILineGraphicAttribute,\n // 线段开始端点的样式\n symbolStartStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段结束端点的样式\n symbolEndStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段开始端点外面包裹symbol的样式\n symbolStartOuterStyle: {\n symbolType: 'M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0',\n size: 8,\n stroke: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n titleSpace: [2, 2],\n titleTopPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n titleBottomPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n // 默认和简约两套主题\n theme: 'default'\n };\n\n constructor(attributes: IStoryLabelItemAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, StoryLabelItem.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const {\n contentOffsetX,\n contentOffsetY,\n lineStyle,\n symbolStartStyle,\n symbolEndStyle,\n symbolStartOuterStyle,\n titleTop: titleTopText,\n titleBottom: titleBottomText,\n titleTopStyle,\n titleBottomStyle,\n titleSpace,\n titleTopPanelStyle,\n titleBottomPanelStyle,\n theme\n } = this.attribute;\n\n const group = this.createOrUpdateChild('label-item-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n const symbolStart = group.createOrUpdateChild(\n 'label-item-symbol-start',\n { x: 0, y: 0, ...symbolStartStyle },\n 'symbol'\n ) as ISymbol;\n const symbolEnd = group.createOrUpdateChild(\n 'label-item-symbol-end',\n { x: contentOffsetX, y: contentOffsetY, ...symbolEndStyle },\n 'symbol'\n ) as ISymbol;\n const symbolStartOut = group.createOrUpdateChild(\n 'label-item-symbol-start-out',\n { x: 0, y: 0, ...symbolStartOuterStyle },\n 'symbol'\n ) as ISymbol;\n\n const spaceW = titleSpace[0];\n const spaceH = titleSpace[1];\n // 逻辑:group占满,title在group内做偏移\n const titleTopGroup = group.createOrUpdateChild(\n 'label-item-title-top-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleTop = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top',\n {\n x: spaceW,\n y: -spaceH,\n text: titleTopText,\n ...titleTopStyle,\n textBaseline: 'bottom',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleTopBounds = titleTop.AABBBounds;\n if (contentOffsetX > 0) {\n titleTopGroup.setAttributes({ x: contentOffsetX - titleTopBounds.width() - spaceW * 2 });\n }\n titleTopGroup.setAttributes({\n width: titleTopBounds.width() + spaceW * 2,\n height: -titleTopBounds.height() - spaceH * 2\n });\n // 添加panel\n const titleTopPanel = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top-panel',\n {\n ...titleTopPanelStyle,\n x: titleTopPanelStyle.padding.left,\n y: (titleTopGroup.attribute.height > 0 ? 0 : titleTopGroup.attribute.height) + titleTopPanelStyle.padding.top,\n width: titleTopGroup.attribute.width - titleTopPanelStyle.padding.left - titleTopPanelStyle.padding.right,\n height:\n (titleTopGroup.attribute.height > 0 ? 1 : -1) * titleTopGroup.attribute.height -\n titleTopPanelStyle.padding.bottom -\n titleTopPanelStyle.padding.top,\n scaleCenter: [titleTopGroup.attribute.width / 2, titleTopGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleTopPanel = titleTopPanel;\n\n const titleBottomGroup = group.createOrUpdateChild(\n 'label-item-title-bottom-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleBottom = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom',\n {\n x: spaceW,\n y: spaceH,\n text: titleBottomText,\n ...titleBottomStyle,\n textBaseline: 'top',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleBottomBounds = titleBottom.AABBBounds;\n if (contentOffsetX > 0) {\n titleBottomGroup.setAttributes({ x: contentOffsetX - titleBottomBounds.width() - spaceW * 2 });\n }\n titleBottomGroup.setAttributes({\n width: titleBottomBounds.width() + spaceW * 2,\n height: titleTopBounds.height() + spaceH * 2\n });\n // 添加panel\n const titleBottomPanel = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom-panel',\n {\n ...titleBottomPanelStyle,\n x: titleBottomPanelStyle.padding.left,\n y:\n (titleBottomGroup.attribute.height > 0 ? 0 : titleBottomGroup.attribute.height) +\n titleBottomPanelStyle.padding.top,\n width:\n titleBottomGroup.attribute.width - titleBottomPanelStyle.padding.left - titleBottomPanelStyle.padding.right,\n height:\n (titleBottomGroup.attribute.height > 0 ? 1 : -1) * titleBottomGroup.attribute.height -\n titleBottomPanelStyle.padding.bottom -\n titleBottomPanelStyle.padding.top,\n scaleCenter: [titleBottomGroup.attribute.width / 2, titleBottomGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleBottomPanel = titleBottomPanel;\n\n const maxTextWidth = Math.max(titleTop.AABBBounds.width(), titleBottom.AABBBounds.width()) + spaceW * 2;\n const points = [\n { x: 0, y: 0 },\n contentOffsetX > 0\n ? { x: contentOffsetX - maxTextWidth, y: contentOffsetY }\n : { x: contentOffsetX + maxTextWidth, y: contentOffsetY },\n { x: contentOffsetX, y: contentOffsetY }\n ];\n // simple风格,不绘制终点,同时文字也要居中\n if (theme === 'simple') {\n points.pop();\n const p = points[1];\n symbolEnd.setAttributes(p);\n }\n const line = group.createOrUpdateChild('label-item-line', { x: 0, y: 0, ...lineStyle, points }, 'line') as ILine;\n\n this._symbolEnd = symbolEnd;\n this._symbolStart = symbolStart;\n this._symbolStartOuter = symbolStartOut;\n this._titleTop = titleTop;\n this._titleBottom = titleBott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;QACf,SAAS,EAAE,CAAC;KACY;IAE1B,gBAAgB,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,OAAO;KACsB;IAErC,cAAc,EAAE;QACd,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,OAAO;KACsB;IAErC,qBAAqB,EAAE;QACrB,UAAU,EAAE,iDAAiD;QAC7D,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,OAAO;KACoB;IACrC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClB,kBAAkB,EAAE;QAClB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IAED,KAAK,EAAE,SAAS;CACjB,CAAC","file":"label-item.js","sourcesContent":["import type {\n IGroup,\n ILine,\n ILineGraphicAttribute,\n IRect,\n ISymbol,\n ISymbolGraphicAttribute,\n IText\n} from '@visactor/vrender-core';\nimport { AbstractComponent } from '../core/base';\nimport type { IStoryLabelItemAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { merge } from '@visactor/vutils';\n\nexport class StoryLabelItem extends AbstractComponent<Required<IStoryLabelItemAttrs>> {\n name: 'labelItem';\n _line?: ILine;\n _symbolStart: ISymbol;\n _symbolEnd: ISymbol;\n _symbolStartOuter: ISymbol;\n _titleTop: IText;\n _titleBottom: IText;\n _titleTopPanel: IRect;\n _titleBottomPanel: IRect;\n\n static defaultAttributes: Partial<IStoryLabelItemAttrs> = {\n // 内容在X上的偏移量\n contentOffsetX: 100,\n // 内容在Y上的偏移量\n contentOffsetY: -60,\n titleTopStyle: {\n fontSize: 12,\n fill: 'white'\n },\n titleBottomStyle: {\n fontSize: 12,\n fill: 'white'\n },\n lineStyle: {\n stroke: 'white',\n lineWidth: 1\n } as ILineGraphicAttribute,\n // 线段开始端点的样式\n symbolStartStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段结束端点的样式\n symbolEndStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段开始端点外面包裹symbol的样式\n symbolStartOuterStyle: {\n symbolType: 'M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0',\n size: 8,\n stroke: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n titleSpace: [2, 2],\n titleTopPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n titleBottomPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n // 默认和简约两套主题\n theme: 'default'\n };\n\n constructor(attributes: IStoryLabelItemAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, StoryLabelItem.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const {\n contentOffsetX,\n contentOffsetY,\n lineStyle,\n symbolStartStyle,\n symbolEndStyle,\n symbolStartOuterStyle,\n titleTop: titleTopText,\n titleBottom: titleBottomText,\n titleTopStyle,\n titleBottomStyle,\n titleSpace,\n titleTopPanelStyle,\n titleBottomPanelStyle,\n theme\n } = this.attribute;\n\n const group = this.createOrUpdateChild('label-item-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n const symbolStart = group.createOrUpdateChild(\n 'label-item-symbol-start',\n { x: 0, y: 0, ...symbolStartStyle },\n 'symbol'\n ) as ISymbol;\n const symbolEnd = group.createOrUpdateChild(\n 'label-item-symbol-end',\n { x: contentOffsetX, y: contentOffsetY, ...symbolEndStyle },\n 'symbol'\n ) as ISymbol;\n const symbolStartOut = group.createOrUpdateChild(\n 'label-item-symbol-start-out',\n { x: 0, y: 0, ...symbolStartOuterStyle },\n 'symbol'\n ) as ISymbol;\n\n const spaceW = titleSpace[0];\n const spaceH = titleSpace[1];\n // 逻辑:group占满,title在group内做偏移\n const titleTopGroup = group.createOrUpdateChild(\n 'label-item-title-top-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleTop = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top',\n {\n x: spaceW,\n y: -spaceH,\n text: titleTopText,\n ...titleTopStyle,\n textBaseline: 'bottom',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleTopBounds = titleTop.AABBBounds;\n if (contentOffsetX > 0) {\n titleTopGroup.setAttributes({ x: contentOffsetX - titleTopBounds.width() - spaceW * 2 });\n }\n titleTopGroup.setAttributes({\n width: titleTopBounds.width() + spaceW * 2,\n height: -titleTopBounds.height() - spaceH * 2\n });\n // 添加panel\n const titleTopPanel = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top-panel',\n {\n ...titleTopPanelStyle,\n x: titleTopPanelStyle.padding.left,\n y: (titleTopGroup.attribute.height > 0 ? 0 : titleTopGroup.attribute.height) + titleTopPanelStyle.padding.top,\n width: titleTopGroup.attribute.width - titleTopPanelStyle.padding.left - titleTopPanelStyle.padding.right,\n height:\n (titleTopGroup.attribute.height > 0 ? 1 : -1) * titleTopGroup.attribute.height -\n titleTopPanelStyle.padding.bottom -\n titleTopPanelStyle.padding.top,\n scaleCenter: [titleTopGroup.attribute.width / 2, titleTopGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleTopPanel = titleTopPanel;\n\n const titleBottomGroup = group.createOrUpdateChild(\n 'label-item-title-bottom-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleBottom = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom',\n {\n x: spaceW,\n y: spaceH,\n text: titleBottomText,\n ...titleBottomStyle,\n textBaseline: 'top',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleBottomBounds = titleBottom.AABBBounds;\n if (contentOffsetX > 0) {\n titleBottomGroup.setAttributes({ x: contentOffsetX - titleBottomBounds.width() - spaceW * 2 });\n }\n titleBottomGroup.setAttributes({\n width: titleBottomBounds.width() + spaceW * 2,\n height: titleTopBounds.height() + spaceH * 2\n });\n // 添加panel\n const titleBottomPanel = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom-panel',\n {\n ...titleBottomPanelStyle,\n x: titleBottomPanelStyle.padding.left,\n y:\n (titleBottomGroup.attribute.height > 0 ? 0 : titleBottomGroup.attribute.height) +\n titleBottomPanelStyle.padding.top,\n width:\n titleBottomGroup.attribute.width - titleBottomPanelStyle.padding.left - titleBottomPanelStyle.padding.right,\n height:\n (titleBottomGroup.attribute.height > 0 ? 1 : -1) * titleBottomGroup.attribute.height -\n titleBottomPanelStyle.padding.bottom -\n titleBottomPanelStyle.padding.top,\n scaleCenter: [titleBottomGroup.attribute.width / 2, titleBottomGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleBottomPanel = titleBottomPanel;\n\n const maxTextWidth = Math.max(titleTop.AABBBounds.width(), titleBottom.AABBBounds.width()) + spaceW * 2;\n const points = [\n { x: 0, y: 0 },\n contentOffsetX > 0\n ? { x: contentOffsetX - maxTextWidth, y: contentOffsetY }\n : { x: contentOffsetX + maxTextWidth, y: contentOffsetY },\n { x: contentOffsetX, y: contentOffsetY }\n ];\n // simple风格,不绘制终点,同时文字也要居中\n if (theme === 'simple') {\n points.pop();\n const p = points[1];\n symbolEnd.setAttributes(p);\n }\n const line = group.createOrUpdateChild('label-item-line', { x: 0, y: 0, ...lineStyle, points }, 'line') as ILine;\n\n this._symbolEnd = symbolEnd;\n this._symbolStart = symbolStart;\n this._symbolStartOuter = symbolStartOut;\n this._titleTop = titleTop;\n this._titleBottom = titleBottom;\n this._line = line;\n }\n}\n"]}
@@ -12,4 +12,4 @@ function loadLabelItemComponent() {
12
12
  }
13
13
 
14
14
  exports.loadLabelItemComponent = loadLabelItemComponent;
15
- //# sourceMappingURL=register.js.map
15
+ //# sourceMappingURL=register.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=type.js.map
6
+ //# sourceMappingURL=type.js.map
@@ -34,10 +34,12 @@ let PopTipRenderContribution = class {
34
34
  this.poptipComponent.setAttributes(Object.assign(Object.assign({
35
35
  visibleAll: !0,
36
36
  pickable: !1,
37
- childrenPickable: !1
37
+ childrenPickable: !1,
38
+ poptipAnchor: "bounds"
38
39
  }, poptip), {
39
40
  x: matrix.e,
40
- y: matrix.f
41
+ y: matrix.f,
42
+ positionBounds: graphic.globalAABBBounds
41
43
  })), drawContext.stage.tryInitInteractiveLayer();
42
44
  const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
43
45
  interactiveLayer && interactiveLayer.add(this.poptipComponent);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAQA,yDAAoD;AACpD,qCAAkC;AAClC,6CAAyC;AACzC,mCAAgC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,IAAA,cAAK,EAAC,MAAM,EAAE,aAAK,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,gBAA6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,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;gBAC/D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;SACF;IACH,CAAC;CACF,CAAA;AAnEY,wBAAwB;IADpC,IAAA,yBAAU,GAAE;GACA,wBAAwB,CAmEpC;AAnEY,4DAAwB","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 this.poptipComponent = null;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAQA,yDAAoD;AACpD,qCAAkC;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AA,yBAAU,GAAE;GACA,wBAAwB,CAsEpC;AAtEY,4DAAwB","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 // 默认使用bounds作为锚点\n poptipAnchor: 'bounds',\n ...poptip,\n x: matrix.e,\n y: matrix.f,\n positionBounds: graphic.globalAABBBounds\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 this.poptipComponent = null;\n }\n }\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { type IGroup, type IText } from '@visactor/vrender-core';
2
+ import { type IAABBBoundsLike } from '@visactor/vutils';
2
3
  import { AbstractComponent } from '../core/base';
3
4
  import type { ComponentOptions } from '../interface';
4
5
  import type { PopTipAttributes } from './type';
@@ -11,6 +12,10 @@ export declare class PopTip extends AbstractComponent<Required<PopTipAttributes>
11
12
  constructor(attributes: PopTipAttributes, options?: ComponentOptions);
12
13
  protected render(): void;
13
14
  positionList: string[];
15
+ calculateAnchorPoint(position: string, positionBounds?: IAABBBoundsLike): {
16
+ x: number;
17
+ y: number;
18
+ };
14
19
  getAngleAndOffset(position: string, width: number, height: number, size: [number, number], symbolType: 'arrow2Left' | string): {
15
20
  angle: number;
16
21
  offset: [number, number];
@@ -36,7 +36,7 @@ class PopTip extends base_1.AbstractComponent {
36
36
  }
37
37
  render() {
38
38
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const {titleStyle: titleStyle = {}, position: position, contentStyle: contentStyle = {}, panel: panel, logoSymbol: logoSymbol, logoText: logoText, logoTextStyle: logoTextStyle = {}, triangleMode: triangleMode = "default", space: space = 4, minWidth: minWidth = 0, maxWidth: maxWidth = 1 / 0, padding: padding = 4, maxWidthPercent: maxWidthPercent, visible: visible, state: state, dx: dx = 0, dy: dy = 0} = this.attribute;
39
+ const {titleStyle: titleStyle = {}, position: position, contentStyle: contentStyle = {}, panel: panel, logoSymbol: logoSymbol, poptipAnchor: poptipAnchor = "position", logoText: logoText, logoTextStyle: logoTextStyle = {}, triangleMode: triangleMode = "default", space: space = 4, minWidth: minWidth = 0, maxWidth: maxWidth = 1 / 0, padding: padding = 4, maxWidthPercent: maxWidthPercent, visible: visible, state: state, dx: dx = 0, dy: dy = 0, positionBounds: positionBounds} = this.attribute;
40
40
  let {title: title = "", content: content = ""} = this.attribute;
41
41
  title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title,
42
42
  content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
@@ -104,19 +104,26 @@ class PopTip extends base_1.AbstractComponent {
104
104
  poptipHeight += contentShape.AABBBounds.height();
105
105
  }
106
106
  }
107
- const layout = "auto" === position;
107
+ const layout = "auto" === position || (0, vutils_1.isArray)(position), positionList = (0,
108
+ vutils_1.isArray)(position) ? position : this.positionList;
108
109
  let maxBBoxI, maxBBoxSize = -1 / 0;
109
- for (let i = 0; i < this.positionList.length + 1; i++) {
110
- const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position;
110
+ for (let i = 0; i < positionList.length + 1; i++) {
111
+ const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
111
112
  let symbolType = "arrow2Left", offsetX = ((0, vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 4, offsetY = 0;
112
113
  "top" === p || "bottom" === p || "left" === p || "right" === p ? symbolType = "arrow2Left" : "concise" === triangleMode && (symbolType = conciseSymbolMap[p],
113
- offsetX = [ "tl", "bl", "rt", "rb" ].includes(position) ? ((0, vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2 : -((0,
114
- vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2, offsetY = [ "tl", "tr", "lb", "rb" ].includes(position) ? -((0,
114
+ offsetX = [ "tl", "bl", "rt", "rb" ].includes(p) ? ((0, vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2 : -((0,
115
+ vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2, offsetY = [ "tl", "tr", "lb", "rb" ].includes(p) ? -((0,
115
116
  vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2 : ((0, vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2);
116
117
  const {angle: angle, offset: offset} = this.getAngleAndOffset(p, popTipWidth, poptipHeight, (0,
117
118
  vutils_1.isArray)(spaceSize) ? spaceSize : [ spaceSize, spaceSize - lineWidth ], symbolType);
118
- if ((0, vutils_1.isBoolean)(bgVisible)) {
119
- const bgSymbol = group.createOrUpdateChild("poptip-symbol-panel", Object.assign(Object.assign({}, backgroundStyle), {
119
+ let bgSymbol, anchorPoint = {
120
+ x: 0,
121
+ y: 0
122
+ };
123
+ if ("bounds" === poptipAnchor && positionBounds && (anchorPoint = this.calculateAnchorPoint(p, positionBounds)),
124
+ (0, vutils_1.isBoolean)(bgVisible)) {
125
+ let bgRect;
126
+ bgSymbol = group.createOrUpdateChild("poptip-symbol-panel", Object.assign(Object.assign({}, backgroundStyle), {
120
127
  visible: bgVisible && (contentVisible || titleVisible),
121
128
  x: offsetX,
122
129
  y: offsetY,
@@ -129,9 +136,7 @@ class PopTip extends base_1.AbstractComponent {
129
136
  dy: offset[1] - (null !== (_j = backgroundStyle.space) && void 0 !== _j ? _j : 0),
130
137
  size: symbolSize,
131
138
  zIndex: 9
132
- }), "symbol");
133
- let bgRect;
134
- (0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
139
+ }), "symbol"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
135
140
  bgRect = panel.panelSymbolType ? group.createOrUpdateChild("poptip-rect-panel", Object.assign(Object.assign({}, backgroundStyle), {
136
141
  visible: bgVisible && (contentVisible || titleVisible),
137
142
  x: 0,
@@ -149,8 +154,8 @@ class PopTip extends base_1.AbstractComponent {
149
154
  }), "rect"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
150
155
  }
151
156
  if (group.setAttributes({
152
- x: -offset[0] + dx,
153
- y: -offset[1] + dy,
157
+ x: -offset[0] + dx + anchorPoint.x,
158
+ y: -offset[1] + dy + anchorPoint.y,
154
159
  anchor: [ offsetX, offsetY ]
155
160
  }), logoSymbol) {
156
161
  const {size: size = 12} = logoSymbol, sizeArray = (0, vutils_1.isArray)(size) ? size : [ size, size ];
@@ -175,18 +180,82 @@ class PopTip extends base_1.AbstractComponent {
175
180
  zIndex: 10
176
181
  }), "text");
177
182
  }
178
- if (!layout || !range) break;
183
+ if (!range) break;
179
184
  {
180
185
  _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
181
186
  const b = _tBounds, stageBounds = (new vutils_1.Bounds).setValue(0, 0, range[0], range[1]);
182
- if ((0, vutils_1.rectInsideAnotherRect)(b, stageBounds, !1)) break;
183
- {
184
- const bbox = (0, vutils_1.getRectIntersect)(b, stageBounds, !1), size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
185
- size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
187
+ if (layout) {
188
+ if ((0, vutils_1.rectInsideAnotherRect)(b, stageBounds, !1)) break;
189
+ {
190
+ const bbox = (0, vutils_1.getRectIntersect)(b, stageBounds, !1), size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
191
+ size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
192
+ }
186
193
  }
194
+ if ([ "top", "bottom", "left", "right" ].includes(p)) {
195
+ const isVerticalPosition = "top" === p || "bottom" === p, isHorizontalPosition = "left" === p || "right" === p;
196
+ let mainDirectionOverlap = !1;
197
+ if (isVerticalPosition ? mainDirectionOverlap = "top" === p && b.y1 < 0 || "bottom" === p && b.y2 > stageBounds.y2 : isHorizontalPosition && (mainDirectionOverlap = "left" === p && b.x1 < 0 || "right" === p && b.x2 > stageBounds.x2),
198
+ !mainDirectionOverlap) {
199
+ let secondaryOffset = 0;
200
+ const szNumber = ((0, vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2;
201
+ isVerticalPosition ? (b.x1 < 0 ? secondaryOffset = -b.x1 : b.x2 > stageBounds.x2 && (secondaryOffset = stageBounds.x2 - b.x2),
202
+ group.setAttribute("x", group.attribute.x + secondaryOffset), bgSymbol.setAttribute("dx", (0,
203
+ vutils_1.min)((0, vutils_1.max)(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber))) : isHorizontalPosition && (b.y1 < 0 ? secondaryOffset = -b.y1 : b.y2 > stageBounds.y2 && (secondaryOffset = stageBounds.y2 - b.y2),
204
+ group.setAttribute("y", group.attribute.y + secondaryOffset), bgSymbol.setAttribute("dy", (0,
205
+ vutils_1.min)((0, vutils_1.max)(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber)));
206
+ break;
207
+ }
208
+ }
209
+ if (!layout) break;
187
210
  }
188
211
  }
189
212
  }
213
+ calculateAnchorPoint(position, positionBounds) {
214
+ if (!positionBounds) return {
215
+ x: 0,
216
+ y: 0
217
+ };
218
+ const {x: x, y: y} = this.attribute, {x1: x1, y1: y1, x2: x2, y2: y2} = positionBounds, width = x2 - x1, height = y2 - y1;
219
+ switch (position) {
220
+ case "top":
221
+ case "tl":
222
+ case "tr":
223
+ return {
224
+ x: x1 + width / 2 - x,
225
+ y: y1 - y
226
+ };
227
+
228
+ case "bottom":
229
+ case "bl":
230
+ case "br":
231
+ return {
232
+ x: x1 + width / 2 - x,
233
+ y: y2 - y
234
+ };
235
+
236
+ case "left":
237
+ case "lt":
238
+ case "lb":
239
+ return {
240
+ x: x1 - x,
241
+ y: y1 + height / 2 - y
242
+ };
243
+
244
+ case "right":
245
+ case "rt":
246
+ case "rb":
247
+ return {
248
+ x: x2 - x,
249
+ y: y1 + height / 2 - y
250
+ };
251
+
252
+ default:
253
+ return {
254
+ x: 0,
255
+ y: 0
256
+ };
257
+ }
258
+ }
190
259
  getAngleAndOffset(position, width, height, size, symbolType) {
191
260
  const sizeH = "arrow2Left" === symbolType ? size[1] / 2 : size[1];
192
261
  switch (position) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/poptip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAeA,6CAa0B;AAC1B,uCAAiD;AAGjD,yCAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAI,mBAAU,EAAE,CAAC;AAElC,IAAA,8BAAmB,GAAE,CAAC;AAEtB,MAAM,KAAK,GAAG,wCAAwC,CAAC;AACvD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,sCAAsC,CAAC;AAErD,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;CACV,CAAC;AACF,MAAa,MAAO,SAAQ,wBAA6C;IA8BvE,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA9B7F,SAAI,GAAG,QAAQ,CAAC;QAmVhB,iBAAY,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IApTlG,CAAC;IAES,MA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,CAAC,WAAE,CAAC,CAAC,CAAC,CAAC;oBAC3C,MAAM,EAAE,UAAU,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC;iBAClG,CAAC;SACL;IACH,CAAC;;AAjZH,wBAkZC;AA/YQ,wBAAiB,GAA8B;IACpD,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,EAAS;IAChB,eAAe,EAAE,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,EAAE;CACZ,CAAC","file":"poptip.js","sourcesContent":["/**\n * @description PopTip组件\n */\nimport {\n type IGraphic,\n type IGroup,\n type IRect,\n type ISymbol,\n type ISymbolGraphicAttribute,\n type IText,\n type ITextGraphicAttribute,\n type TextAlignType,\n type TextBaselineType\n} from '@visactor/vrender-core';\nimport { InputText } from '@visactor/vrender-animate';\nimport {\n AABBBounds,\n Bounds,\n getRectIntersect,\n isArray,\n isBoolean,\n isEmpty,\n isValid,\n max,\n merge,\n normalizePadding,\n pi,\n rectInsideAnotherRect\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { BackgroundAttributes, ComponentOptions } from '../interface';\nimport type { PopTipAttributes } from './type';\nimport { loadPoptipComponent } from './register';\n\nconst _tBounds = new AABBBounds();\n\nloadPoptipComponent();\n\nconst tlStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z';\nconst blStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z';\nconst trStr = 'M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z';\nconst brStr = 'M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z';\n\nconst conciseSymbolMap = {\n tl: tlStr,\n tr: trStr,\n bl: blStr,\n br: brStr,\n lt: tlStr,\n lb: blStr,\n rt: trStr,\n rb: brStr\n};\nexport class PopTip extends AbstractComponent<Required<PopTipAttributes>> {\n name = 'poptip';\n\n static defaultAttributes: Partial<PopTipAttributes> = {\n position: 'rt',\n visible: true,\n title: null,\n content: null,\n titleStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n contentStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n panel: {} as any,\n maxWidthPercent: 0.8,\n space: 8,\n padding: 10\n };\n\n titleShape?: IText;\n contentShape?: IText;\n group?: IGroup;\n\n constructor(attributes: PopTipAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PopTip.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n titleStyle = {} as ITextGraphicAttribute,\n position,\n contentStyle = {} as ITextGraphicAttribute,\n panel,\n logoSymbol,\n logoText,\n logoTextStyle = {} as ITextGraphicAttribute,\n triangleMode = 'default',\n space = 4,\n minWidth = 0,\n maxWidth = Infinity,\n padding = 4,\n maxWidthPercent,\n visible,\n state,\n dx = 0,\n dy = 0\n } = this.attribute as PopTipAttributes;\n\n let { title = '', content = '' } = this.attribute as PopTipAttributes;\n\n title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;\n content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n this.group = group;\n\n const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];\n\n const titleVisible = isValid(title) && visible !== false;\n const titleAttrs = {\n text: isArray(title) ? title : ([title] as any),\n visible: titleVisible,\n wrap: true,\n ...titleStyle,\n x: parsedPadding[3],\n y: parsedPadding[0],\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text') as IText;\n if (!isEmpty(state?.title)) {\n titleShape.states = state.title;\n }\n\n const titleBounds = titleShape.AABBBounds;\n const titleHeight = titleBounds.height();\n const titleWidth = titleBounds.width();\n let height = titleHeight + space;\n if (!titleVisible) {\n height = 0;\n }\n\n const contentVisible = isValid(content) && visible !== false;\n const contentAttrs = {\n text: isArray(content) ? content : ([content] as any),\n visible: contentVisible,\n wrap: true,\n ...contentStyle,\n x: parsedPadding[3],\n y: parsedPadding[0] + height,\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text') as IText;\n if (!isEmpty(state?.content)) {\n contentShape.states = state.content;\n }\n\n const contentBounds = contentShape.AABBBounds;\n const contentHeight = contentBounds.height();\n const contentWidth = contentBounds.width();\n\n if (contentVisible) {\n height += contentHeight;\n }\n\n this.titleShape = titleShape;\n this.contentShape = contentShape;\n\n // 计算整个popTip的宽高\n let popTipWidth = max(\n titleWidth + parsedPadding[1] + parsedPadding[3],\n contentWidth + parsedPadding[1] + parsedPadding[3]\n );\n if (popTipWidth > maxWidth) {\n popTipWidth = maxWidth;\n } else if (popTipWidth < minWidth) {\n popTipWidth = minWidth;\n }\n let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;\n\n // 绘制背景层\n const { visible: bgVisible, square, ...backgroundStyle } = panel;\n // 如果是正方形,取宽高的最大值,同时文字也需要居中\n if (square) {\n const maxWH = max(popTipWidth, poptipHeight);\n popTipWidth = maxWH;\n const deltaH = maxWH - poptipHeight;\n poptipHeight = maxWH;\n titleShape.setAttributes({ dy: deltaH / 2 });\n contentShape.setAttributes({ dy: deltaH / 2 });\n }\n const symbolSize = backgroundStyle.size ?? 12;\n const spaceSize: number | [number, number] = isArray(symbolSize)\n ? [symbolSize[0] + (backgroundStyle.space ?? 0), symbolSize[1] + (backgroundStyle.space ?? 0)]\n : (symbolSize as number) + (backgroundStyle.space ?? 0);\n const lineWidth = backgroundStyle.lineWidth ?? 1;\n const range: [number, number] | undefined = (this as any).stage\n ? [\n (this as any).stage.viewWidth ?? (this as any).stage.width,\n (this as any).stage.viewHeight ?? (this as any).stage.height\n ]\n : undefined;\n\n if (range) {\n // 尝试进行换行\n const b = (this as any).AABBBounds;\n const leftWidth = this.attribute.x ?? b.x1;\n const rightWidth = range[0] - b.x1;\n let maxSpace = Math.max(leftWidth, rightWidth);\n // 减一些buffer,buffer不能超过maxSpace的20%\n const buf = (isArray(symbolSize) ? symbolSize[0] : 12) + 3;\n maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent);\n // 需要进行换行\n if (maxSpace < popTipWidth) {\n popTipWidth = maxSpace;\n const buf = parsedPadding[1] + parsedPadding[3];\n titleShape.setAttribute('maxLineWidth', maxSpace - buf);\n contentShape.setAttribute('maxLineWidth', maxSpace - buf);\n poptipHeight = parsedPadding[0] + parsedPadding[2];\n if (titleVisible) {\n poptipHeight += titleShape.AABBBounds.height() + space;\n }\n poptipHeight += contentShape.AABBBounds.height();\n }\n }\n\n const layout = position === 'auto';\n // 最多循环this.positionList次\n let maxBBoxI: number;\n let maxBBoxSize: number = -Infinity;\n\n for (let i = 0; i < this.positionList.length + 1; i++) {\n const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position;\n let symbolType = 'arrow2Left';\n let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;\n let offsetY = 0;\n if (p === 'top' || p === 'bottom' || p === 'left' || p === 'right') {\n symbolType = 'arrow2Left';\n } else if (triangleMode === 'concise') {\n symbolType = (conciseSymbolMap as any)[p];\n offsetX = ['tl', 'bl', 'rt', 'rb'].includes(position)\n ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2\n : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;\n offsetY = ['tl', 'tr', 'lb', 'rb'].includes(position)\n ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2\n : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n }\n\n const { angle, offset } = this.getAngleAndOffset(\n p,\n popTipWidth,\n poptipHeight,\n isArray(spaceSize) ? (spaceSize as [number, number]) : [spaceSize, spaceSize - lineWidth],\n symbolType\n );\n if (isBoolean(bgVisible)) {\n const bgSymbol = group.createOrUpdateChild(\n 'poptip-symbol-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: offsetX,\n y: offsetY,\n strokeBoundsBuffer: -1,\n boundsPadding: -2,\n anchor: [0, 0],\n symbolType,\n angle: angle,\n dx: offset[0],\n // 标签和背景同时移动\n dy: offset[1] - (backgroundStyle.space ?? 0),\n size: symbolSize,\n zIndex: 9\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.panel)) {\n bgSymbol.states = state.panel;\n }\n\n let bgRect: IGraphic;\n if (panel.panelSymbolType) {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n symbolType: 'rect',\n size: [popTipWidth, poptipHeight],\n zIndex: -8\n },\n 'symbol'\n ) as ISymbol;\n } else {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n width: popTipWidth,\n height: poptipHeight,\n zIndex: -8\n },\n 'rect'\n ) as IRect;\n }\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n }\n\n group.setAttributes({\n x: -offset[0] + dx,\n y: -offset[1] + dy,\n anchor: [offsetX, offsetY]\n });\n\n // 添加logo和logo内的text\n if (logoSymbol) {\n const { size = 12 } = logoSymbol;\n const sizeArray = isArray(size) ? (size as [number | string, number | string]) : [size, size];\n if (sizeArray[1] === 'auto') {\n sizeArray[1] = poptipHeight;\n }\n if (sizeArray[0] === 'auto') {\n sizeArray[0] = poptipHeight;\n }\n const sizeW = sizeArray[0] as number;\n group.createOrUpdateChild(\n 'poptip-logo',\n {\n ...logoSymbol,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n zIndex: 10,\n size: sizeArray as [number, number]\n },\n 'symbol'\n );\n group.setAttributes({\n x: -offset[0] + dx + sizeW / 2,\n y: -offset[1] + dy\n });\n if (logoText) {\n group.createOrUpdateChild(\n 'poptip-logo-text',\n {\n ...logoTextStyle,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n text: logoText,\n textAlign: 'center',\n textBaseline: 'middle',\n zIndex: 10\n },\n 'text'\n );\n }\n }\n\n if (layout && range) {\n _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);\n const b = _tBounds;\n const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);\n if (rectInsideAnotherRect(b, stageBounds, false)) {\n break;\n } else {\n const bbox = getRectIntersect(b, stageBounds, false);\n const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);\n if (size > maxBBoxSize) {\n maxBBoxSize = size;\n maxBBoxI = i;\n }\n }\n } else {\n break;\n }\n }\n }\n\n positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];\n\n getAngleAndOffset(\n position: string,\n width: number,\n height: number,\n size: [number, number],\n symbolType: 'arrow2Left' | string\n ): { angle: number; offset: [number, number] } {\n // const sizeW = size[0];\n const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];\n switch (position) {\n case 'tl':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, height + sizeH] : [0, height + sizeH]\n };\n case 'top':\n return { angle: (pi / 2) * 3, offset: [width / 2, height + sizeH] };\n case 'tr':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, height + sizeH] : [width, height + sizeH]\n };\n case 'rt':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, height / 5] : [-sizeH, 0]\n };\n case 'right':\n return { angle: 0, offset: [-sizeH, height / 2] };\n case 'rb':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, (height / 5) * 4] : [-sizeH, height]\n };\n case 'bl':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, -sizeH] : [0, -sizeH]\n };\n case 'bottom':\n return { angle: pi / 2, offset: [width / 2, -sizeH] };\n case 'br':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, -sizeH] : [width, -sizeH]\n };\n case 'lt':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, height / 5] : [width + sizeH, 0]\n };\n case 'left':\n return { angle: pi, offset: [width + sizeH, height / 2] };\n case 'lb':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, (height / 5) * 4] : [width + sizeH, height]\n };\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/poptip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAaA,6CAe0B;AAC1B,uCAAiD;AAGjD,yCAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAI,mBAAU,EAAE,CAAC;AAElC,IA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EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC;iBAClG,CAAC;SACL;IACH,CAAC;;AA3fH,wBA4fC;AAzfQ,wBAAiB,GAA8B;IACpD,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,EAAS;IAChB,eAAe,EAAE,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,EAAE;CACZ,CAAC","file":"poptip.js","sourcesContent":["/**\n * @description PopTip组件\n */\nimport {\n type IGraphic,\n type IGroup,\n type IRect,\n type ISymbol,\n type IText,\n type ITextGraphicAttribute,\n type TextAlignType,\n type TextBaselineType\n} from '@visactor/vrender-core';\nimport {\n AABBBounds,\n Bounds,\n getRectIntersect,\n isArray,\n isBoolean,\n isEmpty,\n isValid,\n max,\n merge,\n min,\n normalizePadding,\n pi,\n rectInsideAnotherRect,\n type IAABBBoundsLike\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { ComponentOptions } from '../interface';\nimport type { PopTipAttributes } from './type';\nimport { loadPoptipComponent } from './register';\n\nconst _tBounds = new AABBBounds();\n\nloadPoptipComponent();\n\nconst tlStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z';\nconst blStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z';\nconst trStr = 'M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z';\nconst brStr = 'M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z';\n\nconst conciseSymbolMap = {\n tl: tlStr,\n tr: trStr,\n bl: blStr,\n br: brStr,\n lt: tlStr,\n lb: blStr,\n rt: trStr,\n rb: brStr\n};\nexport class PopTip extends AbstractComponent<Required<PopTipAttributes>> {\n name = 'poptip';\n\n static defaultAttributes: Partial<PopTipAttributes> = {\n position: 'rt',\n visible: true,\n title: null,\n content: null,\n titleStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n contentStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n panel: {} as any,\n maxWidthPercent: 0.8,\n space: 8,\n padding: 10\n };\n\n titleShape?: IText;\n contentShape?: IText;\n group?: IGroup;\n\n constructor(attributes: PopTipAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PopTip.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n titleStyle = {} as ITextGraphicAttribute,\n position,\n contentStyle = {} as ITextGraphicAttribute,\n panel,\n logoSymbol,\n poptipAnchor = 'position',\n logoText,\n logoTextStyle = {} as ITextGraphicAttribute,\n triangleMode = 'default',\n space = 4,\n minWidth = 0,\n maxWidth = Infinity,\n padding = 4,\n maxWidthPercent,\n visible,\n state,\n dx = 0,\n dy = 0,\n positionBounds\n } = this.attribute as PopTipAttributes;\n\n let { title = '', content = '' } = this.attribute as PopTipAttributes;\n\n title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;\n content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n this.group = group;\n\n const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];\n\n const titleVisible = isValid(title) && visible !== false;\n const titleAttrs = {\n text: isArray(title) ? title : ([title] as any),\n visible: titleVisible,\n wrap: true,\n ...titleStyle,\n x: parsedPadding[3],\n y: parsedPadding[0],\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text') as IText;\n if (!isEmpty(state?.title)) {\n titleShape.states = state.title;\n }\n\n const titleBounds = titleShape.AABBBounds;\n const titleHeight = titleBounds.height();\n const titleWidth = titleBounds.width();\n let height = titleHeight + space;\n if (!titleVisible) {\n height = 0;\n }\n\n const contentVisible = isValid(content) && visible !== false;\n const contentAttrs = {\n text: isArray(content) ? content : ([content] as any),\n visible: contentVisible,\n wrap: true,\n ...contentStyle,\n x: parsedPadding[3],\n y: parsedPadding[0] + height,\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text') as IText;\n if (!isEmpty(state?.content)) {\n contentShape.states = state.content;\n }\n\n const contentBounds = contentShape.AABBBounds;\n const contentHeight = contentBounds.height();\n const contentWidth = contentBounds.width();\n\n if (contentVisible) {\n height += contentHeight;\n }\n\n this.titleShape = titleShape;\n this.contentShape = contentShape;\n\n // 计算整个popTip的宽高\n let popTipWidth = max(\n titleWidth + parsedPadding[1] + parsedPadding[3],\n contentWidth + parsedPadding[1] + parsedPadding[3]\n );\n if (popTipWidth > maxWidth) {\n popTipWidth = maxWidth;\n } else if (popTipWidth < minWidth) {\n popTipWidth = minWidth;\n }\n let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;\n\n // 绘制背景层\n const { visible: bgVisible, square, ...backgroundStyle } = panel;\n // 如果是正方形,取宽高的最大值,同时文字也需要居中\n if (square) {\n const maxWH = max(popTipWidth, poptipHeight);\n popTipWidth = maxWH;\n const deltaH = maxWH - poptipHeight;\n poptipHeight = maxWH;\n titleShape.setAttributes({ dy: deltaH / 2 });\n contentShape.setAttributes({ dy: deltaH / 2 });\n }\n const symbolSize = backgroundStyle.size ?? 12;\n const spaceSize: number | [number, number] = isArray(symbolSize)\n ? [symbolSize[0] + (backgroundStyle.space ?? 0), symbolSize[1] + (backgroundStyle.space ?? 0)]\n : (symbolSize as number) + (backgroundStyle.space ?? 0);\n const lineWidth = backgroundStyle.lineWidth ?? 1;\n const range: [number, number] | undefined = (this as any).stage\n ? [\n (this as any).stage.viewWidth ?? (this as any).stage.width,\n (this as any).stage.viewHeight ?? (this as any).stage.height\n ]\n : undefined;\n\n if (range) {\n // 尝试进行换行\n const b = (this as any).AABBBounds;\n const leftWidth = this.attribute.x ?? b.x1;\n const rightWidth = range[0] - b.x1;\n let maxSpace = Math.max(leftWidth, rightWidth);\n // 减一些buffer,buffer不能超过maxSpace的20%\n const buf = (isArray(symbolSize) ? symbolSize[0] : 12) + 3;\n maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent);\n // 需要进行换行\n if (maxSpace < popTipWidth) {\n popTipWidth = maxSpace;\n const buf = parsedPadding[1] + parsedPadding[3];\n titleShape.setAttribute('maxLineWidth', maxSpace - buf);\n contentShape.setAttribute('maxLineWidth', maxSpace - buf);\n poptipHeight = parsedPadding[0] + parsedPadding[2];\n if (titleVisible) {\n poptipHeight += titleShape.AABBBounds.height() + space;\n }\n poptipHeight += contentShape.AABBBounds.height();\n }\n }\n\n const layout = position === 'auto' || isArray(position);\n const positionList = isArray(position) ? position : this.positionList;\n // 最多循环this.positionList次\n let maxBBoxI: number;\n let maxBBoxSize: number = -Infinity;\n\n for (let i = 0; i < positionList.length + 1; i++) {\n const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;\n let symbolType = 'arrow2Left';\n let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;\n let offsetY = 0;\n if (p === 'top' || p === 'bottom' || p === 'left' || p === 'right') {\n symbolType = 'arrow2Left';\n } else if (triangleMode === 'concise') {\n symbolType = (conciseSymbolMap as any)[p];\n offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)\n ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2\n : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;\n offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)\n ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2\n : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n }\n\n const { angle, offset } = this.getAngleAndOffset(\n p,\n popTipWidth,\n poptipHeight,\n isArray(spaceSize) ? (spaceSize as [number, number]) : [spaceSize, spaceSize - lineWidth],\n symbolType\n );\n\n // Calculate anchor point if using bounds\n let anchorPoint = { x: 0, y: 0 };\n if (poptipAnchor === 'bounds' && positionBounds) {\n anchorPoint = this.calculateAnchorPoint(p, positionBounds);\n }\n\n // 后续可能需要偏移,所以需要保存\n let bgSymbol: ISymbol;\n if (isBoolean(bgVisible)) {\n bgSymbol = group.createOrUpdateChild(\n 'poptip-symbol-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: offsetX,\n y: offsetY,\n strokeBoundsBuffer: -1,\n boundsPadding: -2,\n anchor: [0, 0],\n symbolType,\n angle: angle,\n dx: offset[0],\n // 标签和背景同时移动\n dy: offset[1] - (backgroundStyle.space ?? 0),\n size: symbolSize,\n zIndex: 9\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.panel)) {\n bgSymbol.states = state.panel;\n }\n\n let bgRect: IGraphic;\n if (panel.panelSymbolType) {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n symbolType: 'rect',\n size: [popTipWidth, poptipHeight],\n zIndex: -8\n },\n 'symbol'\n ) as ISymbol;\n } else {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n width: popTipWidth,\n height: poptipHeight,\n zIndex: -8\n },\n 'rect'\n ) as IRect;\n }\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n }\n\n group.setAttributes({\n x: -offset[0] + dx + anchorPoint.x,\n y: -offset[1] + dy + anchorPoint.y,\n anchor: [offsetX, offsetY]\n });\n\n // 添加logo和logo内的text\n if (logoSymbol) {\n const { size = 12 } = logoSymbol;\n const sizeArray = isArray(size) ? (size as [number | string, number | string]) : [size, size];\n if (sizeArray[1] === 'auto') {\n sizeArray[1] = poptipHeight;\n }\n if (sizeArray[0] === 'auto') {\n sizeArray[0] = poptipHeight;\n }\n const sizeW = sizeArray[0] as number;\n group.createOrUpdateChild(\n 'poptip-logo',\n {\n ...logoSymbol,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n zIndex: 10,\n size: sizeArray as [number, number]\n },\n 'symbol'\n );\n group.setAttributes({\n x: -offset[0] + dx + sizeW / 2,\n y: -offset[1] + dy\n });\n if (logoText) {\n group.createOrUpdateChild(\n 'poptip-logo-text',\n {\n ...logoTextStyle,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n text: logoText,\n textAlign: 'center',\n textBaseline: 'middle',\n zIndex: 10\n },\n 'text'\n );\n }\n }\n\n if (range) {\n _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);\n const b = _tBounds;\n const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);\n if (layout) {\n if (rectInsideAnotherRect(b, stageBounds, false)) {\n break;\n } else {\n const bbox = getRectIntersect(b, stageBounds, false);\n\n const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);\n if (size > maxBBoxSize) {\n maxBBoxSize = size;\n maxBBoxI = i;\n }\n }\n }\n\n // 检测是否是'top' | 'bottom' | 'left' | 'right',如果是,则需要进行偏移\n // 1. 判断主方向上有没有重叠(top|bottom的话就是垂直方向,left|right的话就是水平方向),如果重叠就无法偏移\n // 2. 找到次方向上的偏移量(top|bottom的话就是水平方向,left|right的话就是垂直方向),然后对group进行偏移即可\n if (['top', 'bottom', 'left', 'right'].includes(p)) {\n const isVerticalPosition = p === 'top' || p === 'bottom';\n const isHorizontalPosition = p === 'left' || p === 'right';\n\n // 判断主方向上有没有偏移\n let mainDirectionOverlap = false;\n if (isVerticalPosition) {\n mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);\n } else if (isHorizontalPosition) {\n mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);\n }\n\n // 如果主方向上没有偏移,则可以尝试在次方向上找到合适的偏移量\n if (!mainDirectionOverlap) {\n let secondaryOffset = 0;\n\n const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n if (isVerticalPosition) {\n // 水平偏移\n if (b.x1 < 0) {\n secondaryOffset = -b.x1;\n } else if (b.x2 > stageBounds.x2) {\n secondaryOffset = stageBounds.x2 - b.x2;\n }\n group.setAttribute('x', group.attribute.x + secondaryOffset);\n bgSymbol.setAttribute(\n 'dx',\n min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber)\n );\n } else if (isHorizontalPosition) {\n // 垂直偏移\n if (b.y1 < 0) {\n secondaryOffset = -b.y1;\n } else if (b.y2 > stageBounds.y2) {\n secondaryOffset = stageBounds.y2 - b.y2;\n }\n\n group.setAttribute('y', group.attribute.y + secondaryOffset);\n bgSymbol.setAttribute(\n 'dy',\n min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber)\n );\n }\n break;\n }\n }\n\n if (!layout) {\n break;\n }\n } else {\n break;\n }\n }\n }\n\n positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];\n\n /**\n * Calculate anchor point based on positionBounds and position\n */\n calculateAnchorPoint(position: string, positionBounds?: IAABBBoundsLike): { x: number; y: number } {\n if (!positionBounds) {\n return { x: 0, y: 0 };\n }\n\n const { x, y } = this.attribute;\n\n const { x1, y1, x2, y2 } = positionBounds;\n const width = x2 - x1;\n const height = y2 - y1;\n\n // Calculate anchor point based on position\n switch (position) {\n case 'top':\n case 'tl':\n case 'tr':\n return { x: x1 + width / 2 - x, y: y1 - y };\n case 'bottom':\n case 'bl':\n case 'br':\n return { x: x1 + width / 2 - x, y: y2 - y };\n case 'left':\n case 'lt':\n case 'lb':\n return { x: x1 - x, y: y1 + height / 2 - y };\n case 'right':\n case 'rt':\n case 'rb':\n return { x: x2 - x, y: y1 + height / 2 - y };\n default:\n return { x: 0, y: 0 };\n }\n }\n\n getAngleAndOffset(\n position: string,\n width: number,\n height: number,\n size: [number, number],\n symbolType: 'arrow2Left' | string\n ): { angle: number; offset: [number, number] } {\n // const sizeW = size[0];\n const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];\n switch (position) {\n case 'tl':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, height + sizeH] : [0, height + sizeH]\n };\n case 'top':\n return { angle: (pi / 2) * 3, offset: [width / 2, height + sizeH] };\n case 'tr':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, height + sizeH] : [width, height + sizeH]\n };\n case 'rt':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, height / 5] : [-sizeH, 0]\n };\n case 'right':\n return { angle: 0, offset: [-sizeH, height / 2] };\n case 'rb':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, (height / 5) * 4] : [-sizeH, height]\n };\n case 'bl':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, -sizeH] : [0, -sizeH]\n };\n case 'bottom':\n return { angle: pi / 2, offset: [width / 2, -sizeH] };\n case 'br':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, -sizeH] : [width, -sizeH]\n };\n case 'lt':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, height / 5] : [width + sizeH, 0]\n };\n case 'left':\n return { angle: pi, offset: [width + sizeH, height / 2] };\n case 'lb':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, (height / 5) * 4] : [width + sizeH, height]\n };\n }\n }\n}\n"]}
@@ -1,13 +1,16 @@
1
1
  import type { IGraphic, IGroupGraphicAttribute, IRectGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
2
2
  import type { Padding, State } from '../core/type';
3
3
  import type { BackgroundAttributes } from '../interface';
4
+ import type { IAABBBoundsLike } from '@visactor/vutils';
4
5
  type StateStyle = {
5
6
  title?: State<Partial<ITextGraphicAttribute>>;
6
7
  content?: State<Partial<ITextGraphicAttribute>>;
7
8
  panel?: State<Partial<IRectGraphicAttribute>>;
8
9
  };
9
10
  export type PopTipAttributes = {
10
- position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';
11
+ position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb' | string[];
12
+ poptipAnchor?: 'position' | 'bounds';
13
+ positionBounds?: IAABBBoundsLike;
11
14
  title?: string | string[] | number | number[];
12
15
  titleStyle?: Partial<ITextGraphicAttribute>;
13
16
  titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /**\n * 标题样式\n */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题的格式化方法\n */\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /**\n * 内容文本样式\n */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容的格式化方法\n */\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n * space: 与位置之间的距离\n * square: 是否是正方形\n */\n panel?: BackgroundAttributes &\n ISymbolGraphicAttribute & { space?: number; square?: boolean; panelSymbolType?: string };\n\n // 标签三角的模式,默认是default,即默认的三角形状,concise是紧凑型三角形状显得更简洁\n // @since 0.22.0\n triangleMode?: 'default' | 'concise';\n\n // 放置在poptip前方的logo区域\n logoSymbol?: ISymbolGraphicAttribute;\n // logo内的text\n logoText?: string | string[] | number | number[];\n // logo内的text样式\n logoTextStyle?: Partial<ITextGraphicAttribute>;\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n /**\n * 最大宽度比例\n */\n maxWidthPercent?: number;\n /**\n * 是否展示\n */\n visible?: boolean;\n /**\n * 自定义的展示逻辑\n */\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
1
+ {"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\nimport type { IAABBBoundsLike } from '@visactor/vutils';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position?:\n | 'auto'\n | 'top'\n | 'tl'\n | 'tr'\n | 'bottom'\n | 'bl'\n | 'br'\n | 'left'\n | 'lt'\n | 'lb'\n | 'right'\n | 'rt'\n | 'rb'\n | string[];\n /**\n * @since 0.22.7\n * 锚点,默认是position,即锚点在position的位置,如果设置为bounds,则锚点会基于bounds进行计算\n */\n poptipAnchor?: 'position' | 'bounds';\n /**\n * @since 0.22.7\n * 布局的包围盒\n * positionBounds 是定位的包围盒,如果配置了的话\n * position为'top' | 'tl' | 'tr': 锚点为positionBounds的上方中间位置\n * position为'bottom' | 'bl' | 'br': 锚点为positionBounds的下方中间位置\n * position为'left' | 'lt' | 'lb': 锚点为positionBounds的左侧中间位置\n * position为'right' | 'rt' | 'rb': 锚点为positionBounds的右侧中间位置\n */\n positionBounds?: IAABBBoundsLike;\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /**\n * 标题样式\n */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题的格式化方法\n */\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /**\n * 内容文本样式\n */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容的格式化方法\n */\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n * space: 与位置之间的距离\n * square: 是否是正方形\n */\n panel?: BackgroundAttributes &\n ISymbolGraphicAttribute & { space?: number; square?: boolean; panelSymbolType?: string };\n\n // 标签三角的模式,默认是default,即默认的三角形状,concise是紧凑型三角形状显得更简洁\n // @since 0.22.0\n triangleMode?: 'default' | 'concise';\n\n // 放置在poptip前方的logo区域\n logoSymbol?: ISymbolGraphicAttribute;\n // logo内的text\n logoText?: string | string[] | number | number[];\n // logo内的text样式\n logoTextStyle?: Partial<ITextGraphicAttribute>;\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n /**\n * 最大宽度比例\n */\n maxWidthPercent?: number;\n /**\n * 是否展示\n */\n visible?: boolean;\n /**\n * 自定义的展示逻辑\n */\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}