@visactor/vrender-components 0.15.0-alpha.5 → 0.15.0

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 (381) hide show
  1. package/cjs/axis/animate/group-fade.js.map +1 -1
  2. package/cjs/axis/animate/group-transition.js.map +1 -1
  3. package/cjs/axis/animate/index.js.map +1 -1
  4. package/cjs/axis/base.js.map +1 -1
  5. package/cjs/axis/circle.js.map +1 -1
  6. package/cjs/axis/config.js.map +1 -1
  7. package/cjs/axis/constant.js.map +1 -1
  8. package/cjs/axis/grid/base.js.map +1 -1
  9. package/cjs/axis/grid/circle.js.map +1 -1
  10. package/cjs/axis/grid/index.js.map +1 -1
  11. package/cjs/axis/grid/line.js.map +1 -1
  12. package/cjs/axis/grid/type.js.map +1 -1
  13. package/cjs/axis/index.js.map +1 -1
  14. package/cjs/axis/line.js +50 -1
  15. package/cjs/axis/line.js.map +1 -1
  16. package/cjs/axis/mixin/circle.js.map +1 -1
  17. package/cjs/axis/mixin/line.js.map +1 -1
  18. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  19. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  20. package/cjs/axis/overlap/auto-rotate.js +2 -2
  21. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  22. package/cjs/axis/type.d.ts +1 -0
  23. package/cjs/axis/type.js.map +1 -1
  24. package/cjs/brush/brush.d.ts +1 -0
  25. package/cjs/brush/brush.js +5 -0
  26. package/cjs/brush/brush.js.map +1 -1
  27. package/cjs/brush/config.js.map +1 -1
  28. package/cjs/brush/index.js.map +1 -1
  29. package/cjs/brush/type.js.map +1 -1
  30. package/cjs/constant.js.map +1 -1
  31. package/cjs/core/base.d.ts +2 -1
  32. package/cjs/core/base.js +4 -2
  33. package/cjs/core/base.js.map +1 -1
  34. package/cjs/core/type.js.map +1 -1
  35. package/cjs/crosshair/base.js.map +1 -1
  36. package/cjs/crosshair/circle.js.map +1 -1
  37. package/cjs/crosshair/index.js.map +1 -1
  38. package/cjs/crosshair/line.js.map +1 -1
  39. package/cjs/crosshair/polygon.js.map +1 -1
  40. package/cjs/crosshair/rect.js.map +1 -1
  41. package/cjs/crosshair/sector.js.map +1 -1
  42. package/cjs/crosshair/type.js.map +1 -1
  43. package/cjs/data-zoom/config.js.map +1 -1
  44. package/cjs/data-zoom/data-zoom.js.map +1 -1
  45. package/cjs/data-zoom/index.js.map +1 -1
  46. package/cjs/data-zoom/type.js.map +1 -1
  47. package/cjs/index.d.ts +1 -1
  48. package/cjs/index.js +1 -1
  49. package/cjs/index.js.map +1 -1
  50. package/cjs/indicator/config.js.map +1 -1
  51. package/cjs/indicator/index.js.map +1 -1
  52. package/cjs/indicator/indicator.js.map +1 -1
  53. package/cjs/indicator/type.js.map +1 -1
  54. package/cjs/interface.js.map +1 -1
  55. package/cjs/jsx/component-type.js.map +1 -1
  56. package/cjs/jsx/index.js.map +1 -1
  57. package/cjs/label/animate/animate.js.map +1 -1
  58. package/cjs/label/animate/index.js.map +1 -1
  59. package/cjs/label/arc.d.ts +7 -3
  60. package/cjs/label/arc.js +66 -10
  61. package/cjs/label/arc.js.map +1 -1
  62. package/cjs/label/base.d.ts +12 -9
  63. package/cjs/label/base.js +123 -137
  64. package/cjs/label/base.js.map +1 -1
  65. package/cjs/label/dataLabel.js +4 -4
  66. package/cjs/label/dataLabel.js.map +1 -1
  67. package/cjs/label/index.js.map +1 -1
  68. package/cjs/label/line.js.map +1 -1
  69. package/cjs/label/overlap/bitmap.js.map +1 -1
  70. package/cjs/label/overlap/index.js.map +1 -1
  71. package/cjs/label/overlap/place.d.ts +2 -2
  72. package/cjs/label/overlap/place.js +15 -8
  73. package/cjs/label/overlap/place.js.map +1 -1
  74. package/cjs/label/overlap/scaler.js.map +1 -1
  75. package/cjs/label/polygon.d.ts +12 -0
  76. package/cjs/label/polygon.js +35 -0
  77. package/cjs/label/polygon.js.map +1 -0
  78. package/cjs/label/rect.js.map +1 -1
  79. package/cjs/label/symbol.js.map +1 -1
  80. package/cjs/label/type.d.ts +9 -5
  81. package/cjs/label/type.js.map +1 -1
  82. package/cjs/label/util.js.map +1 -1
  83. package/cjs/legend/base.js.map +1 -1
  84. package/cjs/legend/color/color.js.map +1 -1
  85. package/cjs/legend/color/index.js.map +1 -1
  86. package/cjs/legend/color/type.js.map +1 -1
  87. package/cjs/legend/constant.js.map +1 -1
  88. package/cjs/legend/discrete/discrete.js +28 -27
  89. package/cjs/legend/discrete/discrete.js.map +1 -1
  90. package/cjs/legend/discrete/index.js.map +1 -1
  91. package/cjs/legend/discrete/type.js.map +1 -1
  92. package/cjs/legend/index.js.map +1 -1
  93. package/cjs/legend/size/index.js.map +1 -1
  94. package/cjs/legend/size/size.js.map +1 -1
  95. package/cjs/legend/size/type.js.map +1 -1
  96. package/cjs/legend/type.js.map +1 -1
  97. package/cjs/link-path/index.js +1 -2
  98. package/cjs/link-path/index.js.map +1 -1
  99. package/cjs/link-path/link-path.js +2 -1
  100. package/cjs/link-path/link-path.js.map +1 -1
  101. package/cjs/link-path/type.js.map +1 -1
  102. package/cjs/marker/area.js.map +1 -1
  103. package/cjs/marker/base.js.map +1 -1
  104. package/cjs/marker/config.js.map +1 -1
  105. package/cjs/marker/index.js.map +1 -1
  106. package/cjs/marker/line.js.map +1 -1
  107. package/cjs/marker/point.js +1 -1
  108. package/cjs/marker/point.js.map +1 -1
  109. package/cjs/marker/type.js.map +1 -1
  110. package/cjs/pager/index.js.map +1 -1
  111. package/cjs/pager/pager.js +4 -2
  112. package/cjs/pager/pager.js.map +1 -1
  113. package/cjs/pager/type.js.map +1 -1
  114. package/cjs/player/base-player.d.ts +9 -1
  115. package/cjs/player/base-player.js +25 -22
  116. package/cjs/player/base-player.js.map +1 -1
  117. package/cjs/player/constant.d.ts +1 -0
  118. package/cjs/player/constant.js +1 -0
  119. package/cjs/player/constant.js.map +1 -1
  120. package/cjs/player/continuous-player.js +6 -6
  121. package/cjs/player/continuous-player.js.map +1 -1
  122. package/cjs/player/controller/assets/index.js.map +1 -1
  123. package/cjs/player/controller/constant.js.map +1 -1
  124. package/cjs/player/controller/controller.d.ts +2 -2
  125. package/cjs/player/controller/controller.js +15 -7
  126. package/cjs/player/controller/controller.js.map +1 -1
  127. package/cjs/player/controller/icon/icon.js.map +1 -1
  128. package/cjs/player/controller/icon/index.js.map +1 -1
  129. package/cjs/player/controller/icon/type.js.map +1 -1
  130. package/cjs/player/controller/index.js.map +1 -1
  131. package/cjs/player/controller/type.d.ts +14 -6
  132. package/cjs/player/controller/type.js.map +1 -1
  133. package/cjs/player/discrete-player.js +11 -11
  134. package/cjs/player/discrete-player.js.map +1 -1
  135. package/cjs/player/index.js.map +1 -1
  136. package/cjs/player/type/base.js.map +1 -1
  137. package/cjs/player/type/continuous-player.d.ts +2 -2
  138. package/cjs/player/type/continuous-player.js.map +1 -1
  139. package/cjs/player/type/direction.js.map +1 -1
  140. package/cjs/player/type/discrete-player.js.map +1 -1
  141. package/cjs/player/type/event.d.ts +12 -6
  142. package/cjs/player/type/event.js +5 -3
  143. package/cjs/player/type/event.js.map +1 -1
  144. package/cjs/player/type/index.js.map +1 -1
  145. package/cjs/player/type/layout.d.ts +5 -2
  146. package/cjs/player/type/layout.js.map +1 -1
  147. package/cjs/player/utils.js.map +1 -1
  148. package/cjs/poptip/contribution.js +3 -1
  149. package/cjs/poptip/contribution.js.map +1 -1
  150. package/cjs/poptip/index.js.map +1 -1
  151. package/cjs/poptip/poptip-plugin.js.map +1 -1
  152. package/cjs/poptip/poptip.js +30 -11
  153. package/cjs/poptip/poptip.js.map +1 -1
  154. package/cjs/poptip/register.d.ts +1 -1
  155. package/cjs/poptip/register.js +8 -6
  156. package/cjs/poptip/register.js.map +1 -1
  157. package/cjs/poptip/theme.js.map +1 -1
  158. package/cjs/poptip/type.d.ts +3 -0
  159. package/cjs/poptip/type.js.map +1 -1
  160. package/cjs/scrollbar/index.js.map +1 -1
  161. package/cjs/scrollbar/scrollbar.js.map +1 -1
  162. package/cjs/scrollbar/type.js.map +1 -1
  163. package/cjs/segment/index.js.map +1 -1
  164. package/cjs/segment/segment.js.map +1 -1
  165. package/cjs/segment/type.js.map +1 -1
  166. package/cjs/slider/constant.js.map +1 -1
  167. package/cjs/slider/index.js.map +1 -1
  168. package/cjs/slider/slider.js.map +1 -1
  169. package/cjs/slider/type.js.map +1 -1
  170. package/cjs/tag/index.js.map +1 -1
  171. package/cjs/tag/tag.js.map +1 -1
  172. package/cjs/tag/type.js.map +1 -1
  173. package/cjs/title/index.js.map +1 -1
  174. package/cjs/title/title.js.map +1 -1
  175. package/cjs/title/type.js.map +1 -1
  176. package/cjs/tooltip/config.js.map +1 -1
  177. package/cjs/tooltip/index.js.map +1 -1
  178. package/cjs/tooltip/tooltip.js.map +1 -1
  179. package/cjs/tooltip/type.js.map +1 -1
  180. package/cjs/tooltip/util.js.map +1 -1
  181. package/cjs/util/align.js.map +1 -1
  182. package/cjs/util/common.js.map +1 -1
  183. package/cjs/util/index.js.map +1 -1
  184. package/cjs/util/labelSmartInvert.d.ts +1 -0
  185. package/cjs/util/labelSmartInvert.js +20 -2
  186. package/cjs/util/labelSmartInvert.js.map +1 -1
  187. package/cjs/util/matrix.js.map +1 -1
  188. package/cjs/util/text.js +3 -3
  189. package/cjs/util/text.js.map +1 -1
  190. package/dist/index.js +500 -304
  191. package/dist/index.min.js +1 -1
  192. package/es/axis/animate/group-fade.js.map +1 -1
  193. package/es/axis/animate/group-transition.js.map +1 -1
  194. package/es/axis/animate/index.js.map +1 -1
  195. package/es/axis/base.js.map +1 -1
  196. package/es/axis/circle.js.map +1 -1
  197. package/es/axis/config.js.map +1 -1
  198. package/es/axis/constant.js.map +1 -1
  199. package/es/axis/grid/base.js.map +1 -1
  200. package/es/axis/grid/circle.js.map +1 -1
  201. package/es/axis/grid/index.js.map +1 -1
  202. package/es/axis/grid/line.js.map +1 -1
  203. package/es/axis/grid/type.js.map +1 -1
  204. package/es/axis/index.js.map +1 -1
  205. package/es/axis/line.js +50 -2
  206. package/es/axis/line.js.map +1 -1
  207. package/es/axis/mixin/circle.js.map +1 -1
  208. package/es/axis/mixin/line.js.map +1 -1
  209. package/es/axis/overlap/auto-hide.js.map +1 -1
  210. package/es/axis/overlap/auto-limit.js.map +1 -1
  211. package/es/axis/overlap/auto-rotate.js +2 -2
  212. package/es/axis/overlap/auto-rotate.js.map +1 -1
  213. package/es/axis/type.d.ts +1 -0
  214. package/es/axis/type.js.map +1 -1
  215. package/es/brush/brush.d.ts +1 -0
  216. package/es/brush/brush.js +5 -0
  217. package/es/brush/brush.js.map +1 -1
  218. package/es/brush/config.js.map +1 -1
  219. package/es/brush/index.js.map +1 -1
  220. package/es/brush/type.js.map +1 -1
  221. package/es/constant.js.map +1 -1
  222. package/es/core/base.d.ts +2 -1
  223. package/es/core/base.js +3 -3
  224. package/es/core/base.js.map +1 -1
  225. package/es/core/type.js.map +1 -1
  226. package/es/crosshair/base.js.map +1 -1
  227. package/es/crosshair/circle.js.map +1 -1
  228. package/es/crosshair/index.js.map +1 -1
  229. package/es/crosshair/line.js.map +1 -1
  230. package/es/crosshair/polygon.js.map +1 -1
  231. package/es/crosshair/rect.js.map +1 -1
  232. package/es/crosshair/sector.js.map +1 -1
  233. package/es/crosshair/type.js.map +1 -1
  234. package/es/data-zoom/config.js.map +1 -1
  235. package/es/data-zoom/data-zoom.js.map +1 -1
  236. package/es/data-zoom/index.js.map +1 -1
  237. package/es/data-zoom/type.js.map +1 -1
  238. package/es/index.d.ts +1 -1
  239. package/es/index.js +1 -1
  240. package/es/index.js.map +1 -1
  241. package/es/indicator/config.js.map +1 -1
  242. package/es/indicator/index.js.map +1 -1
  243. package/es/indicator/indicator.js.map +1 -1
  244. package/es/indicator/type.js.map +1 -1
  245. package/es/interface.js.map +1 -1
  246. package/es/jsx/component-type.js.map +1 -1
  247. package/es/jsx/index.js.map +1 -1
  248. package/es/label/animate/animate.js.map +1 -1
  249. package/es/label/animate/index.js.map +1 -1
  250. package/es/label/arc.d.ts +7 -3
  251. package/es/label/arc.js +66 -9
  252. package/es/label/arc.js.map +1 -1
  253. package/es/label/base.d.ts +12 -9
  254. package/es/label/base.js +124 -135
  255. package/es/label/base.js.map +1 -1
  256. package/es/label/dataLabel.js +5 -3
  257. package/es/label/dataLabel.js.map +1 -1
  258. package/es/label/index.js.map +1 -1
  259. package/es/label/line.js.map +1 -1
  260. package/es/label/overlap/bitmap.js.map +1 -1
  261. package/es/label/overlap/index.js.map +1 -1
  262. package/es/label/overlap/place.d.ts +2 -2
  263. package/es/label/overlap/place.js +15 -8
  264. package/es/label/overlap/place.js.map +1 -1
  265. package/es/label/overlap/scaler.js.map +1 -1
  266. package/es/label/polygon.d.ts +12 -0
  267. package/es/label/polygon.js +31 -0
  268. package/es/label/polygon.js.map +1 -0
  269. package/es/label/rect.js.map +1 -1
  270. package/es/label/symbol.js.map +1 -1
  271. package/es/label/type.d.ts +9 -5
  272. package/es/label/type.js.map +1 -1
  273. package/es/label/util.js.map +1 -1
  274. package/es/legend/base.js.map +1 -1
  275. package/es/legend/color/color.js.map +1 -1
  276. package/es/legend/color/index.js.map +1 -1
  277. package/es/legend/color/type.js.map +1 -1
  278. package/es/legend/constant.js.map +1 -1
  279. package/es/legend/discrete/discrete.js +26 -25
  280. package/es/legend/discrete/discrete.js.map +1 -1
  281. package/es/legend/discrete/index.js.map +1 -1
  282. package/es/legend/discrete/type.js.map +1 -1
  283. package/es/legend/index.js.map +1 -1
  284. package/es/legend/size/index.js.map +1 -1
  285. package/es/legend/size/size.js.map +1 -1
  286. package/es/legend/size/type.js.map +1 -1
  287. package/es/legend/type.js.map +1 -1
  288. package/es/link-path/index.js +1 -2
  289. package/es/link-path/index.js.map +1 -1
  290. package/es/link-path/link-path.js +2 -1
  291. package/es/link-path/link-path.js.map +1 -1
  292. package/es/link-path/type.js.map +1 -1
  293. package/es/marker/area.js.map +1 -1
  294. package/es/marker/base.js.map +1 -1
  295. package/es/marker/config.js.map +1 -1
  296. package/es/marker/index.js.map +1 -1
  297. package/es/marker/line.js.map +1 -1
  298. package/es/marker/point.js +1 -1
  299. package/es/marker/point.js.map +1 -1
  300. package/es/marker/type.js.map +1 -1
  301. package/es/pager/index.js.map +1 -1
  302. package/es/pager/pager.js +4 -2
  303. package/es/pager/pager.js.map +1 -1
  304. package/es/pager/type.js.map +1 -1
  305. package/es/player/base-player.d.ts +9 -1
  306. package/es/player/base-player.js +25 -22
  307. package/es/player/base-player.js.map +1 -1
  308. package/es/player/constant.d.ts +1 -0
  309. package/es/player/constant.js +1 -0
  310. package/es/player/constant.js.map +1 -1
  311. package/es/player/continuous-player.js +6 -6
  312. package/es/player/continuous-player.js.map +1 -1
  313. package/es/player/controller/assets/index.js.map +1 -1
  314. package/es/player/controller/constant.js.map +1 -1
  315. package/es/player/controller/controller.d.ts +2 -2
  316. package/es/player/controller/controller.js +15 -7
  317. package/es/player/controller/controller.js.map +1 -1
  318. package/es/player/controller/icon/icon.js.map +1 -1
  319. package/es/player/controller/icon/index.js.map +1 -1
  320. package/es/player/controller/icon/type.js.map +1 -1
  321. package/es/player/controller/index.js.map +1 -1
  322. package/es/player/controller/type.d.ts +14 -6
  323. package/es/player/controller/type.js.map +1 -1
  324. package/es/player/discrete-player.js +10 -10
  325. package/es/player/discrete-player.js.map +1 -1
  326. package/es/player/index.js.map +1 -1
  327. package/es/player/type/base.js.map +1 -1
  328. package/es/player/type/continuous-player.d.ts +2 -2
  329. package/es/player/type/continuous-player.js.map +1 -1
  330. package/es/player/type/direction.js.map +1 -1
  331. package/es/player/type/discrete-player.js.map +1 -1
  332. package/es/player/type/event.d.ts +12 -6
  333. package/es/player/type/event.js +5 -3
  334. package/es/player/type/event.js.map +1 -1
  335. package/es/player/type/index.js.map +1 -1
  336. package/es/player/type/layout.d.ts +5 -2
  337. package/es/player/type/layout.js.map +1 -1
  338. package/es/player/utils.js.map +1 -1
  339. package/es/poptip/contribution.js +3 -1
  340. package/es/poptip/contribution.js.map +1 -1
  341. package/es/poptip/index.js.map +1 -1
  342. package/es/poptip/poptip-plugin.js.map +1 -1
  343. package/es/poptip/poptip.js +31 -9
  344. package/es/poptip/poptip.js.map +1 -1
  345. package/es/poptip/register.d.ts +1 -1
  346. package/es/poptip/register.js +7 -6
  347. package/es/poptip/register.js.map +1 -1
  348. package/es/poptip/theme.js.map +1 -1
  349. package/es/poptip/type.d.ts +3 -0
  350. package/es/poptip/type.js.map +1 -1
  351. package/es/scrollbar/index.js.map +1 -1
  352. package/es/scrollbar/scrollbar.js.map +1 -1
  353. package/es/scrollbar/type.js.map +1 -1
  354. package/es/segment/index.js.map +1 -1
  355. package/es/segment/segment.js.map +1 -1
  356. package/es/segment/type.js.map +1 -1
  357. package/es/slider/constant.js.map +1 -1
  358. package/es/slider/index.js.map +1 -1
  359. package/es/slider/slider.js.map +1 -1
  360. package/es/slider/type.js.map +1 -1
  361. package/es/tag/index.js.map +1 -1
  362. package/es/tag/tag.js.map +1 -1
  363. package/es/tag/type.js.map +1 -1
  364. package/es/title/index.js.map +1 -1
  365. package/es/title/title.js.map +1 -1
  366. package/es/title/type.js.map +1 -1
  367. package/es/tooltip/config.js.map +1 -1
  368. package/es/tooltip/index.js.map +1 -1
  369. package/es/tooltip/tooltip.js.map +1 -1
  370. package/es/tooltip/type.js.map +1 -1
  371. package/es/tooltip/util.js.map +1 -1
  372. package/es/util/align.js.map +1 -1
  373. package/es/util/common.js.map +1 -1
  374. package/es/util/index.js.map +1 -1
  375. package/es/util/labelSmartInvert.d.ts +1 -0
  376. package/es/util/labelSmartInvert.js +17 -0
  377. package/es/util/labelSmartInvert.js.map +1 -1
  378. package/es/util/matrix.js.map +1 -1
  379. package/es/util/text.js +3 -3
  380. package/es/util/text.js.map +1 -1
  381. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@
36
36
  });
37
37
  }
38
38
  setAttribute(key, value, forceUpdateTag) {
39
- if (vutils.isPlainObject(this.attribute[key])) {
39
+ if (vutils.isPlainObject(this.attribute[key]) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(value)) {
40
40
  vutils.merge(this.attribute[key], value);
41
41
  }
42
42
  else {
@@ -77,7 +77,7 @@
77
77
  }
78
78
  for (let i = 0; i < keys.length; i++) {
79
79
  const key = keys[i];
80
- if (vutils.isPlainObject(this.attribute[key])) {
80
+ if (vutils.isPlainObject(this.attribute[key]) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(params[key])) {
81
81
  vutils.merge(this.attribute[key], params[key]);
82
82
  }
83
83
  else {
@@ -495,6 +495,20 @@
495
495
  const { r, g, b } = c.color;
496
496
  return '#' + vutils.ColorUtil.rgbToHex(r, g, b);
497
497
  }
498
+ function smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor) {
499
+ let result;
500
+ switch (fillStrategy) {
501
+ case 'base':
502
+ result = baseColor;
503
+ break;
504
+ case 'invertBase':
505
+ result = invertColor;
506
+ break;
507
+ case 'similarBase':
508
+ result = similarColor;
509
+ }
510
+ return result;
511
+ }
498
512
 
499
513
  function scale(vector, scale) {
500
514
  return [vector[0] * scale, vector[1] * scale];
@@ -561,16 +575,16 @@
561
575
  }, getTextBounds: useNaiveCanvas ? undefined : vrender.getTextBounds, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
562
576
  };
563
577
  function measureTextSize(text, textSpec) {
564
- var _a, _b;
578
+ var _a;
565
579
  if (!text) {
566
580
  return { width: 0, height: 0 };
567
581
  }
568
582
  const bounds = vrender.getTextBounds({
569
583
  text,
570
- fontFamily: (_a = textSpec.fontFamily) !== null && _a !== void 0 ? _a : '',
584
+ fontFamily: textSpec.fontFamily,
571
585
  fontSize: textSpec.fontSize || 12,
572
586
  fontWeight: textSpec.fontWeight,
573
- textAlign: (_b = textSpec.textAlign) !== null && _b !== void 0 ? _b : 'center',
587
+ textAlign: (_a = textSpec.textAlign) !== null && _a !== void 0 ? _a : 'center',
574
588
  textBaseline: textSpec.textBaseline,
575
589
  ellipsis: !!textSpec.ellipsis,
576
590
  maxLineWidth: textSpec.maxLineWidth || Infinity,
@@ -696,6 +710,7 @@
696
710
  }
697
711
  };
698
712
 
713
+ const _tBounds = new vutils.AABBBounds();
699
714
  class PopTip extends AbstractComponent {
700
715
  constructor(attributes) {
701
716
  super(vutils.merge({}, PopTip.defaultAttributes, attributes));
@@ -703,14 +718,17 @@
703
718
  this.positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];
704
719
  }
705
720
  render() {
706
- var _a, _b, _c, _d, _e;
707
- const { title = '', titleStyle = {}, position, content = '', contentStyle = {}, panel = {}, space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, visible, state, dx = 0, dy = 0 } = this.attribute;
721
+ var _a, _b, _c, _d, _e, _f, _g, _h;
722
+ const { titleStyle = {}, position, contentStyle = {}, panel = {}, space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0 } = this.attribute;
723
+ let { title = '', content = '' } = this.attribute;
724
+ title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;
725
+ content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
708
726
  const parsedPadding = vutils.normalizePadding(padding);
709
727
  const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group');
710
728
  const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];
711
729
  const titleVisible = vutils.isValid(title) && visible !== false;
712
- const titleAttrs = Object.assign(Object.assign({ text: title, visible: titleVisible }, titleStyle), { x: parsedPadding[3], y: parsedPadding[0], maxLineWidth, textAlign: 'left', textBaseline: 'top' });
713
- const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text');
730
+ const titleAttrs = Object.assign(Object.assign({ text: vutils.isArray(title) ? title : [title], visible: titleVisible }, titleStyle), { x: parsedPadding[3], y: parsedPadding[0], maxLineWidth, textAlign: 'left', textBaseline: 'top' });
731
+ const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'wrapText');
714
732
  if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.title)) {
715
733
  titleShape.states = state.title;
716
734
  }
@@ -722,8 +740,8 @@
722
740
  height = 0;
723
741
  }
724
742
  const contentVisible = vutils.isValid(content) && visible !== false;
725
- const contentAttrs = Object.assign(Object.assign({ text: content, visible: contentVisible }, contentStyle), { x: parsedPadding[3], y: parsedPadding[0] + height, maxLineWidth, textAlign: 'left', textBaseline: 'top' });
726
- const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text');
743
+ const contentAttrs = Object.assign(Object.assign({ text: vutils.isArray(content) ? content : [content], visible: contentVisible }, contentStyle), { x: parsedPadding[3], y: parsedPadding[0] + height, maxLineWidth, textAlign: 'left', textBaseline: 'top' });
744
+ const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'wrapText');
727
745
  if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.content)) {
728
746
  contentShape.states = state.content;
729
747
  }
@@ -740,7 +758,7 @@
740
758
  else if (popTipWidth < minWidth) {
741
759
  popTipWidth = minWidth;
742
760
  }
743
- const poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
761
+ let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
744
762
  const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
745
763
  const symbolSize = (_a = backgroundStyle.size) !== null && _a !== void 0 ? _a : 12;
746
764
  const spaceSize = vutils.isArray(symbolSize)
@@ -748,8 +766,30 @@
748
766
  : symbolSize + ((_d = backgroundStyle.space) !== null && _d !== void 0 ? _d : 0);
749
767
  const lineWidth = (_e = backgroundStyle.lineWidth) !== null && _e !== void 0 ? _e : 1;
750
768
  const range = this.stage
751
- ? [this.stage.width, this.stage.height]
769
+ ? [
770
+ (_f = this.stage.viewWidth) !== null && _f !== void 0 ? _f : this.stage.width,
771
+ (_g = this.stage.viewHeight) !== null && _g !== void 0 ? _g : this.stage.height
772
+ ]
752
773
  : undefined;
774
+ if (range) {
775
+ const b = this.AABBBounds;
776
+ const leftWidth = (_h = this.attribute.x) !== null && _h !== void 0 ? _h : b.x1;
777
+ const rightWidth = range[0] - b.x1;
778
+ let maxSpace = Math.max(leftWidth, rightWidth);
779
+ const buf = (vutils.isArray(symbolSize) ? symbolSize[0] : 12) + 3;
780
+ maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent);
781
+ if (maxSpace < popTipWidth) {
782
+ popTipWidth = maxSpace;
783
+ const buf = parsedPadding[1] + parsedPadding[3];
784
+ titleShape.setAttribute('maxLineWidth', maxSpace - buf);
785
+ contentShape.setAttribute('maxLineWidth', maxSpace - buf);
786
+ poptipHeight = parsedPadding[0] + parsedPadding[2];
787
+ if (titleVisible) {
788
+ poptipHeight += titleShape.AABBBounds.height() + space;
789
+ }
790
+ poptipHeight += contentShape.AABBBounds.height();
791
+ }
792
+ }
753
793
  const layout = position === 'auto';
754
794
  let maxBBoxI;
755
795
  let maxBBoxSize = -Infinity;
@@ -772,7 +812,8 @@
772
812
  y: -offset[1] + dy
773
813
  });
774
814
  if (layout && range) {
775
- const b = this.AABBBounds;
815
+ _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
816
+ const b = _tBounds;
776
817
  const stageBounds = new vutils.Bounds().setValue(0, 0, range[0], range[1]);
777
818
  if (vutils.rectInsideAnotherRect(b, stageBounds, false)) {
778
819
  break;
@@ -850,6 +891,7 @@
850
891
  textAlign: 'left',
851
892
  textBaseline: 'top'
852
893
  },
894
+ maxWidthPercent: 0.8,
853
895
  space: 8,
854
896
  padding: 10
855
897
  };
@@ -920,8 +962,13 @@
920
962
  if (visible === false || (visibleCb && visibleCb(graphic) === false)) {
921
963
  return;
922
964
  }
965
+ const attribute = {};
966
+ vutils.merge(attribute, PopTip.defaultAttributes, graphic.attribute.poptip ? graphic.attribute.poptip : {});
923
967
  if (!this.poptipComponent) {
924
- this.poptipComponent = new PopTip(graphic.attribute.poptip);
968
+ this.poptipComponent = new PopTip(attribute);
969
+ }
970
+ else {
971
+ this.poptipComponent.initAttributes(attribute);
925
972
  }
926
973
  let poptip = graphic.attribute.poptip || {};
927
974
  if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {
@@ -1056,16 +1103,21 @@
1056
1103
  injectable()
1057
1104
  ], PopTipForClipedTextPlugin);
1058
1105
 
1059
- const popTipModule = new ContainerModule(bind => {
1060
- bind(PopTipRenderContribution).toSelf().inSingletonScope();
1061
- bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
1062
- bind(PopTipPlugin).toSelf().inSingletonScope();
1063
- bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
1064
- bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();
1065
- bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
1106
+ const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {
1107
+ if (!isBound(PopTipRenderContribution)) {
1108
+ bind(PopTipRenderContribution).toSelf().inSingletonScope();
1109
+ bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
1110
+ }
1111
+ if (!isBound(PopTipPlugin)) {
1112
+ bind(PopTipPlugin).toSelf();
1113
+ bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
1114
+ }
1115
+ if (!isBound(PopTipForClipedTextPlugin)) {
1116
+ bind(PopTipForClipedTextPlugin).toSelf();
1117
+ bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
1118
+ }
1066
1119
  });
1067
- function loadPoptip(defaultPoptipTheme) {
1068
- vutils.merge(theme.poptip, defaultPoptipTheme);
1120
+ function loadPoptip() {
1069
1121
  vrender.container.load(popTipModule);
1070
1122
  }
1071
1123
  function setPoptipTheme(defaultPoptipTheme) {
@@ -1395,26 +1447,29 @@
1395
1447
  };
1396
1448
  }
1397
1449
 
1398
- function canPlace($, bitmap, bound, checkBound = true) {
1399
- const range = boundToRange($, bound);
1450
+ function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
1451
+ let range = bound;
1452
+ if (pad > 0) {
1453
+ range = {
1454
+ x1: bound.x1 - pad,
1455
+ x2: bound.x2 + pad,
1456
+ y1: bound.y1 - pad,
1457
+ y2: bound.y2 + pad
1458
+ };
1459
+ }
1460
+ range = boundToRange($, range);
1400
1461
  const outOfBounds = checkBound && bitmap.outOfBounds(range);
1401
1462
  if (outOfBounds) {
1402
1463
  return false;
1403
1464
  }
1404
1465
  return !bitmap.getRange(range);
1405
1466
  }
1406
- function canPlaceInside(textBound, shapeBound) {
1407
- if (!textBound || !shapeBound) {
1408
- return false;
1409
- }
1410
- return shapeBound.encloses(textBound);
1411
- }
1412
- function placeToCandidates($, bitmap, text, candidates = [], clampForce = true) {
1467
+ function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
1413
1468
  for (let i = 0; i < candidates.length; i++) {
1414
1469
  const tempText = text.clone();
1415
1470
  tempText.setAttributes(candidates[i]);
1416
1471
  tempText.update();
1417
- if (canPlace($, bitmap, boundToRange($, tempText.AABBBounds), clampForce)) {
1472
+ if (canPlace($, bitmap, boundToRange($, tempText.AABBBounds), clampForce, pad)) {
1418
1473
  bitmap.setRange(boundToRange($, tempText.AABBBounds, true));
1419
1474
  return candidates[i];
1420
1475
  }
@@ -1422,13 +1477,15 @@
1422
1477
  return false;
1423
1478
  }
1424
1479
  function place($, bitmap, s, attrs, text, bounds, labeling) {
1425
- var _a, _b, _c;
1480
+ var _a, _b;
1481
+ const clampForce = (_a = attrs.overlap) === null || _a === void 0 ? void 0 : _a.clampForce;
1482
+ const overlapPadding = (_b = attrs.overlap) === null || _b === void 0 ? void 0 : _b.overlapPadding;
1426
1483
  if (s.type === 'bound' || s.type === 'position') {
1427
1484
  if (vutils.isFunction(labeling)) {
1428
1485
  const userPosition = vutils.isFunction(s.position) ? s.position(text.attribute) : s.position;
1429
1486
  const positions = (userPosition || defaultLabelPosition(attrs.type));
1430
1487
  const candidates = positions.map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
1431
- return placeToCandidates($, bitmap, text, candidates, (_a = attrs.overlap) === null || _a === void 0 ? void 0 : _a.clampForce);
1488
+ return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1432
1489
  }
1433
1490
  return false;
1434
1491
  }
@@ -1437,14 +1494,14 @@
1437
1494
  const candidates = offset.map(dy => {
1438
1495
  return { x: text.attribute.x, y: text.attribute.y + dy };
1439
1496
  });
1440
- return placeToCandidates($, bitmap, text, candidates, (_b = attrs.overlap) === null || _b === void 0 ? void 0 : _b.clampForce);
1497
+ return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1441
1498
  }
1442
1499
  if (s.type === 'moveX') {
1443
1500
  const offset = s.offset ? (vutils.isFunction(s.offset) ? s.offset(text.attribute) : s.offset) : [];
1444
1501
  const candidates = offset.map(dx => {
1445
1502
  return { x: text.attribute.x + dx, y: text.attribute.y };
1446
1503
  });
1447
- return placeToCandidates($, bitmap, text, candidates, (_c = attrs.overlap) === null || _c === void 0 ? void 0 : _c.clampForce);
1504
+ return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
1448
1505
  }
1449
1506
  return false;
1450
1507
  }
@@ -1532,8 +1589,14 @@
1532
1589
  };
1533
1590
 
1534
1591
  class LabelBase extends AbstractComponent {
1535
- constructor() {
1536
- super(...arguments);
1592
+ setBitmap(bitmap) {
1593
+ this._bitmap = bitmap;
1594
+ }
1595
+ setBitmapTool(bmpTool) {
1596
+ this._bmpTool = bmpTool;
1597
+ }
1598
+ constructor(attributes) {
1599
+ super(vutils.merge({}, LabelBase.defaultAttributes, attributes));
1537
1600
  this.name = 'label';
1538
1601
  this._onHover = (e) => {
1539
1602
  const target = e.target;
@@ -1581,18 +1644,17 @@
1581
1644
  }
1582
1645
  };
1583
1646
  }
1584
- setBitmap(bitmap) {
1585
- this._bitmap = bitmap;
1586
- }
1587
- setBitmapTool(bmpTool) {
1588
- this._bmpTool = bmpTool;
1647
+ labeling(textBounds, graphicBounds, position, offset) {
1648
+ return;
1589
1649
  }
1590
- layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
1591
- const arcs = [];
1592
- return arcs;
1650
+ _labelLine(text) {
1651
+ return;
1593
1652
  }
1594
1653
  render() {
1595
1654
  this._prepare();
1655
+ if (vutils.isNil(this._idToGraphic)) {
1656
+ return;
1657
+ }
1596
1658
  const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
1597
1659
  let data = this.attribute.data;
1598
1660
  if (vutils.isFunction(dataFilter)) {
@@ -1603,14 +1665,14 @@
1603
1665
  labels = customLayoutFunc(data, (d) => this._idToGraphic.get(d.id));
1604
1666
  }
1605
1667
  else {
1606
- labels = this.layout(data);
1607
- if (vutils.isFunction(customOverlapFunc)) {
1608
- labels = customOverlapFunc(labels, (d) => this._idToGraphic.get(d.id));
1609
- }
1610
- else {
1611
- if (overlap !== false) {
1612
- labels = this._overlapping(labels);
1613
- }
1668
+ labels = this._layout(data);
1669
+ }
1670
+ if (vutils.isFunction(customOverlapFunc)) {
1671
+ labels = customOverlapFunc(labels, (d) => this._idToGraphic.get(d.id));
1672
+ }
1673
+ else {
1674
+ if (overlap !== false) {
1675
+ labels = this._overlapping(labels);
1614
1676
  }
1615
1677
  }
1616
1678
  if (smartInvert !== false) {
@@ -1649,8 +1711,14 @@
1649
1711
  }
1650
1712
  _prepare() {
1651
1713
  var _a;
1652
- const baseMarks = getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName);
1653
1714
  const currentBaseMarks = [];
1715
+ let baseMarks;
1716
+ if (vutils.isFunction(this.attribute.getBaseMarks)) {
1717
+ baseMarks = this.attribute.getBaseMarks();
1718
+ }
1719
+ else {
1720
+ baseMarks = getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName);
1721
+ }
1654
1722
  baseMarks.forEach(mark => {
1655
1723
  if (mark.releaseStatus !== 'willRelease') {
1656
1724
  currentBaseMarks.push(mark);
@@ -1679,49 +1747,24 @@
1679
1747
  }
1680
1748
  }
1681
1749
  }
1682
- layout(data = []) {
1750
+ _layout(data = []) {
1683
1751
  const { textStyle = {}, position, offset } = this.attribute;
1684
1752
  const labels = [];
1685
- const textBoundsArray = [];
1686
1753
  for (let i = 0; i < data.length; i++) {
1687
1754
  const textData = data[i];
1688
1755
  const baseMark = this._idToGraphic.get(textData.id);
1689
1756
  const labelAttribute = Object.assign(Object.assign({ fill: baseMark.attribute.fill }, textStyle), textData);
1690
1757
  const text = this._createLabelText(labelAttribute);
1691
1758
  const textBounds = this.getGraphicBounds(text);
1692
- textBoundsArray.push(textBounds);
1693
1759
  const graphicBounds = this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
1694
1760
  const textLocation = this.labeling(textBounds, graphicBounds, vutils.isFunction(position) ? position(textData) : position, offset);
1695
- if (!textLocation) {
1696
- continue;
1761
+ if (textLocation) {
1762
+ labelAttribute.x = textLocation.x;
1763
+ labelAttribute.y = textLocation.y;
1764
+ text.setAttributes(textLocation);
1697
1765
  }
1698
- labelAttribute.x = textLocation.x;
1699
- labelAttribute.y = textLocation.y;
1700
- text.setAttributes(textLocation);
1701
1766
  labels.push(text);
1702
1767
  }
1703
- if (this.attribute.type === 'arc') {
1704
- const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
1705
- const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
1706
- const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
1707
- const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
1708
- const arcs = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
1709
- for (let i = 0; i < data.length; i++) {
1710
- const textData = data[i];
1711
- const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
1712
- const labelAttribute = {
1713
- visible: basedArc.labelVisible,
1714
- x: basedArc.labelPosition.x,
1715
- y: basedArc.labelPosition.y,
1716
- angle: basedArc.angle,
1717
- maxLineWidth: basedArc.labelLimit,
1718
- points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
1719
- ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
1720
- : undefined
1721
- };
1722
- labels[i].setAttributes(labelAttribute);
1723
- }
1724
- }
1725
1768
  return labels;
1726
1769
  }
1727
1770
  _overlapping(labels) {
@@ -1739,7 +1782,7 @@
1739
1782
  if (size.width === 0 || size.height === 0) {
1740
1783
  return labels;
1741
1784
  }
1742
- const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [] } = option;
1785
+ const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
1743
1786
  const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);
1744
1787
  const bitmap = this._bitmap || bmpTool.bitmap();
1745
1788
  const checkBounds = strategy.some(s => s.type === 'bound');
@@ -1767,13 +1810,16 @@
1767
1810
  const text = labels[i];
1768
1811
  const baseMark = this._idToGraphic.get(text.attribute.id);
1769
1812
  text.update();
1770
- if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {
1813
+ if (!vutils.isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {
1814
+ continue;
1815
+ }
1816
+ if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {
1771
1817
  if (!checkBounds) {
1772
1818
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1773
1819
  result.push(text);
1774
1820
  continue;
1775
1821
  }
1776
- if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1822
+ if (checkBounds && (baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds) && this._canPlaceInside(text.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds)) {
1777
1823
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1778
1824
  result.push(text);
1779
1825
  continue;
@@ -1796,7 +1842,7 @@
1796
1842
  x2: text.AABBBounds.x2 + dx,
1797
1843
  y1: text.AABBBounds.y1 + dy,
1798
1844
  y2: text.AABBBounds.y2 + dy
1799
- })) {
1845
+ }, undefined, overlapPadding)) {
1800
1846
  text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
1801
1847
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
1802
1848
  result.push(text);
@@ -1827,9 +1873,17 @@
1827
1873
  });
1828
1874
  }
1829
1875
  _renderLabels(labels) {
1876
+ const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;
1877
+ if (disableAnimation) {
1878
+ this._renderWithOutAnimation(labels);
1879
+ }
1880
+ else {
1881
+ this._renderWithAnimation(labels);
1882
+ }
1883
+ }
1884
+ _renderWithAnimation(labels) {
1830
1885
  var _a, _b, _c, _d, _e;
1831
1886
  const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
1832
- const disableAnimation = this._enableAnimation === false || animationConfig === false;
1833
1887
  const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
1834
1888
  const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
1835
1889
  const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
@@ -1838,27 +1892,18 @@
1838
1892
  const prevTextMap = this._graphicToText || new Map();
1839
1893
  const texts = [];
1840
1894
  labels.forEach((text, index) => {
1841
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1842
- const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
1843
- ? vrender.createLine({
1844
- visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
1845
- stroke: (_f = (_e = (_d = text.attribute) === null || _d === void 0 ? void 0 : _d.line) === null || _e === void 0 ? void 0 : _e.stroke) !== null && _f !== void 0 ? _f : (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.fill,
1846
- lineWidth: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.lineWidth) !== null && _k !== void 0 ? _k : 1,
1847
- points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
1848
- })
1849
- : undefined;
1895
+ var _a, _b, _c, _d, _e, _f, _g;
1896
+ const labelLine = this._labelLine(text);
1850
1897
  const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1851
1898
  const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1852
1899
  if (state === 'enter') {
1853
1900
  texts.push(text);
1854
1901
  currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1855
- if (!disableAnimation && relatedGraphic) {
1902
+ if (relatedGraphic) {
1856
1903
  const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
1857
1904
  this.add(text);
1858
- if (labelLine) {
1859
- this.add(labelLine);
1860
- }
1861
- relatedGraphic.onAnimateBind = () => {
1905
+ labelLine && this.add(labelLine);
1906
+ relatedGraphic.once('animate-bind', () => {
1862
1907
  text.setAttributes(from);
1863
1908
  const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
1864
1909
  mode,
@@ -1868,58 +1913,70 @@
1868
1913
  delay
1869
1914
  });
1870
1915
  relatedGraphic.on('afterAttributeUpdate', listener);
1871
- };
1872
- }
1873
- else {
1874
- this.add(text);
1875
- if (labelLine) {
1876
- this.add(labelLine);
1877
- }
1916
+ });
1878
1917
  }
1879
1918
  }
1880
- if (state === 'update') {
1919
+ else if (state === 'update') {
1881
1920
  const prevLabel = prevTextMap.get(relatedGraphic);
1882
1921
  prevTextMap.delete(relatedGraphic);
1883
1922
  currentTextMap.set(relatedGraphic, prevLabel);
1884
- if (!disableAnimation) {
1885
- const prevText = prevLabel.text;
1886
- prevText.animate().to(text.attribute, duration, easing);
1887
- if (prevLabel.labelLine) {
1888
- prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1889
- points: (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.points
1890
- }), duration, easing);
1891
- }
1892
- if (animationConfig.increaseEffect !== false &&
1893
- prevText.attribute.text !== text.attribute.text &&
1894
- vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1895
- prevText
1896
- .animate()
1897
- .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1898
- }
1899
- }
1900
- else {
1901
- prevLabel.text.setAttributes(text.attribute);
1902
- if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1903
- prevLabel.labelLine.setAttributes({ points: (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.points });
1904
- }
1923
+ const prevText = prevLabel.text;
1924
+ prevText.animate().to(text.attribute, duration, easing);
1925
+ if (prevLabel.labelLine) {
1926
+ prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
1927
+ visible: (_f = (_d = (((_b = (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.line) === null || _b === void 0 ? void 0 : _b.visible) && ((_c = text.attribute) === null || _c === void 0 ? void 0 : _c.visible))) !== null && _d !== void 0 ? _d : (_e = text.attribute) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true,
1928
+ points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
1929
+ }), duration, easing);
1930
+ }
1931
+ if (animationConfig.increaseEffect !== false &&
1932
+ prevText.attribute.text !== text.attribute.text &&
1933
+ vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
1934
+ prevText
1935
+ .animate()
1936
+ .play(new vrender.IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
1905
1937
  }
1906
1938
  }
1907
1939
  });
1908
1940
  prevTextMap.forEach(label => {
1909
1941
  var _a;
1910
- if (disableAnimation) {
1942
+ (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1911
1943
  this.removeChild(label.text);
1912
1944
  if (label === null || label === void 0 ? void 0 : label.labelLine) {
1913
1945
  this.removeChild(label.labelLine);
1914
1946
  }
1947
+ });
1948
+ });
1949
+ this._graphicToText = currentTextMap;
1950
+ }
1951
+ _renderWithOutAnimation(labels) {
1952
+ const currentTextMap = new Map();
1953
+ const prevTextMap = this._graphicToText || new Map();
1954
+ labels.forEach(text => {
1955
+ var _a;
1956
+ const labelLine = this._labelLine(text);
1957
+ const relatedGraphic = this._idToGraphic.get(text.attribute.id);
1958
+ const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
1959
+ if (state === 'enter') {
1960
+ currentTextMap.set(relatedGraphic, labelLine ? { text, labelLine } : { text });
1961
+ this.add(text);
1962
+ if (labelLine) {
1963
+ this.add(labelLine);
1964
+ }
1915
1965
  }
1916
- else {
1917
- (_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
1918
- this.removeChild(label.text);
1919
- if (label === null || label === void 0 ? void 0 : label.labelLine) {
1920
- this.removeChild(label.labelLine);
1921
- }
1922
- });
1966
+ else if (state === 'update') {
1967
+ const prevLabel = prevTextMap.get(relatedGraphic);
1968
+ prevTextMap.delete(relatedGraphic);
1969
+ currentTextMap.set(relatedGraphic, prevLabel);
1970
+ prevLabel.text.setAttributes(text.attribute);
1971
+ if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
1972
+ prevLabel.labelLine.setAttributes({ points: (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points });
1973
+ }
1974
+ }
1975
+ });
1976
+ prevTextMap.forEach(label => {
1977
+ this.removeChild(label.text);
1978
+ if (label === null || label === void 0 ? void 0 : label.labelLine) {
1979
+ this.removeChild(label.labelLine);
1923
1980
  }
1924
1981
  });
1925
1982
  this._graphicToText = currentTextMap;
@@ -1990,21 +2047,20 @@
1990
2047
  continue;
1991
2048
  }
1992
2049
  const baseMark = this._idToGraphic.get(label.attribute.id);
1993
- let isInside = canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
1994
- if (this.attribute.type === 'arc') {
1995
- isInside = this.attribute.position === 'inside';
1996
- }
2050
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
1997
2051
  const backgroundColor = baseMark.attribute.fill;
1998
2052
  const foregroundColor = label.attribute.fill;
1999
2053
  const baseColor = backgroundColor;
2000
2054
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
2001
- const simialrColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2055
+ const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2002
2056
  if (isInside) {
2003
- this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
2057
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2058
+ fill && label.setAttributes({ fill });
2004
2059
  if (label.attribute.lineWidth === 0) {
2005
2060
  continue;
2006
2061
  }
2007
- this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2062
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2063
+ stroke && label.setAttributes({ stroke });
2008
2064
  }
2009
2065
  else {
2010
2066
  if (label.attribute.lineWidth === 0) {
@@ -2016,47 +2072,18 @@
2016
2072
  });
2017
2073
  continue;
2018
2074
  }
2019
- this.setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor);
2020
- this.setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor);
2075
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2076
+ fill && label.setAttributes({ fill });
2077
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2078
+ stroke && label.setAttributes({ stroke });
2021
2079
  }
2022
2080
  }
2023
2081
  }
2024
- setFillStrategy(fillStrategy, label, baseColor, invertColor, simialrColor) {
2025
- switch (fillStrategy) {
2026
- case 'base':
2027
- label.setAttributes({
2028
- fill: baseColor
2029
- });
2030
- break;
2031
- case 'invertBase':
2032
- label.setAttributes({
2033
- fill: invertColor
2034
- });
2035
- break;
2036
- case 'similarBase':
2037
- label.setAttributes({
2038
- fill: simialrColor
2039
- });
2040
- }
2041
- }
2042
- setStrokeStrategy(strokeStrategy, label, baseColor, invertColor, simialrColor) {
2043
- switch (strokeStrategy) {
2044
- case 'base':
2045
- label.setAttributes({
2046
- stroke: baseColor
2047
- });
2048
- break;
2049
- case 'invertBase':
2050
- label.setAttributes({
2051
- stroke: invertColor
2052
- });
2053
- break;
2054
- case 'similarBase':
2055
- label.setAttributes({
2056
- stroke: simialrColor
2057
- });
2058
- break;
2082
+ _canPlaceInside(textBound, shapeBound) {
2083
+ if (!textBound || !shapeBound) {
2084
+ return false;
2059
2085
  }
2086
+ return shapeBound.encloses(textBound);
2060
2087
  }
2061
2088
  setLocation(point) {
2062
2089
  this.translateTo(point.x, point.y);
@@ -2068,6 +2095,16 @@
2068
2095
  this._enableAnimation = true;
2069
2096
  }
2070
2097
  }
2098
+ LabelBase.defaultAttributes = {
2099
+ textStyle: {
2100
+ fontSize: 12,
2101
+ textAlign: 'center',
2102
+ textBaseline: 'middle',
2103
+ boundsPadding: [-1, 0, -1, 0]
2104
+ },
2105
+ offset: 0,
2106
+ pickable: false
2107
+ };
2071
2108
 
2072
2109
  class SymbolLabel extends LabelBase {
2073
2110
  constructor(attributes) {
@@ -2422,18 +2459,47 @@
2422
2459
  }
2423
2460
  return { x: 0, y: 0 };
2424
2461
  }
2462
+ _layout(data = []) {
2463
+ const labels = super._layout(data);
2464
+ const textBoundsArray = labels.map(label => this.getGraphicBounds(label));
2465
+ const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
2466
+ const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
2467
+ const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
2468
+ const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
2469
+ const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
2470
+ for (let i = 0; i < data.length; i++) {
2471
+ const textData = data[i];
2472
+ const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
2473
+ const labelAttribute = {
2474
+ visible: basedArc.labelVisible,
2475
+ x: basedArc.labelPosition.x,
2476
+ y: basedArc.labelPosition.y,
2477
+ angle: basedArc.angle,
2478
+ maxLineWidth: basedArc.labelLimit,
2479
+ points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
2480
+ ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
2481
+ : undefined,
2482
+ line: basedArc === null || basedArc === void 0 ? void 0 : basedArc.labelLine
2483
+ };
2484
+ labels[i].setAttributes(labelAttribute);
2485
+ }
2486
+ return labels;
2487
+ }
2425
2488
  layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
2426
2489
  var _a;
2427
2490
  this._arcLeft.clear();
2428
2491
  this._arcRight.clear();
2429
2492
  this._ellipsisWidth = ellipsisWidth;
2430
- const { width, height } = attribute;
2431
2493
  const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
2494
+ let maxRadius = 0;
2495
+ currentMarks.forEach(currentMarks => {
2496
+ if (currentMarks.attribute.outerRadius > maxRadius) {
2497
+ maxRadius = currentMarks.attribute.outerRadius;
2498
+ }
2499
+ });
2432
2500
  currentMarks.forEach((currentMark, index) => {
2433
2501
  var _a, _b;
2434
2502
  const graphicAttribute = currentMark.attribute;
2435
- const radiusRatio = this.computeLayoutOuterRadius(graphicAttribute.outerRadius, width, height);
2436
- const radius = this.computeRadius(radiusRatio, width, height, centerOffset);
2437
2503
  const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
2438
2504
  const item = data[index];
2439
2505
  const textBounds = textBoundsArray[index];
@@ -2441,7 +2507,7 @@
2441
2507
  const intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle;
2442
2508
  const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
2443
2509
  const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
2444
- const outerArcMiddle = circlePoint(center.x, center.y, radius + attribute.line.line1MinLength, arcMiddleAngle);
2510
+ const outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
2445
2511
  const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
2446
2512
  arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius, centerOffset), arc.middleAngle);
2447
2513
  arc.labelSize = {
@@ -2575,6 +2641,7 @@
2575
2641
  arc.labelVisible = false;
2576
2642
  }
2577
2643
  arc.angle = (_b = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
2644
+ arc.labelLine = Object.assign({}, attribute === null || attribute === void 0 ? void 0 : attribute.line);
2578
2645
  });
2579
2646
  return arcs;
2580
2647
  }
@@ -2583,7 +2650,13 @@
2583
2650
  const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
2584
2651
  const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2585
2652
  const plotLayout = { width: center.x * 2, height: center.y * 2 };
2586
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2653
+ let maxRadius = 0;
2654
+ currentMarks.forEach((currentMark) => {
2655
+ if (currentMark.attribute.outerRadius > maxRadius) {
2656
+ maxRadius = currentMark.attribute.outerRadius;
2657
+ }
2658
+ });
2659
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2587
2660
  const line1MinLength = attribute.line.line1MinLength;
2588
2661
  const line2MinLength = attribute.line.line2MinLength;
2589
2662
  const labelLayoutAlign = (_f = attribute.layout) === null || _f === void 0 ? void 0 : _f.align;
@@ -2814,7 +2887,13 @@
2814
2887
  _computePointB(arc, r, attribute, currentMarks) {
2815
2888
  var _a, _b, _c, _d, _e;
2816
2889
  const labelConfig = attribute;
2817
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2890
+ let maxRadius = 0;
2891
+ currentMarks.forEach((currentMark) => {
2892
+ if (currentMark.attribute.outerRadius > maxRadius) {
2893
+ maxRadius = currentMark.attribute.outerRadius;
2894
+ }
2895
+ });
2896
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2818
2897
  const line1MinLength = labelConfig.line.line1MinLength;
2819
2898
  const labelLayout = labelConfig.layout;
2820
2899
  if (labelLayout.strategy === 'none') {
@@ -2853,7 +2932,13 @@
2853
2932
  var _a, _b, _c, _d, _e;
2854
2933
  const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
2855
2934
  const plotRect = { width: center.x * 2, height: center.y * 2 };
2856
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2935
+ let maxRadius = 0;
2936
+ currentMarks.forEach((currentMark) => {
2937
+ if (currentMark.attribute.outerRadius > maxRadius) {
2938
+ maxRadius = currentMark.attribute.outerRadius;
2939
+ }
2940
+ });
2941
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2857
2942
  const line1MinLength = attribute.line.line1MinLength;
2858
2943
  const { width, height } = plotRect;
2859
2944
  const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
@@ -2920,7 +3005,13 @@
2920
3005
  const labelConfig = attribute;
2921
3006
  const layoutArcGap = labelConfig.layoutArcGap;
2922
3007
  const line1MinLength = labelConfig.line.line1MinLength;
2923
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
3008
+ let maxRadius = 0;
3009
+ currentMarks.forEach((currentMark) => {
3010
+ if (currentMark.attribute.outerRadius > maxRadius) {
3011
+ maxRadius = currentMark.attribute.outerRadius;
3012
+ }
3013
+ });
3014
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2924
3015
  const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
2925
3016
  const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
2926
3017
  const outerR = radius + line1MinLength;
@@ -2988,6 +3079,19 @@
2988
3079
  }
2989
3080
  }
2990
3081
  }
3082
+ _labelLine(text) {
3083
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
3084
+ const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
3085
+ ? vrender.createLine({
3086
+ visible: (_g = (_e = (((_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.line) === null || _c === void 0 ? void 0 : _c.visible) && ((_d = text.attribute) === null || _d === void 0 ? void 0 : _d.visible))) !== null && _e !== void 0 ? _e : (_f = text.attribute) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true,
3087
+ stroke: (_l = (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.style) === null || _k === void 0 ? void 0 : _k.stroke) !== null && _l !== void 0 ? _l : (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.fill,
3088
+ lineWidth: (_r = (_q = (_p = (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.line) === null || _p === void 0 ? void 0 : _p.style) === null || _q === void 0 ? void 0 : _q.lineWidth) !== null && _r !== void 0 ? _r : 1,
3089
+ points: (_s = text.attribute) === null || _s === void 0 ? void 0 : _s.points,
3090
+ curveType: ((_u = (_t = text.attribute) === null || _t === void 0 ? void 0 : _t.line) === null || _u === void 0 ? void 0 : _u.smooth) ? 'basis' : null
3091
+ })
3092
+ : undefined;
3093
+ return labelLine;
3094
+ }
2991
3095
  computeRadius(r, width, height, centerOffset, k) {
2992
3096
  var _a;
2993
3097
  return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
@@ -2995,6 +3099,9 @@
2995
3099
  computeLayoutRadius(width, height) {
2996
3100
  return Math.min(width / 2, height / 2);
2997
3101
  }
3102
+ _canPlaceInside(textBound, shapeBound) {
3103
+ return this.attribute.position === 'inside';
3104
+ }
2998
3105
  computeLayoutOuterRadius(r, width, height) {
2999
3106
  return r / (Math.min(width, height) / 2);
3000
3107
  }
@@ -3059,7 +3166,8 @@
3059
3166
  const prevComponentMap = this._componentMap;
3060
3167
  for (let i = 0; i < dataLabels.length; i++) {
3061
3168
  const dataLabel = dataLabels[i];
3062
- if (labelComponentMap[dataLabel.type]) {
3169
+ const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
3170
+ if (labelComponent) {
3063
3171
  const { baseMarkGroupName } = dataLabel;
3064
3172
  let component = this._componentMap.get(baseMarkGroupName);
3065
3173
  if (component) {
@@ -3069,7 +3177,7 @@
3069
3177
  currentComponentMap.set(baseMarkGroupName, component);
3070
3178
  }
3071
3179
  else {
3072
- component = new labelComponentMap[dataLabel.type](dataLabel);
3180
+ component = new labelComponent(dataLabel);
3073
3181
  component.setBitmap(bitmap);
3074
3182
  component.setBitmapTool(tool);
3075
3183
  this.add(component);
@@ -3885,12 +3993,14 @@
3885
3993
  }
3886
3994
  function rotateYAxis(orient, items) {
3887
3995
  items.forEach((item, i) => {
3888
- item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
3996
+ item.attribute.angle &&
3997
+ item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
3889
3998
  });
3890
3999
  }
3891
4000
  function rotateXAxis(orient, items) {
3892
4001
  items.forEach(item => {
3893
- item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
4002
+ item.attribute.angle &&
4003
+ item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
3894
4004
  });
3895
4005
  }
3896
4006
  function getXAxisLabelAlign(orient, angle = 0) {
@@ -4256,6 +4366,92 @@
4256
4366
  };
4257
4367
  }
4258
4368
  beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
4369
+ const { flush = false } = this.attribute.label || {};
4370
+ if (flush && labelShapes.length) {
4371
+ const { orient, start, end } = this.attribute;
4372
+ const isX = orient === 'bottom' || orient === 'top';
4373
+ const first = labelShapes[0];
4374
+ const last = vutils.last(labelShapes);
4375
+ const isInverse = isX ? first.attribute.x > last.attribute.x : first.attribute.y < last.attribute.y;
4376
+ if (isX) {
4377
+ const width = Math.abs(start.x - end.x);
4378
+ if (isInverse) {
4379
+ const start = width;
4380
+ const end = 0;
4381
+ const startBound = first.AABBBounds.x2;
4382
+ const endBound = last.AABBBounds.x1;
4383
+ if (startBound > start) {
4384
+ first.setAttributes({
4385
+ x: start,
4386
+ textAlign: 'right'
4387
+ });
4388
+ }
4389
+ if (endBound < end) {
4390
+ last.setAttributes({
4391
+ x: end,
4392
+ textAlign: 'left'
4393
+ });
4394
+ }
4395
+ }
4396
+ else {
4397
+ const start = 0;
4398
+ const end = width;
4399
+ const startBound = first.AABBBounds.x1;
4400
+ const endBound = last.AABBBounds.x2;
4401
+ if (startBound < start) {
4402
+ first.setAttributes({
4403
+ x: start,
4404
+ textAlign: 'left'
4405
+ });
4406
+ }
4407
+ if (endBound > end) {
4408
+ last.setAttributes({
4409
+ x: end,
4410
+ textAlign: 'right'
4411
+ });
4412
+ }
4413
+ }
4414
+ }
4415
+ else {
4416
+ const height = Math.abs(start.y - end.y);
4417
+ if (isInverse) {
4418
+ const startBound = first.AABBBounds.y1;
4419
+ const endBound = last.AABBBounds.y2;
4420
+ const start = 0;
4421
+ const end = height;
4422
+ if (startBound < start) {
4423
+ first.setAttributes({
4424
+ y: start,
4425
+ textBaseline: 'top'
4426
+ });
4427
+ }
4428
+ if (endBound > end) {
4429
+ last.setAttributes({
4430
+ y: end,
4431
+ textBaseline: 'bottom'
4432
+ });
4433
+ }
4434
+ }
4435
+ else {
4436
+ const start = height;
4437
+ const end = 0;
4438
+ const startBound = first.AABBBounds.y2;
4439
+ const endBound = last.AABBBounds.y1;
4440
+ if (startBound > start) {
4441
+ first.setAttributes({
4442
+ y: start,
4443
+ textBaseline: 'bottom'
4444
+ });
4445
+ }
4446
+ if (endBound < end) {
4447
+ last.setAttributes({
4448
+ y: end,
4449
+ textBaseline: 'top'
4450
+ });
4451
+ }
4452
+ }
4453
+ }
4454
+ }
4259
4455
  return;
4260
4456
  }
4261
4457
  handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
@@ -6481,7 +6677,8 @@
6481
6677
  const changeEvent = new vrender.CustomEvent('toPrev', {
6482
6678
  current: this._current,
6483
6679
  total: this._total,
6484
- direction: 'pre'
6680
+ direction: 'pre',
6681
+ event: e
6485
6682
  });
6486
6683
  changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
6487
6684
  this.dispatchEvent(changeEvent);
@@ -6500,7 +6697,8 @@
6500
6697
  const changeEvent = new vrender.CustomEvent('toNext', {
6501
6698
  current: this._current,
6502
6699
  total: this._total,
6503
- direction: 'next'
6700
+ direction: 'next',
6701
+ event: e
6504
6702
  });
6505
6703
  changeEvent.manager = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.eventSystem.manager;
6506
6704
  this.dispatchEvent(changeEvent);
@@ -6726,16 +6924,16 @@
6726
6924
  const legendItem = target.delegate;
6727
6925
  const selected = legendItem.hasState(exports.LegendStateValue.selected);
6728
6926
  if (selected) {
6729
- this._setLegendItemState(legendItem, exports.LegendStateValue.selectedHover);
6927
+ this._setLegendItemState(legendItem, exports.LegendStateValue.selectedHover, e);
6730
6928
  }
6731
6929
  else {
6732
- this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover);
6930
+ this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover, e);
6733
6931
  }
6734
6932
  const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
6735
6933
  if (focusButton) {
6736
6934
  focusButton.setAttribute('visible', true);
6737
6935
  }
6738
- this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem);
6936
+ this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem, e);
6739
6937
  }
6740
6938
  };
6741
6939
  this._onUnHover = (e) => {
@@ -6766,9 +6964,9 @@
6766
6964
  focusButton.setAttribute('visible', false);
6767
6965
  }
6768
6966
  if (attributeUpdate) {
6769
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
6967
+ this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
6770
6968
  }
6771
- this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem);
6969
+ this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
6772
6970
  }
6773
6971
  };
6774
6972
  this._onClick = (e) => {
@@ -6781,25 +6979,17 @@
6781
6979
  legendItem.toggleState(exports.LegendStateValue.focus);
6782
6980
  if (isFocusSelected) {
6783
6981
  (_b = this._itemsContainer) === null || _b === void 0 ? void 0 : _b.getChildren().forEach(item => {
6784
- this._removeLegendItemState(item, [
6785
- exports.LegendStateValue.unSelected,
6786
- exports.LegendStateValue.unSelectedHover,
6787
- exports.LegendStateValue.focus
6788
- ]);
6789
- this._setLegendItemState(item, exports.LegendStateValue.selected);
6982
+ this._removeLegendItemState(item, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover, exports.LegendStateValue.focus], e);
6983
+ this._setLegendItemState(item, exports.LegendStateValue.selected, e);
6790
6984
  });
6791
6985
  }
6792
6986
  else {
6793
- this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
6794
- this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
6987
+ this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
6988
+ this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
6795
6989
  (_c = this._itemsContainer) === null || _c === void 0 ? void 0 : _c.getChildren().forEach(item => {
6796
6990
  if (legendItem !== item) {
6797
- this._removeLegendItemState(item, [
6798
- exports.LegendStateValue.selected,
6799
- exports.LegendStateValue.selectedHover,
6800
- exports.LegendStateValue.focus
6801
- ]);
6802
- this._setLegendItemState(item, exports.LegendStateValue.unSelected);
6991
+ this._removeLegendItemState(item, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover, exports.LegendStateValue.focus], e);
6992
+ this._setLegendItemState(item, exports.LegendStateValue.unSelected, e);
6803
6993
  }
6804
6994
  });
6805
6995
  }
@@ -6813,33 +7003,30 @@
6813
7003
  const currentSelectedItems = this._getSelectedLegends();
6814
7004
  if (selectMode === 'multiple') {
6815
7005
  if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {
6816
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem);
7006
+ this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
6817
7007
  return;
6818
7008
  }
6819
7009
  if (isSelected) {
6820
- this._removeLegendItemState(legendItem, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover]);
6821
- this._setLegendItemState(legendItem, exports.LegendStateValue.unSelected);
7010
+ this._removeLegendItemState(legendItem, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover], e);
7011
+ this._setLegendItemState(legendItem, exports.LegendStateValue.unSelected, e);
6822
7012
  }
6823
7013
  else {
6824
- this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
6825
- this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
7014
+ this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
7015
+ this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
6826
7016
  }
6827
7017
  }
6828
7018
  else {
6829
- this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
6830
- this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
7019
+ this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
7020
+ this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
6831
7021
  (_e = this._itemsContainer) === null || _e === void 0 ? void 0 : _e.getChildren().forEach(item => {
6832
7022
  if (legendItem !== item) {
6833
- this._removeLegendItemState(item, [
6834
- exports.LegendStateValue.selected,
6835
- exports.LegendStateValue.selectedHover
6836
- ]);
6837
- this._setLegendItemState(item, exports.LegendStateValue.unSelected);
7023
+ this._removeLegendItemState(item, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover], e);
7024
+ this._setLegendItemState(item, exports.LegendStateValue.unSelected, e);
6838
7025
  }
6839
7026
  });
6840
7027
  }
6841
7028
  }
6842
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem);
7029
+ this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
6843
7030
  }
6844
7031
  };
6845
7032
  }
@@ -7210,7 +7397,8 @@
7210
7397
  this._pager.addEventListener('toNext', onPaging);
7211
7398
  return true;
7212
7399
  }
7213
- _setLegendItemState(legendItem, stateName, keepCurrentStates = true) {
7400
+ _setLegendItemState(legendItem, stateName, e) {
7401
+ const keepCurrentStates = true;
7214
7402
  let attributeUpdate = false;
7215
7403
  if (!legendItem.hasState(stateName)) {
7216
7404
  attributeUpdate = true;
@@ -7228,10 +7416,10 @@
7228
7416
  }
7229
7417
  });
7230
7418
  if (attributeUpdate) {
7231
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
7419
+ this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
7232
7420
  }
7233
7421
  }
7234
- _removeLegendItemState(legendItem, stateNames) {
7422
+ _removeLegendItemState(legendItem, stateNames, e) {
7235
7423
  let attributeUpdate = false;
7236
7424
  stateNames.forEach(name => {
7237
7425
  if (!attributeUpdate && legendItem.hasState(name)) {
@@ -7253,7 +7441,7 @@
7253
7441
  }
7254
7442
  });
7255
7443
  if (attributeUpdate) {
7256
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
7444
+ this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
7257
7445
  }
7258
7446
  }
7259
7447
  _getSelectedLegends() {
@@ -7272,7 +7460,7 @@
7272
7460
  shape.delegate = delegateShape;
7273
7461
  shape.states = vutils.merge({}, DEFAULT_STATES, states);
7274
7462
  }
7275
- _dispatchEvent(eventName, legendItem) {
7463
+ _dispatchEvent(eventName, legendItem, event) {
7276
7464
  var _a;
7277
7465
  const currentSelectedItems = this._getSelectedLegends();
7278
7466
  currentSelectedItems.sort((pre, next) => pre.index - next.index);
@@ -7282,7 +7470,8 @@
7282
7470
  data: legendItem.data,
7283
7471
  selected: legendItem.hasState(exports.LegendStateValue.selected),
7284
7472
  currentSelectedItems,
7285
- currentSelected
7473
+ currentSelected,
7474
+ event
7286
7475
  });
7287
7476
  changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
7288
7477
  this.dispatchEvent(changeEvent);
@@ -8770,16 +8959,16 @@
8770
8959
  this._isPaused = true;
8771
8960
  this.updateAttributes = () => {
8772
8961
  this._startAttr = {
8773
- style: Object.assign(Object.assign({ symbolType: iconPlay }, Controller.defaultControllerAttr), this.attribute.start.style)
8962
+ style: Object.assign(Object.assign(Object.assign({ symbolType: iconPlay }, Controller.defaultControllerAttr), { visible: this.attribute.start.visible }), this.attribute.start.style)
8774
8963
  };
8775
8964
  this._pauseAttr = {
8776
- style: Object.assign(Object.assign({ symbolType: iconPause }, Controller.defaultControllerAttr), this.attribute.pause.style)
8965
+ style: Object.assign(Object.assign(Object.assign({ symbolType: iconPause }, Controller.defaultControllerAttr), { visible: this.attribute.pause.visible }), this.attribute.pause.style)
8777
8966
  };
8778
8967
  this._forwardAttr = {
8779
- style: Object.assign(Object.assign({}, Controller.defaultControllerAttr), this.attribute.forward.style)
8968
+ style: Object.assign(Object.assign(Object.assign({}, Controller.defaultControllerAttr), { visible: this.attribute.forward.visible }), this.attribute.forward.style)
8780
8969
  };
8781
8970
  this._backwardAttr = {
8782
- style: Object.assign(Object.assign({}, Controller.defaultControllerAttr), this.attribute.backward.style)
8971
+ style: Object.assign(Object.assign(Object.assign({}, Controller.defaultControllerAttr), { visible: this.attribute.backward.visible }), this.attribute.backward.style)
8783
8972
  };
8784
8973
  this.updateLayout();
8785
8974
  };
@@ -8890,6 +9079,7 @@
8890
9079
  }
8891
9080
  }
8892
9081
  Controller.defaultControllerAttr = {
9082
+ visible: true,
8893
9083
  x: 0,
8894
9084
  y: 0,
8895
9085
  size: 20,
@@ -8898,7 +9088,6 @@
8898
9088
  cursor: 'pointer'
8899
9089
  };
8900
9090
  Controller.defaultAttributes = {
8901
- visible: true,
8902
9091
  [ControllerTypeEnum.Start]: {},
8903
9092
  [ControllerTypeEnum.Pause]: {},
8904
9093
  [ControllerTypeEnum.Backward]: {},
@@ -8906,6 +9095,7 @@
8906
9095
  };
8907
9096
 
8908
9097
  const defaultControllerAttributes = {
9098
+ visible: true,
8909
9099
  style: {
8910
9100
  x: 0,
8911
9101
  y: 0,
@@ -8926,12 +9116,18 @@
8926
9116
 
8927
9117
  exports.PlayerEventEnum = void 0;
8928
9118
  (function (PlayerEventEnum) {
8929
- PlayerEventEnum["OnChange"] = "onChange";
8930
- PlayerEventEnum["OnPlay"] = "onPlay";
8931
- PlayerEventEnum["OnPause"] = "onPause";
8932
- PlayerEventEnum["OnBackward"] = "onBackward";
8933
- PlayerEventEnum["OnForward"] = "onForward";
8934
- PlayerEventEnum["OnEnd"] = "onEnd";
9119
+ PlayerEventEnum["change"] = "change";
9120
+ PlayerEventEnum["play"] = "play";
9121
+ PlayerEventEnum["pause"] = "pause";
9122
+ PlayerEventEnum["backward"] = "backward";
9123
+ PlayerEventEnum["forward"] = "forward";
9124
+ PlayerEventEnum["end"] = "end";
9125
+ PlayerEventEnum["OnChange"] = "change";
9126
+ PlayerEventEnum["OnPlay"] = "play";
9127
+ PlayerEventEnum["OnPause"] = "pause";
9128
+ PlayerEventEnum["OnBackward"] = "backward";
9129
+ PlayerEventEnum["OnForward"] = "forward";
9130
+ PlayerEventEnum["OnEnd"] = "end";
8935
9131
  })(exports.PlayerEventEnum || (exports.PlayerEventEnum = {}));
8936
9132
 
8937
9133
  const isReachEndByDefault = ({ direction, maxIndex, dataIndex }) => {
@@ -8988,6 +9184,7 @@
8988
9184
  handlerSize = vutils.max(this._handlerStyle.size[0], this._handlerStyle.size[1]);
8989
9185
  }
8990
9186
  const attrs = {
9187
+ visible: this._sliderVisible,
8991
9188
  min: this._minIndex,
8992
9189
  max: this._maxIndex,
8993
9190
  value: (_a = this.attribute.dataIndex) !== null && _a !== void 0 ? _a : 0,
@@ -9000,7 +9197,6 @@
9000
9197
  dy: this.attribute.slider.dy,
9001
9198
  dx: this.attribute.slider.dx,
9002
9199
  slidable: true,
9003
- visible: true,
9004
9200
  range: false,
9005
9201
  handlerText: { visible: false },
9006
9202
  startText: { visible: false },
@@ -9029,11 +9225,12 @@
9029
9225
  this._initSlider = () => {
9030
9226
  const attrs = this._updateSliderAttrs();
9031
9227
  this._slider = new Slider(attrs);
9032
- this.add(this._slider);
9228
+ if (this._sliderVisible) {
9229
+ this.add(this._slider);
9230
+ }
9033
9231
  };
9034
9232
  this._updateControllerAttrs = () => {
9035
9233
  const attrs = {
9036
- visible: true,
9037
9234
  start: this._start,
9038
9235
  pause: this._pause,
9039
9236
  forward: this._forward,
@@ -9041,40 +9238,26 @@
9041
9238
  };
9042
9239
  if (isHorizontal(this._orient)) {
9043
9240
  attrs.layout = 'horizontal';
9044
- attrs.start = {
9045
- style: Object.assign(Object.assign({}, attrs.start.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y })
9046
- };
9047
- attrs.pause = {
9048
- style: Object.assign(Object.assign({}, attrs.pause.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y })
9049
- };
9050
- attrs.backward = {
9051
- style: Object.assign(Object.assign({}, attrs.backward.style), { x: this._layoutInfo.backward.x, y: this._layoutInfo.backward.y })
9052
- };
9053
- attrs.forward = {
9054
- style: Object.assign(Object.assign({}, attrs.forward.style), { x: this._layoutInfo.forward.x, y: this._layoutInfo.forward.y })
9055
- };
9241
+ attrs.start = Object.assign(Object.assign({}, attrs.start), { style: Object.assign(Object.assign({}, attrs.start.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y }) });
9242
+ attrs.pause = Object.assign(Object.assign({}, attrs.pause), { style: Object.assign(Object.assign({}, attrs.pause.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y }) });
9243
+ attrs.backward = Object.assign(Object.assign({}, attrs.backward), { style: Object.assign(Object.assign({}, attrs.backward.style), { x: this._layoutInfo.backward.x, y: this._layoutInfo.backward.y }) });
9244
+ attrs.forward = Object.assign(Object.assign({}, attrs.forward), { style: Object.assign(Object.assign({}, attrs.forward.style), { x: this._layoutInfo.forward.x, y: this._layoutInfo.forward.y }) });
9056
9245
  }
9057
9246
  else {
9058
9247
  attrs.layout = 'vertical';
9059
- attrs.start = {
9060
- style: Object.assign(Object.assign({}, attrs.start.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y })
9061
- };
9062
- attrs.pause = {
9063
- style: Object.assign(Object.assign({}, attrs.pause.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y })
9064
- };
9065
- attrs.backward = {
9066
- style: Object.assign(Object.assign({}, attrs.backward.style), { x: this._layoutInfo.backward.x, y: this._layoutInfo.backward.y })
9067
- };
9068
- attrs.forward = {
9069
- style: Object.assign(Object.assign({}, attrs.forward.style), { x: this._layoutInfo.forward.x, y: this._layoutInfo.forward.y })
9070
- };
9248
+ attrs.start = Object.assign(Object.assign({}, attrs.start), { style: Object.assign(Object.assign({}, attrs.start.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y }) });
9249
+ attrs.pause = Object.assign(Object.assign({}, attrs.pause), { style: Object.assign(Object.assign({}, attrs.pause.style), { x: this._layoutInfo.start.x, y: this._layoutInfo.start.y }) });
9250
+ attrs.backward = Object.assign(Object.assign({}, attrs.backward), { style: Object.assign(Object.assign({}, attrs.backward.style), { x: this._layoutInfo.backward.x, y: this._layoutInfo.backward.y }) });
9251
+ attrs.forward = Object.assign(Object.assign({}, attrs.forward), { style: Object.assign(Object.assign({}, attrs.forward.style), { x: this._layoutInfo.forward.x, y: this._layoutInfo.forward.y }) });
9071
9252
  }
9072
9253
  return attrs;
9073
9254
  };
9074
9255
  this._initController = () => {
9075
9256
  const attrs = this._updateControllerAttrs();
9076
9257
  this._controller = new Controller(attrs);
9077
- this.add(this._controller);
9258
+ if (this._controllerVisible) {
9259
+ this.add(this._controller);
9260
+ }
9078
9261
  };
9079
9262
  this._initAttributes();
9080
9263
  this._initLayoutInfo();
@@ -9082,19 +9265,21 @@
9082
9265
  this._initSlider();
9083
9266
  }
9084
9267
  _initAttributes() {
9085
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
9268
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9086
9269
  this._size = this.attribute.size;
9087
9270
  this._orient = this.attribute.orient;
9088
9271
  this._data = this.attribute.data;
9089
9272
  this._minIndex = 0;
9090
9273
  this._maxIndex = this._data.length - 1;
9091
- this._railStyle = Object.assign({}, (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.slider) === null || _b === void 0 ? void 0 : _b.railStyle);
9092
- this._trackStyle = Object.assign({}, (_d = (_c = this.attribute) === null || _c === void 0 ? void 0 : _c.slider) === null || _d === void 0 ? void 0 : _d.trackStyle);
9093
- this._handlerStyle = Object.assign({}, (_f = (_e = this.attribute) === null || _e === void 0 ? void 0 : _e.slider) === null || _f === void 0 ? void 0 : _f.handlerStyle);
9094
- this._start = Object.assign({}, (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.controller) === null || _h === void 0 ? void 0 : _h.start);
9095
- this._pause = Object.assign({}, (_k = (_j = this.attribute) === null || _j === void 0 ? void 0 : _j.controller) === null || _k === void 0 ? void 0 : _k.pause);
9096
- this._forward = Object.assign({}, (_m = (_l = this.attribute) === null || _l === void 0 ? void 0 : _l.controller) === null || _m === void 0 ? void 0 : _m.forward);
9097
- this._backward = Object.assign({}, (_p = (_o = this.attribute) === null || _o === void 0 ? void 0 : _o.controller) === null || _p === void 0 ? void 0 : _p.backward);
9274
+ this._sliderVisible = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.slider) === null || _b === void 0 ? void 0 : _b.visible;
9275
+ this._railStyle = Object.assign({}, (_d = (_c = this.attribute) === null || _c === void 0 ? void 0 : _c.slider) === null || _d === void 0 ? void 0 : _d.railStyle);
9276
+ this._trackStyle = Object.assign({}, (_f = (_e = this.attribute) === null || _e === void 0 ? void 0 : _e.slider) === null || _f === void 0 ? void 0 : _f.trackStyle);
9277
+ this._handlerStyle = Object.assign({}, (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.slider) === null || _h === void 0 ? void 0 : _h.handlerStyle);
9278
+ this._controllerVisible = (_k = (_j = this.attribute) === null || _j === void 0 ? void 0 : _j.controller) === null || _k === void 0 ? void 0 : _k.visible;
9279
+ this._start = Object.assign({}, (_m = (_l = this.attribute) === null || _l === void 0 ? void 0 : _l.controller) === null || _m === void 0 ? void 0 : _m.start);
9280
+ this._pause = Object.assign({}, (_p = (_o = this.attribute) === null || _o === void 0 ? void 0 : _o.controller) === null || _p === void 0 ? void 0 : _p.pause);
9281
+ this._forward = Object.assign({}, (_r = (_q = this.attribute) === null || _q === void 0 ? void 0 : _q.controller) === null || _r === void 0 ? void 0 : _r.forward);
9282
+ this._backward = Object.assign({}, (_t = (_s = this.attribute) === null || _s === void 0 ? void 0 : _s.controller) === null || _t === void 0 ? void 0 : _t.backward);
9098
9283
  }
9099
9284
  _initLayoutInfo() {
9100
9285
  var _a, _b, _c;
@@ -9107,7 +9292,9 @@
9107
9292
  const maxSize = vutils.isNumber(size) ? size : vutils.max(size[0], size[1]);
9108
9293
  return len + controller.space + maxSize;
9109
9294
  }, 0);
9110
- const sliderPx = (isHorizontal(this._orient) ? (_b = this._size) === null || _b === void 0 ? void 0 : _b.width : (_c = this._size) === null || _c === void 0 ? void 0 : _c.height) - controllerPx;
9295
+ const sliderPx = this._sliderVisible
9296
+ ? (isHorizontal(this._orient) ? (_b = this._size) === null || _b === void 0 ? void 0 : _b.width : (_c = this._size) === null || _c === void 0 ? void 0 : _c.height) - controllerPx
9297
+ : 0;
9111
9298
  const railPx = sliderPx - this.attribute.slider.space;
9112
9299
  const startPx = startControllers.reduce((px, controller) => {
9113
9300
  const { key, space, style: { size } } = controller;
@@ -9162,6 +9349,7 @@
9162
9349
  width: 300
9163
9350
  },
9164
9351
  slider: {
9352
+ visible: true,
9165
9353
  space: 10,
9166
9354
  dx: 0,
9167
9355
  dy: 0,
@@ -9172,6 +9360,7 @@
9172
9360
  handlerStyle: {}
9173
9361
  },
9174
9362
  controller: {
9363
+ visible: true,
9175
9364
  start: Object.assign(Object.assign({}, defaultControllerAttributes), { key: 'start', position: 'start', space: 0 }),
9176
9365
  pause: Object.assign(Object.assign({}, defaultControllerAttributes), { key: 'pause', position: 'start' }),
9177
9366
  forward: Object.assign(Object.assign({}, defaultControllerAttributes), { key: 'forward', position: 'end' }),
@@ -9218,7 +9407,7 @@
9218
9407
  const middle = Math.floor(e.detail.value) + 0.5;
9219
9408
  this._dataIndex = e.detail.value >= middle ? Math.ceil(e.detail.value) : Math.floor(e.detail.value);
9220
9409
  this._slider.setValue(this._dataIndex);
9221
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9410
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9222
9411
  });
9223
9412
  };
9224
9413
  this.play = () => {
@@ -9249,7 +9438,7 @@
9249
9438
  this._updateDataIndex(this._maxIndex);
9250
9439
  }
9251
9440
  }
9252
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnPlay);
9441
+ this.dispatchCustomEvent(exports.PlayerEventEnum.play);
9253
9442
  this._isReachEnd = false;
9254
9443
  this._tickTime = Date.now();
9255
9444
  this._rafId = vrender.vglobal.getRequestAnimationFrame()(this._play.bind(this, true));
@@ -9262,14 +9451,14 @@
9262
9451
  return;
9263
9452
  }
9264
9453
  if (isFirstPlay && this._activeIndex !== this._dataIndex) {
9265
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9454
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9266
9455
  this._activeIndex = this._dataIndex;
9267
9456
  }
9268
9457
  else if (now - this._tickTime >= this._interval) {
9269
9458
  this._tickTime = now;
9270
9459
  this._updateDataIndex(forwardStep(this._direction, this._dataIndex, this._minIndex, this._maxIndex));
9271
9460
  this._activeIndex = this._dataIndex;
9272
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9461
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9273
9462
  }
9274
9463
  if ((this._direction === 'default' && this._dataIndex >= this._maxIndex) ||
9275
9464
  (this._direction === 'reverse' && this._dataIndex <= this._minIndex)) {
@@ -9286,7 +9475,7 @@
9286
9475
  this._controller.togglePlay();
9287
9476
  vrender.vglobal.getCancelAnimationFrame()(this._rafId);
9288
9477
  this._activeIndex = -1;
9289
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnEnd);
9478
+ this.dispatchCustomEvent(exports.PlayerEventEnum.end);
9290
9479
  };
9291
9480
  this.pause = () => {
9292
9481
  if (!this._isPlaying) {
@@ -9295,19 +9484,19 @@
9295
9484
  this._isPlaying = false;
9296
9485
  vrender.vglobal.getCancelAnimationFrame()(this._rafId);
9297
9486
  this._controller.togglePlay();
9298
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnPause);
9487
+ this.dispatchCustomEvent(exports.PlayerEventEnum.pause);
9299
9488
  };
9300
9489
  this.backward = () => {
9301
9490
  const index = Math.max(this._dataIndex - 1, this._minIndex);
9302
9491
  this._updateDataIndex(index);
9303
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9304
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnBackward);
9492
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9493
+ this.dispatchCustomEvent(exports.PlayerEventEnum.backward);
9305
9494
  };
9306
9495
  this.forward = () => {
9307
9496
  const index = Math.min(this._dataIndex + 1, this._maxIndex);
9308
9497
  this._updateDataIndex(index);
9309
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9310
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnForward);
9498
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9499
+ this.dispatchCustomEvent(exports.PlayerEventEnum.forward);
9311
9500
  };
9312
9501
  this._initAttributes();
9313
9502
  this._initEvents();
@@ -9388,7 +9577,7 @@
9388
9577
  this._dataIndex = index;
9389
9578
  this._activeIndex = index;
9390
9579
  if (index !== this._maxIndex) {
9391
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnChange);
9580
+ this.dispatchCustomEvent(exports.PlayerEventEnum.change);
9392
9581
  }
9393
9582
  }
9394
9583
  };
@@ -9402,7 +9591,7 @@
9402
9591
  this._elapsed = 0;
9403
9592
  }
9404
9593
  this._startTime = Date.now() - this._elapsed;
9405
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnPlay);
9594
+ this.dispatchCustomEvent(exports.PlayerEventEnum.play);
9406
9595
  this._rafId = vrender.vglobal.getRequestAnimationFrame()(this._play.bind(this));
9407
9596
  });
9408
9597
  this._play = () => {
@@ -9419,7 +9608,7 @@
9419
9608
  this._isPlaying = false;
9420
9609
  vrender.vglobal.getCancelAnimationFrame()(this._rafId);
9421
9610
  this._controller.togglePlay();
9422
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnEnd);
9611
+ this.dispatchCustomEvent(exports.PlayerEventEnum.end);
9423
9612
  };
9424
9613
  this.pause = () => {
9425
9614
  if (!this._isPlaying) {
@@ -9429,7 +9618,7 @@
9429
9618
  this._elapsed = Date.now() - this._startTime;
9430
9619
  vrender.vglobal.getCancelAnimationFrame()(this._rafId);
9431
9620
  this._controller.togglePlay();
9432
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnPause);
9621
+ this.dispatchCustomEvent(exports.PlayerEventEnum.pause);
9433
9622
  };
9434
9623
  this.backward = () => {
9435
9624
  const now = Date.now();
@@ -9444,7 +9633,7 @@
9444
9633
  this._startTime = this._startTime + this._interval;
9445
9634
  }
9446
9635
  this._updateSlider();
9447
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnBackward);
9636
+ this.dispatchCustomEvent(exports.PlayerEventEnum.backward);
9448
9637
  };
9449
9638
  this.forward = () => {
9450
9639
  const now = Date.now();
@@ -9459,7 +9648,7 @@
9459
9648
  this._elapsed = elapsed;
9460
9649
  }
9461
9650
  this._updateSlider();
9462
- this.dispatchCustomEvent(exports.PlayerEventEnum.OnForward);
9651
+ this.dispatchCustomEvent(exports.PlayerEventEnum.forward);
9463
9652
  };
9464
9653
  this._initAttributes();
9465
9654
  this._initEvents();
@@ -9773,6 +9962,13 @@
9773
9962
  setUpdateDragMaskCallback(callback) {
9774
9963
  vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
9775
9964
  }
9965
+ releaseBrushEvents() {
9966
+ const { delayType = 'throttle', delayTime = 0 } = this.attribute;
9967
+ this.stage.removeEventListener('pointerdown', this._onBrushStart);
9968
+ this.stage.removeEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
9969
+ this.stage.removeEventListener('pointerup', this._onBrushEnd);
9970
+ this.stage.removeEventListener('pointerupoutside', this._onBrushEnd);
9971
+ }
9776
9972
  }
9777
9973
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
9778
9974
 
@@ -10162,7 +10358,7 @@
10162
10358
  return new Tag(params ? params.attribute : {});
10163
10359
  }
10164
10360
 
10165
- const version = "0.15.0-alpha.5";
10361
+ const version = "0.15.0";
10166
10362
 
10167
10363
  exports.AbstractComponent = AbstractComponent;
10168
10364
  exports.ArcInfo = ArcInfo;