@visactor/vrender-components 0.23.0-alpha.2 → 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 (126) 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/arc.js +6 -6
  37. package/cjs/label/arc.js.map +1 -1
  38. package/cjs/label/base.d.ts +6 -5
  39. package/cjs/label/base.js +86 -98
  40. package/cjs/label/base.js.map +1 -1
  41. package/cjs/label/index.js +1 -1
  42. package/cjs/label/line.js +1 -1
  43. package/cjs/label/overlap/scaler.js +3 -3
  44. package/cjs/label/overlap/scaler.js.map +1 -1
  45. package/cjs/label/polygon.js +1 -1
  46. package/cjs/label/register.d.ts +1 -0
  47. package/cjs/label/register.js +8 -4
  48. package/cjs/label/register.js.map +1 -1
  49. package/cjs/label-item/label-item.d.ts +9 -20
  50. package/cjs/label-item/label-item.js +1 -103
  51. package/cjs/label-item/label-item.js.map +1 -1
  52. package/cjs/poptip/contribution.js +4 -2
  53. package/cjs/poptip/contribution.js.map +1 -1
  54. package/cjs/poptip/poptip.d.ts +5 -9
  55. package/cjs/poptip/poptip.js +88 -55
  56. package/cjs/poptip/poptip.js.map +1 -1
  57. package/cjs/poptip/type.d.ts +4 -1
  58. package/cjs/poptip/type.js.map +1 -1
  59. package/cjs/tag/tag.js +60 -56
  60. package/cjs/tag/tag.js.map +1 -1
  61. package/cjs/weather/weather-box.d.ts +1 -2
  62. package/cjs/weather/weather-box.js.map +1 -1
  63. package/dist/index.es.js +3036 -2743
  64. package/es/animation/animate-component.d.ts +22 -0
  65. package/es/animation/animate-component.js +21 -0
  66. package/es/animation/animate-component.js.map +1 -0
  67. package/es/animation/axis-animate.d.ts +10 -0
  68. package/es/animation/axis-animate.js +60 -0
  69. package/es/animation/axis-animate.js.map +1 -0
  70. package/es/animation/label-animate.d.ts +10 -0
  71. package/es/animation/label-animate.js +69 -0
  72. package/es/animation/label-animate.js.map +1 -0
  73. package/es/axis/animate/config.d.ts +6 -0
  74. package/es/axis/animate/config.js +6 -0
  75. package/es/axis/animate/config.js.map +1 -0
  76. package/es/axis/animate/group-transition.d.ts +2 -1
  77. package/es/axis/animate/group-transition.js +3 -1
  78. package/es/axis/animate/group-transition.js.map +1 -1
  79. package/es/axis/base.d.ts +7 -2
  80. package/es/axis/base.js +75 -9
  81. package/es/axis/base.js.map +1 -1
  82. package/es/axis/line.js.map +1 -1
  83. package/es/axis/register.js +3 -1
  84. package/es/axis/register.js.map +1 -1
  85. package/es/axis/type.d.ts +4 -0
  86. package/es/axis/type.js.map +1 -1
  87. package/es/brush/config.js +1 -2
  88. package/es/brush/type.js +2 -1
  89. package/es/crosshair/rect.js +1 -2
  90. package/es/crosshair/type.js +2 -1
  91. package/es/index.d.ts +1 -1
  92. package/es/index.js +1 -1
  93. package/es/index.js.map +1 -1
  94. package/es/indicator/register.js +1 -2
  95. package/es/jsx/index.js +2 -1
  96. package/es/label/animate/animate.d.ts +1 -12
  97. package/es/label/animate/animate.js +0 -76
  98. package/es/label/animate/animate.js.map +1 -1
  99. package/es/label/arc.js +6 -6
  100. package/es/label/arc.js.map +1 -1
  101. package/es/label/base.d.ts +6 -5
  102. package/es/label/base.js +90 -99
  103. package/es/label/base.js.map +1 -1
  104. package/es/label/index.js +1 -1
  105. package/es/label/line.js +1 -1
  106. package/es/label/overlap/scaler.js +1 -1
  107. package/es/label/overlap/scaler.js.map +1 -1
  108. package/es/label/polygon.js +1 -1
  109. package/es/label/register.d.ts +1 -0
  110. package/es/label/register.js +7 -1
  111. package/es/label/register.js.map +1 -1
  112. package/es/label-item/label-item.d.ts +9 -20
  113. package/es/label-item/label-item.js +0 -104
  114. package/es/label-item/label-item.js.map +1 -1
  115. package/es/poptip/contribution.js +4 -2
  116. package/es/poptip/contribution.js.map +1 -1
  117. package/es/poptip/poptip.d.ts +5 -9
  118. package/es/poptip/poptip.js +85 -57
  119. package/es/poptip/poptip.js.map +1 -1
  120. package/es/poptip/type.d.ts +4 -1
  121. package/es/poptip/type.js.map +1 -1
  122. package/es/tag/tag.js +59 -56
  123. package/es/tag/tag.js.map +1 -1
  124. package/es/weather/weather-box.d.ts +1 -2
  125. package/es/weather/weather-box.js.map +1 -1
  126. package/package.json +7 -7
@@ -15,7 +15,7 @@ export function bitmapTool(width, height, padding = {
15
15
  }
16
16
 
17
17
  export function clampRangeByBitmap($, range) {
18
- const {x1: x1, x2: x2, y1: y1, y2: y2} = range, _x1 = clampRange(x1, 0, $.width), _x2 = clampRange(x2, 0, $.width), _y1 = clampRange(y1, 0, $.height), _y2 = clampRange(y2, 0, $.height);
18
+ const {x1: x1, x2: x2, y1: y1, y2: y2} = range, {top: top = 0, left: left = 0, right: right = 0, bottom: bottom = 0} = $.padding, _x1 = clampRange(x1, -left, $.width + right), _x2 = clampRange(x2, -left, $.width + right), _y1 = clampRange(y1, -top, $.height + bottom), _y2 = clampRange(y2, -top, $.height + bottom);
19
19
  return {
20
20
  x1: $.x(_x1),
21
21
  x2: $.x(_x2),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/overlap/scaler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiClC,MAAM,UAAU,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,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AAG,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;AAED,MAAM,UAAU,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","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,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiClC,MAAM,UAAU,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,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,KAAK,CAAC,CA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,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;AAED,MAAM,UAAU,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","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"]}
@@ -36,4 +36,4 @@ PolygonLabel.defaultAttributes = {
36
36
  position: "center",
37
37
  offset: 6
38
38
  };
39
- //# sourceMappingURL=polygon.js.map
39
+ //# sourceMappingURL=polygon.js.map
@@ -1 +1,2 @@
1
1
  export declare function loadLabelComponent(): void;
2
+ export declare function loadLabelAnimate(): void;
@@ -1,6 +1,12 @@
1
1
  import { registerGroup, registerLine, registerRichtext, registerText } from "@visactor/vrender-kits";
2
2
 
3
+ import { registerLabelAnimate } from "../animation/label-animate";
4
+
3
5
  export function loadLabelComponent() {
4
- registerGroup(), registerText(), registerRichtext(), registerLine();
6
+ registerGroup(), registerText(), registerRichtext(), registerLine(), registerLabelAnimate();
7
+ }
8
+
9
+ export function loadLabelAnimate() {
10
+ registerLabelAnimate();
5
11
  }
6
12
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAErG,MAAM,UAAU,kBAAkB;IAChC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,CAAC;AACjB,CAAC","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,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,UAAU,kBAAkB;IAChC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,oBAAoB,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,oBAAoB,EAAE,CAAC;AACzB,CAAC","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"]}
@@ -1,29 +1,18 @@
1
+ import type { ILine, IRect, ISymbol, IText } from '@visactor/vrender-core';
1
2
  import { AbstractComponent } from '../core/base';
2
3
  import type { IStoryLabelItemAttrs } from './type';
3
4
  import type { ComponentOptions } from '../interface';
4
5
  export declare class StoryLabelItem extends AbstractComponent<Required<IStoryLabelItemAttrs>> {
5
6
  name: 'labelItem';
6
- private _line?;
7
- private _symbolStart;
8
- private _symbolEnd;
9
- private _symbolStartOuter;
10
- private _titleTop;
11
- private _titleBottom;
12
- private _titleTopPanel;
13
- private _titleBottomPanel;
7
+ _line?: ILine;
8
+ _symbolStart: ISymbol;
9
+ _symbolEnd: ISymbol;
10
+ _symbolStartOuter: ISymbol;
11
+ _titleTop: IText;
12
+ _titleBottom: IText;
13
+ _titleTopPanel: IRect;
14
+ _titleBottomPanel: IRect;
14
15
  static defaultAttributes: Partial<IStoryLabelItemAttrs>;
15
16
  constructor(attributes: IStoryLabelItemAttrs, options?: ComponentOptions);
16
17
  protected render(): void;
17
- appearAnimate(animateConfig: {
18
- duration?: number;
19
- easing?: string;
20
- symbolStartOuterType?: 'scale' | 'clipRange';
21
- titleType?: 'typewriter' | 'move';
22
- titlePanelType?: 'scale' | 'stroke';
23
- }): void;
24
- disappearAnimate(animateConfig: {
25
- duration?: number;
26
- easing?: string;
27
- mode?: 'scale' | 'default';
28
- }): void;
29
18
  }
@@ -1,5 +1,3 @@
1
- import { InputText } from "@visactor/vrender-animate";
2
-
3
1
  import { AbstractComponent } from "../core/base";
4
2
 
5
3
  import { merge } from "@visactor/vutils";
@@ -103,108 +101,6 @@ export class StoryLabelItem extends AbstractComponent {
103
101
  this._symbolEnd = symbolEnd, this._symbolStart = symbolStart, this._symbolStartOuter = symbolStartOut,
104
102
  this._titleTop = titleTop, this._titleBottom = titleBottom, this._line = line;
105
103
  }
106
- appearAnimate(animateConfig) {
107
- const {duration: duration = 1e3, easing: easing = "quadOut", symbolStartOuterType: symbolStartOuterType = "scale", titleType: titleType = "typewriter", titlePanelType: titlePanelType = "scale"} = animateConfig, symbolTime = duration / 10;
108
- let symbolStartOuterFrom, symbolStartOuterTo;
109
- if (this._symbolStart.setAttributes({
110
- scaleX: 0,
111
- scaleY: 0
112
- }), this._symbolStart.animate().to({
113
- scaleX: 1,
114
- scaleY: 1
115
- }, 5 * symbolTime, easing), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
116
- scaleX: 0,
117
- scaleY: 0
118
- }, symbolStartOuterTo = {
119
- scaleX: 1,
120
- scaleY: 1
121
- }) : (symbolStartOuterFrom = {
122
- clipRange: 0
123
- }, symbolStartOuterTo = {
124
- clipRange: 1
125
- }), this._symbolStartOuter.setAttributes(symbolStartOuterFrom), this._symbolStartOuter.animate().to(symbolStartOuterTo, 5 * symbolTime, easing),
126
- this._symbolEnd.setAttributes({
127
- scaleX: 0,
128
- scaleY: 0
129
- }), this._symbolEnd.animate().wait(8 * symbolTime).to({
130
- scaleX: 1,
131
- scaleY: 1
132
- }, 2 * symbolTime, easing), this._line.setAttributes({
133
- clipRange: 0
134
- }), this._line.animate().to({
135
- clipRange: 1
136
- }, 9 * symbolTime, easing), "typewriter" === titleType) {
137
- const titleTopText = this._titleTop.attribute.text;
138
- this._titleTop.setAttributes({
139
- text: ""
140
- }), this._titleTop.animate().wait(5 * symbolTime).play(new InputText({
141
- text: ""
142
- }, {
143
- text: titleTopText
144
- }, 4 * symbolTime, "linear"));
145
- const titleBottomText = this._titleBottom.attribute.text;
146
- this._titleBottom.setAttributes({
147
- text: ""
148
- }), this._titleBottom.animate().wait(5 * symbolTime).play(new InputText({
149
- text: ""
150
- }, {
151
- text: titleBottomText
152
- }, 4 * symbolTime, "linear"));
153
- } else this._titleTop.setAttributes({
154
- dy: this._titleTop.AABBBounds.height() + 10
155
- }), this._titleTop.animate().wait(5 * symbolTime).to({
156
- dy: 0
157
- }, 4 * symbolTime, "linear"), this._titleBottom.setAttributes({
158
- dy: -(10 + this._titleBottom.AABBBounds.height())
159
- }), this._titleBottom.animate().wait(5 * symbolTime).to({
160
- dy: 0
161
- }, 4 * symbolTime, "linear");
162
- "scale" === titlePanelType ? [ this._titleTopPanel, this._titleBottomPanel ].forEach((panel => {
163
- const scaleX = panel.attribute.scaleX;
164
- panel.setAttributes({
165
- scaleX: 0
166
- }), panel.animate().to({
167
- scaleX: scaleX
168
- }, duration, "circInOut");
169
- })) : "stroke" === titlePanelType && [ this._titleTopPanel, this._titleBottomPanel ].forEach((panel => {
170
- const b = panel.AABBBounds, totalLen = 2 * (b.width() + b.height());
171
- panel.setAttributes({
172
- lineDash: [ 0, 10 * totalLen ]
173
- }), panel.animate().to({
174
- lineDash: [ totalLen, 10 * totalLen ]
175
- }, duration, "quadOut");
176
- }));
177
- }
178
- disappearAnimate(animateConfig) {
179
- if ("scale" === animateConfig.mode) {
180
- const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
181
- this.animate().to({
182
- scaleX: 0,
183
- scaleY: 0
184
- }, duration, easing);
185
- } else {
186
- const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
187
- this._line.animate().to({
188
- clipRange: 0
189
- }, duration, easing), this._symbolStart.animate().wait(duration / 2).to({
190
- scaleX: 0,
191
- scaleY: 0
192
- }, duration / 2, easing), this._symbolEnd.animate().to({
193
- scaleX: 0,
194
- scaleY: 0
195
- }, duration, easing), this._titleTop.animate().to({
196
- dy: this._titleTop.AABBBounds.height() + 10
197
- }, duration / 2, easing), this._titleBottom.animate().to({
198
- dy: -(10 + this._titleBottom.AABBBounds.height())
199
- }, duration / 2, easing), this._symbolStartOuter.animate().wait(duration / 2).to({
200
- clipRange: 0
201
- }, duration / 2, easing), this._titleTopPanel.animate().to({
202
- scaleX: 0
203
- }, duration, "circInOut"), this._titleBottomPanel.animate().to({
204
- scaleX: 0
205
- }, duration, "circInOut");
206
- }
207
- }
208
104
  }
209
105
 
210
106
  StoryLabelItem.defaultAttributes = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label-item/label-item.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,cAAe,SAAQ,iBAAiD;IA6DnF,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,cAAc,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IACrG,CAAC;IAES,MAAM;QACd,MAAM,EACJ,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,eAAe,EAC5B,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,EACN,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,MAAM,KA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AAQ,EAAE,WAAW,CAAC,CAAC;SAC3E;IACH,CAAC;;AA1TM,gCAAiB,GAAkC;IAExD,cAAc,EAAE,GAAG;IAEnB,cAAc,EAAE,CAAC,EAAE;IACnB,aAAa,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,OAAO;KACd;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,OAAO;KACd;IACD,SAAS,EAAE;QACT,MAAM,EAAE,OAAO;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 { 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 private _line?: ILine;\n private _symbolStart: ISymbol;\n private _symbolEnd: ISymbol;\n private _symbolStartOuter: ISymbol;\n private _titleTop: IText;\n private _titleBottom: IText;\n private _titleTopPanel: IRect;\n private _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 appearAnimate(animateConfig: {\n duration?: number;\n easing?: string;\n symbolStartOuterType?: 'scale' | 'clipRange';\n titleType?: 'typewriter' | 'move';\n titlePanelType?: 'scale' | 'stroke';\n }) {\n const {\n duration = 1000,\n easing = 'quadOut',\n symbolStartOuterType = 'scale',\n titleType = 'typewriter',\n titlePanelType = 'scale'\n } = animateConfig;\n const symbolTime = duration / 10;\n this._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });\n this._symbolStart.animate().to({ scaleX: 1, scaleY: 1 }, symbolTime * 5, easing as any);\n\n let symbolStartOuterFrom: ISymbolGraphicAttribute;\n let symbolStartOuterTo: ISymbolGraphicAttribute;\n if (symbolStartOuterType === 'scale') {\n symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };\n symbolStartOuterTo = { scaleX: 1, scaleY: 1 };\n } else {\n symbolStartOuterFrom = { clipRange: 0 };\n symbolStartOuterTo = { clipRange: 1 };\n }\n this._symbolStartOuter.setAttributes(symbolStartOuterFrom);\n this._symbolStartOuter.animate().to(symbolStartOuterTo, symbolTime * 5, easing as any);\n\n this._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });\n this._symbolEnd\n .animate()\n .wait(symbolTime * 8)\n .to({ scaleX: 1, scaleY: 1 }, symbolTime * 2, easing as any);\n\n this._line.setAttributes({ clipRange: 0 });\n this._line.animate().to({ clipRange: 1 }, symbolTime * 9, easing as any);\n\n if (titleType === 'typewriter') {\n const titleTopText = this._titleTop.attribute.text as string;\n this._titleTop.setAttributes({ text: '' });\n this._titleTop\n .animate()\n .wait(symbolTime * 5)\n .play(new InputText({ text: '' }, { text: titleTopText }, symbolTime * 4, 'linear') as any);\n\n const titleBottomText = this._titleBottom.attribute.text as string;\n this._titleBottom.setAttributes({ text: '' });\n this._titleBottom\n .animate()\n .wait(symbolTime * 5)\n .play(new InputText({ text: '' }, { text: titleBottomText }, symbolTime * 4, 'linear') as any);\n } else {\n this._titleTop.setAttributes({ dy: this._titleTop.AABBBounds.height() + 10 });\n this._titleTop\n .animate()\n .wait(symbolTime * 5)\n .to({ dy: 0 }, symbolTime * 4, 'linear');\n\n this._titleBottom.setAttributes({ dy: -(10 + this._titleBottom.AABBBounds.height()) });\n this._titleBottom\n .animate()\n .wait(symbolTime * 5)\n .to({ dy: 0 }, symbolTime * 4, 'linear');\n }\n\n if (titlePanelType === 'scale') {\n [this._titleTopPanel, this._titleBottomPanel].forEach(panel => {\n const scaleX = panel.attribute.scaleX;\n panel.setAttributes({ scaleX: 0 });\n panel.animate().to({ scaleX }, duration, 'circInOut');\n });\n } else if (titlePanelType === 'stroke') {\n [this._titleTopPanel, this._titleBottomPanel].forEach(panel => {\n const b = panel.AABBBounds;\n const totalLen = (b.width() + b.height()) * 2;\n panel.setAttributes({ lineDash: [0, totalLen * 10] });\n panel.animate().to({ lineDash: [totalLen, totalLen * 10] }, duration, 'quadOut');\n });\n }\n }\n\n disappearAnimate(animateConfig: { duration?: number; easing?: string; mode?: 'scale' | 'default' }) {\n if (animateConfig.mode === 'scale') {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n } else {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this._line.animate().to({ clipRange: 0 }, duration, easing as any);\n this._symbolStart\n .animate()\n .wait(duration / 2)\n .to({ scaleX: 0, scaleY: 0 }, duration / 2, easing as any);\n this._symbolEnd.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n this._titleTop.animate().to({ dy: this._titleTop.AABBBounds.height() + 10 }, duration / 2, easing as any);\n this._titleBottom\n .animate()\n .to({ dy: -(10 + this._titleBottom.AABBBounds.height()) }, duration / 2, easing as any);\n this._symbolStartOuter\n .animate()\n .wait(duration / 2)\n .to({ clipRange: 0 }, duration / 2, easing as any);\n this._titleTopPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');\n this._titleBottomPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/label-item/label-item.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,cAAe,SAAQ,iBAAiD;IA6DnF,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,cAAc,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IACrG,CAAC;IAES,MAAM;QACd,MAAM,EACJ,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,eAAe,EAC5B,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,EACN,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,EAAE,CAAC,E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jD,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"]}
@@ -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,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAA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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,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,MAAM,IAAI,EAAE,CAAC;YACvE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,EAAE;gBACpE,OAAO;aACR;YACD,MAAM,SAAS,GAAG,EAAE,CAAC;YACrB,KAAK,CACH,SAAS,EACT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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;AAtEY,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CAsEpC;SAtEY,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 // 默认使用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,17 +12,12 @@ 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];
17
22
  };
18
- appearAnimate(animateConfig: {
19
- duration?: number;
20
- easing?: string;
21
- wave?: number;
22
- }): void;
23
- disappearAnimate(animateConfig: {
24
- duration?: number;
25
- easing?: string;
26
- }): void;
27
23
  }
@@ -8,9 +8,7 @@ var __rest = this && this.__rest || function(s, e) {
8
8
  return t;
9
9
  };
10
10
 
11
- import { InputText } from "@visactor/vrender-animate";
12
-
13
- import { AABBBounds, Bounds, getRectIntersect, isArray, isBoolean, isEmpty, isValid, max, merge, normalizePadding, pi, rectInsideAnotherRect } from "@visactor/vutils";
11
+ import { AABBBounds, Bounds, getRectIntersect, isArray, isBoolean, isEmpty, isValid, max, merge, min, normalizePadding, pi, rectInsideAnotherRect } from "@visactor/vutils";
14
12
 
15
13
  import { AbstractComponent } from "../core/base";
16
14
 
@@ -38,7 +36,7 @@ export class PopTip extends AbstractComponent {
38
36
  }
39
37
  render() {
40
38
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
- 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;
42
40
  let {title: title = "", content: content = ""} = this.attribute;
43
41
  title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title,
44
42
  content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
@@ -104,17 +102,23 @@ export class PopTip extends AbstractComponent {
104
102
  poptipHeight += contentShape.AABBBounds.height();
105
103
  }
106
104
  }
107
- const layout = "auto" === position;
105
+ const layout = "auto" === position || isArray(position), positionList = isArray(position) ? position : this.positionList;
108
106
  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;
107
+ for (let i = 0; i < positionList.length + 1; i++) {
108
+ const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
111
109
  let symbolType = "arrow2Left", offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4, offsetY = 0;
112
110
  "top" === p || "bottom" === p || "left" === p || "right" === p ? symbolType = "arrow2Left" : "concise" === triangleMode && (symbolType = conciseSymbolMap[p],
113
- offsetX = [ "tl", "bl", "rt", "rb" ].includes(position) ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2 : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2,
114
- offsetY = [ "tl", "tr", "lb", "rb" ].includes(position) ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2 : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2);
111
+ offsetX = [ "tl", "bl", "rt", "rb" ].includes(p) ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2 : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2,
112
+ offsetY = [ "tl", "tr", "lb", "rb" ].includes(p) ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2 : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2);
115
113
  const {angle: angle, offset: offset} = this.getAngleAndOffset(p, popTipWidth, poptipHeight, isArray(spaceSize) ? spaceSize : [ spaceSize, spaceSize - lineWidth ], symbolType);
116
- if (isBoolean(bgVisible)) {
117
- const bgSymbol = group.createOrUpdateChild("poptip-symbol-panel", Object.assign(Object.assign({}, backgroundStyle), {
114
+ let bgSymbol, anchorPoint = {
115
+ x: 0,
116
+ y: 0
117
+ };
118
+ if ("bounds" === poptipAnchor && positionBounds && (anchorPoint = this.calculateAnchorPoint(p, positionBounds)),
119
+ isBoolean(bgVisible)) {
120
+ let bgRect;
121
+ bgSymbol = group.createOrUpdateChild("poptip-symbol-panel", Object.assign(Object.assign({}, backgroundStyle), {
118
122
  visible: bgVisible && (contentVisible || titleVisible),
119
123
  x: offsetX,
120
124
  y: offsetY,
@@ -127,9 +131,7 @@ export class PopTip extends AbstractComponent {
127
131
  dy: offset[1] - (null !== (_j = backgroundStyle.space) && void 0 !== _j ? _j : 0),
128
132
  size: symbolSize,
129
133
  zIndex: 9
130
- }), "symbol");
131
- let bgRect;
132
- isEmpty(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
134
+ }), "symbol"), isEmpty(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
133
135
  bgRect = panel.panelSymbolType ? group.createOrUpdateChild("poptip-rect-panel", Object.assign(Object.assign({}, backgroundStyle), {
134
136
  visible: bgVisible && (contentVisible || titleVisible),
135
137
  x: 0,
@@ -147,8 +149,8 @@ export class PopTip extends AbstractComponent {
147
149
  }), "rect"), isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
148
150
  }
149
151
  if (group.setAttributes({
150
- x: -offset[0] + dx,
151
- y: -offset[1] + dy,
152
+ x: -offset[0] + dx + anchorPoint.x,
153
+ y: -offset[1] + dy + anchorPoint.y,
152
154
  anchor: [ offsetX, offsetY ]
153
155
  }), logoSymbol) {
154
156
  const {size: size = 12} = logoSymbol, sizeArray = isArray(size) ? size : [ size, size ];
@@ -173,18 +175,80 @@ export class PopTip extends AbstractComponent {
173
175
  zIndex: 10
174
176
  }), "text");
175
177
  }
176
- if (!layout || !range) break;
178
+ if (!range) break;
177
179
  {
178
180
  _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
179
181
  const b = _tBounds, stageBounds = (new Bounds).setValue(0, 0, range[0], range[1]);
180
- if (rectInsideAnotherRect(b, stageBounds, !1)) break;
181
- {
182
- const bbox = getRectIntersect(b, stageBounds, !1), size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
183
- size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
182
+ if (layout) {
183
+ if (rectInsideAnotherRect(b, stageBounds, !1)) break;
184
+ {
185
+ const bbox = getRectIntersect(b, stageBounds, !1), size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
186
+ size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
187
+ }
188
+ }
189
+ if ([ "top", "bottom", "left", "right" ].includes(p)) {
190
+ const isVerticalPosition = "top" === p || "bottom" === p, isHorizontalPosition = "left" === p || "right" === p;
191
+ let mainDirectionOverlap = !1;
192
+ 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),
193
+ !mainDirectionOverlap) {
194
+ let secondaryOffset = 0;
195
+ const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
196
+ isVerticalPosition ? (b.x1 < 0 ? secondaryOffset = -b.x1 : b.x2 > stageBounds.x2 && (secondaryOffset = stageBounds.x2 - b.x2),
197
+ group.setAttribute("x", group.attribute.x + secondaryOffset), bgSymbol.setAttribute("dx", min(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),
198
+ group.setAttribute("y", group.attribute.y + secondaryOffset), bgSymbol.setAttribute("dy", min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber)));
199
+ break;
200
+ }
184
201
  }
202
+ if (!layout) break;
185
203
  }
186
204
  }
187
205
  }
206
+ calculateAnchorPoint(position, positionBounds) {
207
+ if (!positionBounds) return {
208
+ x: 0,
209
+ y: 0
210
+ };
211
+ const {x: x, y: y} = this.attribute, {x1: x1, y1: y1, x2: x2, y2: y2} = positionBounds, width = x2 - x1, height = y2 - y1;
212
+ switch (position) {
213
+ case "top":
214
+ case "tl":
215
+ case "tr":
216
+ return {
217
+ x: x1 + width / 2 - x,
218
+ y: y1 - y
219
+ };
220
+
221
+ case "bottom":
222
+ case "bl":
223
+ case "br":
224
+ return {
225
+ x: x1 + width / 2 - x,
226
+ y: y2 - y
227
+ };
228
+
229
+ case "left":
230
+ case "lt":
231
+ case "lb":
232
+ return {
233
+ x: x1 - x,
234
+ y: y1 + height / 2 - y
235
+ };
236
+
237
+ case "right":
238
+ case "rt":
239
+ case "rb":
240
+ return {
241
+ x: x2 - x,
242
+ y: y1 + height / 2 - y
243
+ };
244
+
245
+ default:
246
+ return {
247
+ x: 0,
248
+ y: 0
249
+ };
250
+ }
251
+ }
188
252
  getAngleAndOffset(position, width, height, size, symbolType) {
189
253
  const sizeH = "arrow2Left" === symbolType ? size[1] / 2 : size[1];
190
254
  switch (position) {
@@ -261,42 +325,6 @@ export class PopTip extends AbstractComponent {
261
325
  };
262
326
  }
263
327
  }
264
- appearAnimate(animateConfig) {
265
- const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
266
- if (this.setAttributes({
267
- scaleX: 0,
268
- scaleY: 0
269
- }), this.animate().to({
270
- scaleX: 1,
271
- scaleY: 1
272
- }, duration / 3 * 2, easing), this.titleShape && this.titleShape.animate().play(new InputText({
273
- text: ""
274
- }, {
275
- text: this.titleShape.attribute.text
276
- }, duration, easing)), this.contentShape && this.contentShape.animate().play(new InputText({
277
- text: ""
278
- }, {
279
- text: this.contentShape.attribute.text
280
- }, duration, easing)), animateConfig.wave) {
281
- const dur = duration / 6;
282
- this.group.animate().to({
283
- angle: animateConfig.wave
284
- }, dur, easing).to({
285
- angle: -animateConfig.wave
286
- }, 2 * dur, easing).to({
287
- angle: animateConfig.wave
288
- }, 2 * dur, easing).to({
289
- angle: 0
290
- }, dur, easing);
291
- }
292
- }
293
- disappearAnimate(animateConfig) {
294
- const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
295
- this.animate().to({
296
- scaleX: 0,
297
- scaleY: 0
298
- }, duration, easing);
299
- }
300
328
  }
301
329
 
302
330
  PopTip.defaultAttributes = {