@visactor/vrender-components 0.17.0-alpha.8 → 0.17.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.
- package/cjs/axis/base.d.ts +2 -1
- package/cjs/axis/base.js +23 -12
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +9 -4
- package/cjs/axis/circle.js +8 -5
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/grid/base.js +2 -2
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/grid/circle.d.ts +2 -1
- package/cjs/axis/grid/circle.js +2 -2
- package/cjs/axis/grid/circle.js.map +1 -1
- package/cjs/axis/grid/line.d.ts +2 -1
- package/cjs/axis/grid/line.js +2 -3
- package/cjs/axis/grid/line.js.map +1 -1
- package/cjs/axis/line.d.ts +2 -1
- package/cjs/axis/line.js +39 -45
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.js +8 -7
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/overlap/auto-rotate.js +3 -35
- package/cjs/axis/overlap/auto-rotate.js.map +1 -1
- package/cjs/axis/overlap/util.d.ts +3 -0
- package/cjs/axis/overlap/util.js +44 -0
- package/cjs/axis/overlap/util.js.map +1 -0
- package/cjs/axis/type.d.ts +6 -6
- package/cjs/axis/type.js.map +1 -1
- package/cjs/axis/util.d.ts +8 -0
- package/cjs/axis/util.js +34 -0
- package/cjs/axis/util.js.map +1 -0
- package/cjs/brush/brush.d.ts +2 -1
- package/cjs/brush/brush.js +8 -4
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/brush/type.d.ts +2 -1
- package/cjs/brush/type.js.map +1 -1
- package/cjs/checkbox/checkbox.d.ts +4 -2
- package/cjs/checkbox/checkbox.js +26 -12
- package/cjs/checkbox/checkbox.js.map +1 -1
- package/cjs/checkbox/index.js +1 -2
- package/cjs/checkbox/type.d.ts +5 -1
- package/cjs/checkbox/type.js +2 -1
- package/cjs/checkbox/type.js.map +1 -1
- package/cjs/constant.d.ts +6 -0
- package/cjs/constant.js +6 -1
- package/cjs/constant.js.map +1 -1
- package/cjs/core/base.d.ts +4 -2
- package/cjs/core/base.js +9 -6
- package/cjs/core/base.js.map +1 -1
- package/cjs/core/type.d.ts +15 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/crosshair/circle.d.ts +2 -1
- package/cjs/crosshair/circle.js +2 -2
- package/cjs/crosshair/circle.js.map +1 -1
- package/cjs/crosshair/line.d.ts +2 -1
- package/cjs/crosshair/line.js +2 -2
- package/cjs/crosshair/line.js.map +1 -1
- package/cjs/crosshair/polygon.d.ts +2 -1
- package/cjs/crosshair/polygon.js +2 -2
- package/cjs/crosshair/polygon.js.map +1 -1
- package/cjs/crosshair/rect.d.ts +2 -1
- package/cjs/crosshair/rect.js +2 -2
- package/cjs/crosshair/rect.js.map +1 -1
- package/cjs/crosshair/sector.d.ts +2 -1
- package/cjs/crosshair/sector.js +2 -2
- package/cjs/crosshair/sector.js.map +1 -1
- package/cjs/data-zoom/config.d.ts +6 -6
- package/cjs/data-zoom/config.js +7 -7
- package/cjs/data-zoom/config.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +21 -11
- package/cjs/data-zoom/data-zoom.js +80 -64
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/type.d.ts +17 -5
- package/cjs/data-zoom/type.js +6 -1
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/config.js +1 -2
- package/cjs/indicator/index.js +2 -1
- package/cjs/indicator/indicator.js +43 -7
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +2 -1
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/interface.d.ts +5 -0
- package/cjs/interface.js.map +1 -1
- package/cjs/label/animate/animate.d.ts +8 -2
- package/cjs/label/animate/animate.js +37 -3
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/arc.d.ts +7 -6
- package/cjs/label/arc.js +5 -17
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/area.d.ts +15 -0
- package/cjs/label/area.js +41 -0
- package/cjs/label/area.js.map +1 -0
- package/cjs/label/base.d.ts +28 -18
- package/cjs/label/base.js +114 -61
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.d.ts +2 -1
- package/cjs/label/dataLabel.js +13 -8
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.d.ts +2 -0
- package/cjs/label/index.js +1 -0
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/line-data.d.ts +13 -0
- package/cjs/label/line-data.js +31 -0
- package/cjs/label/line-data.js.map +1 -0
- package/cjs/label/line.d.ts +4 -3
- package/cjs/label/line.js +8 -14
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/polygon.d.ts +2 -1
- package/cjs/label/polygon.js +3 -2
- package/cjs/label/polygon.js.map +1 -1
- package/cjs/label/rect.d.ts +2 -1
- package/cjs/label/rect.js +29 -3
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.d.ts +2 -1
- package/cjs/label/symbol.js +5 -44
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/label/type.d.ts +42 -8
- package/cjs/label/type.js +1 -2
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.d.ts +11 -1
- package/cjs/label/util.js +74 -1
- package/cjs/label/util.js.map +1 -1
- package/cjs/legend/color/color.d.ts +2 -1
- package/cjs/legend/color/color.js +6 -5
- package/cjs/legend/color/color.js.map +1 -1
- package/cjs/legend/constant.js +2 -1
- package/cjs/legend/discrete/discrete.d.ts +5 -1
- package/cjs/legend/discrete/discrete.js +74 -61
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +2 -0
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/legend/index.d.ts +1 -0
- package/cjs/legend/index.js +2 -1
- package/cjs/legend/index.js.map +1 -1
- package/cjs/legend/size/size.d.ts +2 -3
- package/cjs/legend/size/size.js +9 -17
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/legend/type.d.ts +1 -0
- package/cjs/legend/type.js.map +1 -1
- package/cjs/legend/util.d.ts +2 -0
- package/cjs/legend/util.js +13 -0
- package/cjs/legend/util.js.map +1 -0
- package/cjs/link-path/link-path.d.ts +2 -1
- package/cjs/link-path/link-path.js +3 -3
- package/cjs/link-path/link-path.js.map +1 -1
- package/cjs/link-path/type.js +1 -1
- package/cjs/marker/area.d.ts +8 -2
- package/cjs/marker/area.js +14 -3
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +1 -0
- package/cjs/marker/base.js +11 -7
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/line.d.ts +8 -1
- package/cjs/marker/line.js +15 -3
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +7 -4
- package/cjs/marker/point.js +8 -3
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +16 -16
- package/cjs/marker/type.js.map +1 -1
- package/cjs/pager/pager.d.ts +2 -1
- package/cjs/pager/pager.js +5 -5
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/pager/type.d.ts +1 -0
- package/cjs/pager/type.js.map +1 -1
- package/cjs/player/base-player.d.ts +2 -1
- package/cjs/player/base-player.js +7 -5
- package/cjs/player/base-player.js.map +1 -1
- package/cjs/player/continuous-player.js +2 -2
- package/cjs/player/continuous-player.js.map +1 -1
- package/cjs/player/controller/controller.d.ts +2 -1
- package/cjs/player/controller/controller.js +5 -5
- package/cjs/player/controller/controller.js.map +1 -1
- package/cjs/player/controller/type.d.ts +1 -0
- package/cjs/player/controller/type.js.map +1 -1
- package/cjs/player/discrete-player.d.ts +2 -1
- package/cjs/player/discrete-player.js +5 -5
- package/cjs/player/discrete-player.js.map +1 -1
- package/cjs/player/type/base.d.ts +1 -0
- package/cjs/player/type/base.js.map +1 -1
- package/cjs/poptip/poptip-plugin.d.ts +1 -0
- package/cjs/poptip/poptip-plugin.js +6 -3
- package/cjs/poptip/poptip-plugin.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +2 -1
- package/cjs/poptip/poptip.js +3 -3
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +6 -1
- package/cjs/scrollbar/scrollbar.js +40 -20
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/scrollbar/type.d.ts +5 -1
- package/cjs/scrollbar/type.js.map +1 -1
- package/cjs/segment/segment.d.ts +2 -1
- package/cjs/segment/segment.js +6 -4
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +6 -2
- package/cjs/segment/type.js.map +1 -1
- package/cjs/slider/slider.d.ts +2 -1
- package/cjs/slider/slider.js +29 -23
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/slider/type.d.ts +1 -0
- package/cjs/slider/type.js.map +1 -1
- package/cjs/tag/tag.d.ts +2 -1
- package/cjs/tag/tag.js +90 -43
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tag/type.d.ts +4 -5
- package/cjs/tag/type.js.map +1 -1
- package/cjs/title/title.d.ts +2 -1
- package/cjs/title/title.js +92 -59
- package/cjs/title/title.js.map +1 -1
- package/cjs/title/type.d.ts +10 -5
- package/cjs/title/type.js.map +1 -1
- package/cjs/tooltip/tooltip.d.ts +2 -1
- package/cjs/tooltip/tooltip.js +53 -15
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.d.ts +7 -2
- package/cjs/tooltip/type.js.map +1 -1
- package/cjs/tooltip/util.js +9 -1
- package/cjs/tooltip/util.js.map +1 -1
- package/cjs/util/label-smartInvert.d.ts +2 -2
- package/cjs/util/label-smartInvert.js +9 -5
- package/cjs/util/label-smartInvert.js.map +1 -1
- package/dist/index.js +10321 -8995
- package/dist/index.min.js +1 -1
- package/es/axis/base.d.ts +2 -1
- package/es/axis/base.js +25 -11
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +9 -4
- package/es/axis/circle.js +9 -4
- package/es/axis/circle.js.map +1 -1
- package/es/axis/grid/base.js +2 -2
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/grid/circle.d.ts +2 -1
- package/es/axis/grid/circle.js +2 -2
- package/es/axis/grid/circle.js.map +1 -1
- package/es/axis/grid/line.d.ts +2 -1
- package/es/axis/grid/line.js +2 -2
- package/es/axis/grid/line.js.map +1 -1
- package/es/axis/line.d.ts +2 -1
- package/es/axis/line.js +39 -45
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-hide.js +9 -6
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/overlap/auto-rotate.js +3 -33
- package/es/axis/overlap/auto-rotate.js.map +1 -1
- package/es/axis/overlap/util.d.ts +3 -0
- package/es/axis/overlap/util.js +35 -0
- package/es/axis/overlap/util.js.map +1 -0
- package/es/axis/type.d.ts +6 -6
- package/es/axis/type.js.map +1 -1
- package/es/axis/util.d.ts +8 -0
- package/es/axis/util.js +28 -0
- package/es/axis/util.js.map +1 -0
- package/es/brush/brush.d.ts +2 -1
- package/es/brush/brush.js +11 -7
- package/es/brush/brush.js.map +1 -1
- package/es/brush/type.d.ts +2 -1
- package/es/brush/type.js.map +1 -1
- package/es/checkbox/checkbox.d.ts +4 -2
- package/es/checkbox/checkbox.js +25 -10
- package/es/checkbox/checkbox.js.map +1 -1
- package/es/checkbox/index.js +1 -2
- package/es/checkbox/type.d.ts +5 -1
- package/es/checkbox/type.js +2 -1
- package/es/checkbox/type.js.map +1 -1
- package/es/constant.d.ts +6 -0
- package/es/constant.js +7 -0
- package/es/constant.js.map +1 -1
- package/es/core/base.d.ts +4 -2
- package/es/core/base.js +6 -4
- package/es/core/base.js.map +1 -1
- package/es/core/type.d.ts +15 -0
- package/es/core/type.js.map +1 -1
- package/es/crosshair/circle.d.ts +2 -1
- package/es/crosshair/circle.js +2 -2
- package/es/crosshair/circle.js.map +1 -1
- package/es/crosshair/line.d.ts +2 -1
- package/es/crosshair/line.js +2 -2
- package/es/crosshair/line.js.map +1 -1
- package/es/crosshair/polygon.d.ts +2 -1
- package/es/crosshair/polygon.js +2 -2
- package/es/crosshair/polygon.js.map +1 -1
- package/es/crosshair/rect.d.ts +2 -1
- package/es/crosshair/rect.js +2 -2
- package/es/crosshair/rect.js.map +1 -1
- package/es/crosshair/sector.d.ts +2 -1
- package/es/crosshair/sector.js +2 -2
- package/es/crosshair/sector.js.map +1 -1
- package/es/data-zoom/config.d.ts +6 -6
- package/es/data-zoom/config.js +6 -7
- package/es/data-zoom/config.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +21 -11
- package/es/data-zoom/data-zoom.js +77 -58
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/type.d.ts +17 -5
- package/es/data-zoom/type.js +6 -1
- package/es/data-zoom/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/config.js +1 -2
- package/es/indicator/index.js +2 -1
- package/es/indicator/indicator.js +44 -6
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +2 -1
- package/es/indicator/type.js.map +1 -1
- package/es/interface.d.ts +5 -0
- package/es/interface.js.map +1 -1
- package/es/label/animate/animate.d.ts +8 -2
- package/es/label/animate/animate.js +35 -0
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/arc.d.ts +7 -6
- package/es/label/arc.js +5 -17
- package/es/label/arc.js.map +1 -1
- package/es/label/area.d.ts +15 -0
- package/es/label/area.js +39 -0
- package/es/label/area.js.map +1 -0
- package/es/label/base.d.ts +28 -18
- package/es/label/base.js +116 -61
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.d.ts +2 -1
- package/es/label/dataLabel.js +18 -7
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.d.ts +2 -0
- package/es/label/index.js +4 -0
- package/es/label/index.js.map +1 -1
- package/es/label/line-data.d.ts +13 -0
- package/es/label/line-data.js +29 -0
- package/es/label/line-data.js.map +1 -0
- package/es/label/line.d.ts +4 -3
- package/es/label/line.js +9 -13
- package/es/label/line.js.map +1 -1
- package/es/label/polygon.d.ts +2 -1
- package/es/label/polygon.js +3 -2
- package/es/label/polygon.js.map +1 -1
- package/es/label/rect.d.ts +2 -1
- package/es/label/rect.js +29 -3
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.d.ts +2 -1
- package/es/label/symbol.js +6 -43
- package/es/label/symbol.js.map +1 -1
- package/es/label/type.d.ts +42 -8
- package/es/label/type.js +1 -2
- package/es/label/type.js.map +1 -1
- package/es/label/util.d.ts +11 -1
- package/es/label/util.js +69 -0
- package/es/label/util.js.map +1 -1
- package/es/legend/color/color.d.ts +2 -1
- package/es/legend/color/color.js +7 -6
- package/es/legend/color/color.js.map +1 -1
- package/es/legend/constant.js +2 -1
- package/es/legend/discrete/discrete.d.ts +5 -1
- package/es/legend/discrete/discrete.js +73 -59
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +2 -0
- package/es/legend/discrete/type.js.map +1 -1
- package/es/legend/index.d.ts +1 -0
- package/es/legend/index.js +2 -0
- package/es/legend/index.js.map +1 -1
- package/es/legend/size/size.d.ts +2 -3
- package/es/legend/size/size.js +8 -12
- package/es/legend/size/size.js.map +1 -1
- package/es/legend/type.d.ts +1 -0
- package/es/legend/type.js.map +1 -1
- package/es/legend/util.d.ts +2 -0
- package/es/legend/util.js +7 -0
- package/es/legend/util.js.map +1 -0
- package/es/link-path/link-path.d.ts +2 -1
- package/es/link-path/link-path.js +3 -3
- package/es/link-path/link-path.js.map +1 -1
- package/es/link-path/type.js +1 -1
- package/es/marker/area.d.ts +8 -2
- package/es/marker/area.js +14 -3
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +1 -0
- package/es/marker/base.js +11 -7
- package/es/marker/base.js.map +1 -1
- package/es/marker/line.d.ts +8 -1
- package/es/marker/line.js +15 -3
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +7 -4
- package/es/marker/point.js +8 -3
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +16 -16
- package/es/marker/type.js.map +1 -1
- package/es/pager/pager.d.ts +2 -1
- package/es/pager/pager.js +5 -5
- package/es/pager/pager.js.map +1 -1
- package/es/pager/type.d.ts +1 -0
- package/es/pager/type.js.map +1 -1
- package/es/player/base-player.d.ts +2 -1
- package/es/player/base-player.js +7 -5
- package/es/player/base-player.js.map +1 -1
- package/es/player/continuous-player.js +2 -2
- package/es/player/continuous-player.js.map +1 -1
- package/es/player/controller/controller.d.ts +2 -1
- package/es/player/controller/controller.js +5 -5
- package/es/player/controller/controller.js.map +1 -1
- package/es/player/controller/type.d.ts +1 -0
- package/es/player/controller/type.js.map +1 -1
- package/es/player/discrete-player.d.ts +2 -1
- package/es/player/discrete-player.js +5 -4
- package/es/player/discrete-player.js.map +1 -1
- package/es/player/type/base.d.ts +1 -0
- package/es/player/type/base.js.map +1 -1
- package/es/poptip/poptip-plugin.d.ts +1 -0
- package/es/poptip/poptip-plugin.js +6 -3
- package/es/poptip/poptip-plugin.js.map +1 -1
- package/es/poptip/poptip.d.ts +2 -1
- package/es/poptip/poptip.js +3 -2
- package/es/poptip/poptip.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +6 -1
- package/es/scrollbar/scrollbar.js +42 -20
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/scrollbar/type.d.ts +5 -1
- package/es/scrollbar/type.js.map +1 -1
- package/es/segment/segment.d.ts +2 -1
- package/es/segment/segment.js +7 -5
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +6 -2
- package/es/segment/type.js.map +1 -1
- package/es/slider/slider.d.ts +2 -1
- package/es/slider/slider.js +29 -23
- package/es/slider/slider.js.map +1 -1
- package/es/slider/type.d.ts +1 -0
- package/es/slider/type.js.map +1 -1
- package/es/tag/tag.d.ts +2 -1
- package/es/tag/tag.js +89 -40
- package/es/tag/tag.js.map +1 -1
- package/es/tag/type.d.ts +4 -5
- package/es/tag/type.js.map +1 -1
- package/es/title/title.d.ts +2 -1
- package/es/title/title.js +91 -55
- package/es/title/title.js.map +1 -1
- package/es/title/type.d.ts +10 -5
- package/es/title/type.js.map +1 -1
- package/es/tooltip/tooltip.d.ts +2 -1
- package/es/tooltip/tooltip.js +55 -15
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.d.ts +7 -2
- package/es/tooltip/type.js.map +1 -1
- package/es/tooltip/util.js +9 -1
- package/es/tooltip/util.js.map +1 -1
- package/es/util/label-smartInvert.d.ts +2 -2
- package/es/util/label-smartInvert.js +9 -5
- package/es/util/label-smartInvert.js.map +1 -1
- package/package.json +8 -8
package/cjs/label/base.d.ts
CHANGED
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
import type { IGroup, IGraphic, IText, ILine } from '@visactor/vrender-core';
|
|
2
|
-
import type { IAABBBounds, IBoundsLike } from '@visactor/vutils';
|
|
1
|
+
import type { IGroup, IGraphic, IText, ILine, IRichText } from '@visactor/vrender-core';
|
|
2
|
+
import type { IAABBBounds, IBoundsLike, IPointLike } from '@visactor/vutils';
|
|
3
3
|
import { AbstractComponent } from '../core/base';
|
|
4
4
|
import type { PointLocationCfg } from '../core/type';
|
|
5
5
|
import type { Bitmap } from './overlap';
|
|
6
6
|
import { bitmapTool } from './overlap';
|
|
7
|
-
import type { BaseLabelAttrs, ILabelAnimation, LabelItem } from './type';
|
|
7
|
+
import type { BaseLabelAttrs, ILabelAnimation, LabelItem, ILabelEnterAnimation, ILabelExitAnimation, ILabelUpdateAnimation } from './type';
|
|
8
|
+
import type { ComponentOptions } from '../interface';
|
|
8
9
|
export declare class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {
|
|
9
10
|
name: string;
|
|
10
11
|
protected _baseMarks?: IGraphic[];
|
|
12
|
+
protected _isCollectionBase: boolean;
|
|
11
13
|
protected _bitmap?: Bitmap;
|
|
14
|
+
protected _animationConfig?: {
|
|
15
|
+
enter: ILabelEnterAnimation;
|
|
16
|
+
exit: ILabelExitAnimation;
|
|
17
|
+
update: ILabelUpdateAnimation;
|
|
18
|
+
};
|
|
12
19
|
static defaultAttributes: Partial<BaseLabelAttrs>;
|
|
13
20
|
setBitmap(bitmap: Bitmap): void;
|
|
14
21
|
protected _bmpTool?: ReturnType<typeof bitmapTool>;
|
|
15
22
|
setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>): void;
|
|
16
23
|
protected _graphicToText: Map<IGraphic, {
|
|
17
|
-
text: IText;
|
|
24
|
+
text: IText | IRichText;
|
|
18
25
|
labelLine?: ILine;
|
|
19
26
|
}>;
|
|
20
27
|
protected _idToGraphic: Map<string, IGraphic>;
|
|
28
|
+
protected _idToPoint: Map<string, IPointLike>;
|
|
21
29
|
onAfterLabelOverlap?: (bitmap: Bitmap) => void;
|
|
22
30
|
private _lastHover;
|
|
23
31
|
private _lastSelect;
|
|
24
32
|
private _enableAnimation;
|
|
25
|
-
constructor(attributes: BaseLabelAttrs);
|
|
33
|
+
constructor(attributes: BaseLabelAttrs, options?: ComponentOptions);
|
|
26
34
|
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: BaseLabelAttrs['position'], offset?: number): {
|
|
27
35
|
x: number;
|
|
28
36
|
y: number;
|
|
29
37
|
} | undefined;
|
|
30
|
-
protected _labelLine(text:
|
|
38
|
+
protected _labelLine(text: LabelItem): ILine | undefined;
|
|
31
39
|
protected render(): void;
|
|
32
40
|
private _bindEvent;
|
|
33
|
-
private
|
|
41
|
+
private _setStatesOfText;
|
|
42
|
+
private _setStatesOfLabelLine;
|
|
34
43
|
private _onHover;
|
|
35
44
|
private _onUnHover;
|
|
36
45
|
private _onClick;
|
|
37
|
-
protected _createLabelText(attributes: LabelItem): IText;
|
|
46
|
+
protected _createLabelText(attributes: LabelItem): IRichText | IText;
|
|
38
47
|
private _prepare;
|
|
39
|
-
protected
|
|
40
|
-
protected
|
|
48
|
+
protected getRelatedGrphic(item: LabelItem): IGraphic<Partial<import("@visactor/vrender-core").IGraphicAttribute>>;
|
|
49
|
+
protected _layout(data?: LabelItem[]): (IText | IRichText)[];
|
|
50
|
+
protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
|
|
41
51
|
protected getBaseMarkGroup(): IGroup;
|
|
42
|
-
protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg
|
|
43
|
-
protected _renderLabels(labels: IText[]): void;
|
|
44
|
-
protected _renderWithAnimation(labels: IText[]): void;
|
|
45
|
-
protected _renderWithOutAnimation(labels: IText[]): void;
|
|
46
|
-
protected
|
|
47
|
-
|
|
48
|
-
}): (event: any) => {};
|
|
49
|
-
protected _smartInvert(labels: IText[]): void;
|
|
52
|
+
protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
|
|
53
|
+
protected _renderLabels(labels: (IText | IRichText)[]): void;
|
|
54
|
+
protected _renderWithAnimation(labels: (IText | IRichText)[]): void;
|
|
55
|
+
protected _renderWithOutAnimation(labels: (IText | IRichText)[]): void;
|
|
56
|
+
protected _handleRelatedGraphicSetState: (e: any) => void;
|
|
57
|
+
protected _syncStateWithRelatedGraphic(relatedGraphic: IGraphic): void;
|
|
58
|
+
protected _afterRelatedGraphicAttributeUpdate(text: IText | IRichText, texts: (IText | IRichText)[], index: number, relatedGraphic: IGraphic, to: any, { mode, duration, easing, delay }: ILabelAnimation): (event: any) => {};
|
|
59
|
+
protected _smartInvert(labels: (IText | IRichText)[]): void;
|
|
50
60
|
protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds): boolean;
|
|
51
61
|
setLocation(point: PointLocationCfg): void;
|
|
52
62
|
disableAnimation(): void;
|
package/cjs/label/base.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.LabelBase = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), label_smartInvert_1 = require("../util/label-smartInvert"), util_1 = require("../util"), constant_1 = require("../constant"), overlap_1 = require("./overlap"), animate_1 = require("./animate/animate");
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), label_smartInvert_1 = require("../util/label-smartInvert"), util_1 = require("../util"), constant_1 = require("../constant"), overlap_1 = require("./overlap"), animate_1 = require("./animate/animate"), util_2 = require("./util"), constant_2 = require("../constant");
|
|
8
8
|
|
|
9
9
|
class LabelBase extends base_1.AbstractComponent {
|
|
10
10
|
setBitmap(bitmap) {
|
|
@@ -13,9 +13,9 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
13
13
|
setBitmapTool(bmpTool) {
|
|
14
14
|
this._bmpTool = bmpTool;
|
|
15
15
|
}
|
|
16
|
-
constructor(attributes) {
|
|
17
|
-
super((0, vutils_1.merge)({}, LabelBase.defaultAttributes, attributes)),
|
|
18
|
-
this._onHover = e => {
|
|
16
|
+
constructor(attributes, options) {
|
|
17
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, LabelBase.defaultAttributes, attributes)),
|
|
18
|
+
this.name = "label", this._onHover = e => {
|
|
19
19
|
const target = e.target;
|
|
20
20
|
target === this._lastHover || (0, vutils_1.isEmpty)(target.states) || (target.addState(constant_1.StateValue.hover, !0),
|
|
21
21
|
(0, util_1.traverseGroup)(this, (node => {
|
|
@@ -37,62 +37,113 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
37
37
|
(0, util_1.traverseGroup)(this, (node => {
|
|
38
38
|
node === target || (0, vutils_1.isEmpty)(node.states) || node.addState(constant_1.StateValue.selectedReverse, !0);
|
|
39
39
|
})), this._lastSelect = target);
|
|
40
|
+
}, this._handleRelatedGraphicSetState = e => {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
if ((null === (_a = e.detail) || void 0 === _a ? void 0 : _a.type) === vrender_core_1.AttributeUpdateType.STATE) {
|
|
43
|
+
const currentStates = null !== (_c = null === (_b = e.target) || void 0 === _b ? void 0 : _b.currentStates) && void 0 !== _c ? _c : [];
|
|
44
|
+
(this._isCollectionBase ? [ ...this._graphicToText.values() ] : [ this._graphicToText.get(e.target) ]).forEach((label => {
|
|
45
|
+
label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
40
48
|
};
|
|
41
49
|
}
|
|
42
50
|
labeling(textBounds, graphicBounds, position, offset) {}
|
|
43
51
|
_labelLine(text) {}
|
|
44
52
|
render() {
|
|
45
|
-
if (this._prepare(), (0, vutils_1.isNil)(this._idToGraphic)
|
|
53
|
+
if (this._prepare(), (0, vutils_1.isNil)(this._idToGraphic) || this._isCollectionBase && (0,
|
|
54
|
+
vutils_1.isNil)(this._idToPoint)) return;
|
|
46
55
|
const {overlap: overlap, smartInvert: smartInvert, dataFilter: dataFilter, customLayoutFunc: customLayoutFunc, customOverlapFunc: customOverlapFunc} = this.attribute;
|
|
47
56
|
let labels, data = this.attribute.data;
|
|
48
57
|
(0, vutils_1.isFunction)(dataFilter) && (data = dataFilter(data)), labels = (0,
|
|
49
|
-
vutils_1.isFunction)(customLayoutFunc) ? customLayoutFunc(data,
|
|
50
|
-
(0, vutils_1.isFunction)(customOverlapFunc) ? labels = customOverlapFunc(labels,
|
|
58
|
+
vutils_1.isFunction)(customLayoutFunc) ? customLayoutFunc(data, this.getRelatedGrphic, this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(data),
|
|
59
|
+
(0, vutils_1.isFunction)(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGrphic, this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : !1 !== overlap && (labels = this._overlapping(labels)),
|
|
51
60
|
!1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
|
|
52
61
|
}
|
|
53
62
|
_bindEvent(target) {
|
|
63
|
+
if (this.attribute.disableTriggerEvent) return;
|
|
54
64
|
if (!target) return;
|
|
55
65
|
const {hover: hover, select: select} = this.attribute;
|
|
56
66
|
hover && (target.addEventListener("pointermove", this._onHover), target.addEventListener("pointerout", this._onUnHover)),
|
|
57
67
|
select && target.addEventListener("pointerdown", this._onClick);
|
|
58
68
|
}
|
|
59
|
-
|
|
69
|
+
_setStatesOfText(target) {
|
|
60
70
|
if (!target) return;
|
|
61
71
|
const state = this.attribute.state;
|
|
62
72
|
state && !(0, vutils_1.isEmpty)(state) && (target.states = state);
|
|
63
73
|
}
|
|
74
|
+
_setStatesOfLabelLine(target) {
|
|
75
|
+
if (!target) return;
|
|
76
|
+
const state = this.attribute.labelLineState;
|
|
77
|
+
state && !(0, vutils_1.isEmpty)(state) && (target.states = state);
|
|
78
|
+
}
|
|
64
79
|
_createLabelText(attributes) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
if ("rich" === attributes.textType) {
|
|
82
|
+
attributes.textConfig = attributes.text, attributes.width = null !== (_a = attributes.width) && void 0 !== _a ? _a : 0,
|
|
83
|
+
attributes.height = null !== (_b = attributes.height) && void 0 !== _b ? _b : 0;
|
|
84
|
+
const text = (0, vrender_core_1.createRichText)(attributes);
|
|
85
|
+
return this._bindEvent(text), this._setStatesOfText(text), text;
|
|
86
|
+
}
|
|
87
|
+
if ("html" === attributes.textType) {
|
|
88
|
+
attributes.textConfig = [], attributes.html = Object.assign(Object.assign({
|
|
89
|
+
dom: attributes.text
|
|
90
|
+
}, constant_2.DEFAULT_HTML_TEXT_SPEC), attributes);
|
|
91
|
+
const text = (0, vrender_core_1.createRichText)(attributes);
|
|
92
|
+
return this._bindEvent(text), this._setStatesOfText(text), text;
|
|
93
|
+
}
|
|
65
94
|
const text = (0, vrender_core_1.createText)(attributes);
|
|
66
|
-
return this._bindEvent(text), this.
|
|
95
|
+
return this._bindEvent(text), this._setStatesOfText(text), text;
|
|
67
96
|
}
|
|
68
97
|
_prepare() {
|
|
69
|
-
var _a;
|
|
98
|
+
var _a, _b, _c, _d, _e;
|
|
70
99
|
const currentBaseMarks = [];
|
|
71
100
|
let baseMarks;
|
|
72
101
|
if (baseMarks = (0, vutils_1.isFunction)(this.attribute.getBaseMarks) ? this.attribute.getBaseMarks() : (0,
|
|
73
102
|
util_1.getMarksByName)(this.getRootNode(), this.attribute.baseMarkGroupName), baseMarks.forEach((mark => {
|
|
74
103
|
"willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
|
|
75
|
-
})), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), this.
|
|
104
|
+
})), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), null === (_b = this._idToPoint) || void 0 === _b || _b.clear(),
|
|
105
|
+
this._baseMarks = currentBaseMarks, this._isCollectionBase = "line-data" === this.attribute.type,
|
|
76
106
|
!currentBaseMarks || 0 === currentBaseMarks.length) return;
|
|
77
107
|
const {data: data} = this.attribute;
|
|
78
108
|
if (data && 0 !== data.length) {
|
|
79
|
-
this._idToGraphic || (this._idToGraphic = new Map)
|
|
80
|
-
|
|
109
|
+
if (this._idToGraphic || (this._idToGraphic = new Map), this._isCollectionBase) {
|
|
110
|
+
this._idToPoint || (this._idToPoint = new Map);
|
|
111
|
+
let cur = 0;
|
|
112
|
+
for (let i = 0; i < currentBaseMarks.length; i++) {
|
|
113
|
+
const baseMark = currentBaseMarks[i], points = (0, util_2.getPointsOfLineArea)(baseMark);
|
|
114
|
+
if (null == points ? void 0 : points.length) for (let j = 0; j < points.length; j++) {
|
|
115
|
+
const textData = data[cur];
|
|
116
|
+
textData && points[j] && ((0, vutils_1.isValid)(textData.id) || (textData.id = `vrender-component-${this.name}-${cur}`),
|
|
117
|
+
this._idToPoint.set(textData.id, points[j]), this._idToGraphic.set(textData.id, baseMark)),
|
|
118
|
+
cur++;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else for (let i = 0; i < currentBaseMarks.length; i++) {
|
|
81
122
|
const textData = data[i], baseMark = currentBaseMarks[i];
|
|
82
123
|
textData && baseMark && ((0, vutils_1.isValid)(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`),
|
|
83
124
|
this._idToGraphic.set(textData.id, baseMark));
|
|
84
125
|
}
|
|
126
|
+
!1 !== this.attribute.animation && (this._animationConfig = {
|
|
127
|
+
enter: (0, vutils_1.merge)({}, animate_1.DefaultLabelAnimation, this.attribute.animation, null !== (_c = this.attribute.animationEnter) && void 0 !== _c ? _c : {}),
|
|
128
|
+
exit: (0, vutils_1.merge)({}, animate_1.DefaultLabelAnimation, this.attribute.animation, null !== (_d = this.attribute.animationExit) && void 0 !== _d ? _d : {}),
|
|
129
|
+
update: (0, vutils_1.isArray)(this.attribute.animationUpdate) ? this.attribute.animationUpdate : (0,
|
|
130
|
+
vutils_1.merge)({}, animate_1.DefaultLabelAnimation, this.attribute.animation, null !== (_e = this.attribute.animationUpdate) && void 0 !== _e ? _e : {})
|
|
131
|
+
});
|
|
85
132
|
}
|
|
86
133
|
}
|
|
134
|
+
getRelatedGrphic(item) {
|
|
135
|
+
return this._idToGraphic.get(item.id);
|
|
136
|
+
}
|
|
87
137
|
_layout(data = []) {
|
|
88
138
|
const {textStyle: textStyle = {}, position: position, offset: offset} = this.attribute, labels = [];
|
|
89
139
|
for (let i = 0; i < data.length; i++) {
|
|
90
|
-
const textData = data[i], baseMark = this.
|
|
91
|
-
fill: baseMark.attribute.fill
|
|
92
|
-
}, textStyle), textData), text = this._createLabelText(labelAttribute), textBounds = this.getGraphicBounds(text),
|
|
140
|
+
const textData = data[i], baseMark = this.getRelatedGrphic(textData), labelAttribute = Object.assign(Object.assign({
|
|
141
|
+
fill: this._isCollectionBase ? (0, vutils_1.isArray)(baseMark.attribute.stroke) ? baseMark.attribute.stroke.find((entry => !!entry && !0 !== entry)) : baseMark.attribute.stroke : baseMark.attribute.fill
|
|
142
|
+
}, textStyle), textData), text = this._createLabelText(labelAttribute), textBounds = this.getGraphicBounds(text), actualPosition = (0,
|
|
143
|
+
vutils_1.isFunction)(position) ? position(textData) : position, graphicBounds = this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(textData.id), actualPosition) : this.getGraphicBounds(baseMark, {
|
|
93
144
|
x: textData.x,
|
|
94
145
|
y: textData.y
|
|
95
|
-
}), textLocation = this.labeling(textBounds, graphicBounds,
|
|
146
|
+
}, actualPosition), textLocation = this.labeling(textBounds, graphicBounds, actualPosition, offset);
|
|
96
147
|
textLocation && (labelAttribute.x = textLocation.x, labelAttribute.y = textLocation.y,
|
|
97
148
|
text.setAttributes(textLocation)), labels.push(text);
|
|
98
149
|
}
|
|
@@ -117,7 +168,7 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
117
168
|
}));
|
|
118
169
|
for (let i = 0; i < labels.length; i++) {
|
|
119
170
|
if (!1 === labels[i].visible) continue;
|
|
120
|
-
const text = labels[i], baseMark = this.
|
|
171
|
+
const text = labels[i], baseMark = this.getRelatedGrphic(text.attribute);
|
|
121
172
|
if (text.update(), !(0, vutils_1.isRectIntersect)(baseMark.AABBBounds, {
|
|
122
173
|
x1: 0,
|
|
123
174
|
x2: bmpTool.width,
|
|
@@ -135,7 +186,7 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
135
186
|
}
|
|
136
187
|
}
|
|
137
188
|
let hasPlace = !1;
|
|
138
|
-
for (let j = 0; j < strategy.length; j++) if (hasPlace = (0, overlap_1.place)(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling),
|
|
189
|
+
for (let j = 0; j < strategy.length; j++) if (hasPlace = (0, overlap_1.place)(bmpTool, bitmap, strategy[j], this.attribute, text, this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(labels[i].attribute.id)) : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling),
|
|
139
190
|
!1 !== hasPlace) {
|
|
140
191
|
text.setAttributes({
|
|
141
192
|
x: hasPlace.x,
|
|
@@ -145,12 +196,17 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
145
196
|
}
|
|
146
197
|
if (!hasPlace && clampForce) {
|
|
147
198
|
const {dx: dx = 0, dy: dy = 0} = (0, overlap_1.clampText)(text, bmpTool.width, bmpTool.height);
|
|
148
|
-
if (
|
|
199
|
+
if (0 === dx && 0 === dy) {
|
|
200
|
+
if ((0, overlap_1.canPlace)(bmpTool, bitmap, text.AABBBounds)) {
|
|
201
|
+
bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
} else if ((0, overlap_1.canPlace)(bmpTool, bitmap, {
|
|
149
205
|
x1: text.AABBBounds.x1 + dx,
|
|
150
206
|
x2: text.AABBBounds.x2 + dx,
|
|
151
207
|
y1: text.AABBBounds.y1 + dy,
|
|
152
208
|
y2: text.AABBBounds.y2 + dy
|
|
153
|
-
}
|
|
209
|
+
})) {
|
|
154
210
|
text.setAttributes({
|
|
155
211
|
x: text.attribute.x + dx,
|
|
156
212
|
y: text.attribute.y + dy
|
|
@@ -180,49 +236,38 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
180
236
|
!1 === this._enableAnimation || !1 === this.attribute.animation ? this._renderWithOutAnimation(labels) : this._renderWithAnimation(labels);
|
|
181
237
|
}
|
|
182
238
|
_renderWithAnimation(labels) {
|
|
183
|
-
|
|
184
|
-
const animationConfig = null !== (_a = this.attribute.animation) && void 0 !== _a ? _a : {}, mode = null !== (_b = animationConfig.mode) && void 0 !== _b ? _b : animate_1.DefaultLabelAnimation.mode, duration = null !== (_c = animationConfig.duration) && void 0 !== _c ? _c : animate_1.DefaultLabelAnimation.duration, easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : animate_1.DefaultLabelAnimation.easing, delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0, currentTextMap = new Map, prevTextMap = this._graphicToText || new Map, texts = [];
|
|
239
|
+
const currentTextMap = new Map, prevTextMap = this._graphicToText || new Map, texts = [];
|
|
185
240
|
labels.forEach(((text, index) => {
|
|
186
241
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
187
|
-
const labelLine = this._labelLine(text), relatedGraphic = this.
|
|
242
|
+
const labelLine = this._labelLine(text), relatedGraphic = this.getRelatedGrphic(text.attribute), textId = text.attribute.id, textKey = this._isCollectionBase ? textId : relatedGraphic, state = (null == prevTextMap ? void 0 : prevTextMap.get(textKey)) ? "update" : "enter";
|
|
188
243
|
if ("enter" === state) {
|
|
189
|
-
if (texts.push(text), currentTextMap.set(
|
|
244
|
+
if (texts.push(text), currentTextMap.set(textKey, labelLine ? {
|
|
190
245
|
text: text,
|
|
191
246
|
labelLine: labelLine
|
|
192
247
|
} : {
|
|
193
248
|
text: text
|
|
194
249
|
}), relatedGraphic) {
|
|
195
250
|
const {from: from, to: to} = (0, animate_1.getAnimationAttributes)(text.attribute, "fadeIn");
|
|
196
|
-
this.add(text), labelLine && this.
|
|
251
|
+
this.add(text), labelLine && (this._setStatesOfLabelLine(labelLine), this.add(labelLine)),
|
|
252
|
+
this._syncStateWithRelatedGraphic(relatedGraphic), relatedGraphic.once("animate-bind", (a => {
|
|
197
253
|
text.setAttributes(from);
|
|
198
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic,
|
|
199
|
-
mode: mode,
|
|
200
|
-
duration: duration,
|
|
201
|
-
easing: easing,
|
|
202
|
-
to: to,
|
|
203
|
-
delay: delay
|
|
204
|
-
});
|
|
254
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
|
|
205
255
|
relatedGraphic.on("afterAttributeUpdate", listener);
|
|
206
256
|
}));
|
|
207
257
|
}
|
|
208
258
|
} else if ("update" === state) {
|
|
209
|
-
const prevLabel = prevTextMap.get(
|
|
210
|
-
prevTextMap.delete(
|
|
211
|
-
const prevText = prevLabel.text;
|
|
212
|
-
|
|
259
|
+
const prevLabel = prevTextMap.get(textKey);
|
|
260
|
+
prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel);
|
|
261
|
+
const prevText = prevLabel.text, {duration: duration, easing: easing} = this._animationConfig.update;
|
|
262
|
+
(0, animate_1.updateAnimation)(prevText, text, this._animationConfig.update), prevLabel.labelLine && prevLabel.labelLine.animate().to((0,
|
|
213
263
|
vutils_1.merge)({}, prevLabel.labelLine.attribute, {
|
|
214
264
|
visible: null === (_f = null !== (_d = (null === (_b = null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.line) || void 0 === _b ? void 0 : _b.visible) && (null === (_c = text.attribute) || void 0 === _c ? void 0 : _c.visible)) && void 0 !== _d ? _d : null === (_e = text.attribute) || void 0 === _e ? void 0 : _e.visible) || void 0 === _f || _f,
|
|
215
265
|
points: null === (_g = text.attribute) || void 0 === _g ? void 0 : _g.points
|
|
216
|
-
}), duration, easing)
|
|
217
|
-
vutils_1.isValidNumber)(Number(prevText.attribute.text) * Number(text.attribute.text)) && prevText.animate().play(new vrender_core_1.IncreaseCount({
|
|
218
|
-
text: prevText.attribute.text
|
|
219
|
-
}, {
|
|
220
|
-
text: text.attribute.text
|
|
221
|
-
}, duration, easing));
|
|
266
|
+
}), duration, easing);
|
|
222
267
|
}
|
|
223
268
|
})), prevTextMap.forEach((label => {
|
|
224
269
|
var _a;
|
|
225
|
-
null === (_a = label.text) || void 0 === _a || _a.animate().to((0, animate_1.getAnimationAttributes)(label.text.attribute, "fadeOut").to, duration, easing).onEnd((() => {
|
|
270
|
+
null === (_a = label.text) || void 0 === _a || _a.animate().to((0, animate_1.getAnimationAttributes)(label.text.attribute, "fadeOut").to, this._animationConfig.exit.duration, this._animationConfig.exit.easing).onEnd((() => {
|
|
226
271
|
this.removeChild(label.text), (null == label ? void 0 : label.labelLine) && this.removeChild(label.labelLine);
|
|
227
272
|
}));
|
|
228
273
|
})), this._graphicToText = currentTextMap;
|
|
@@ -231,16 +276,16 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
231
276
|
const currentTextMap = new Map, prevTextMap = this._graphicToText || new Map, texts = [];
|
|
232
277
|
labels.forEach((text => {
|
|
233
278
|
var _a;
|
|
234
|
-
const labelLine = this._labelLine(text), relatedGraphic = this.
|
|
235
|
-
if ("enter" === state) texts.push(text), currentTextMap.set(
|
|
279
|
+
const labelLine = this._labelLine(text), relatedGraphic = this.getRelatedGrphic(text.attribute), state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter", textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
|
|
280
|
+
if ("enter" === state) texts.push(text), currentTextMap.set(textKey, labelLine ? {
|
|
236
281
|
text: text,
|
|
237
282
|
labelLine: labelLine
|
|
238
283
|
} : {
|
|
239
284
|
text: text
|
|
240
|
-
}), this.add(text), labelLine && this.add(labelLine); else if ("update" === state) {
|
|
241
|
-
const prevLabel = prevTextMap.get(
|
|
242
|
-
prevTextMap.delete(
|
|
243
|
-
|
|
285
|
+
}), this.add(text), labelLine && this.add(labelLine), this._syncStateWithRelatedGraphic(relatedGraphic); else if ("update" === state) {
|
|
286
|
+
const prevLabel = prevTextMap.get(textKey);
|
|
287
|
+
prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel), prevLabel.text.setAttributes(text.attribute),
|
|
288
|
+
(null == prevLabel ? void 0 : prevLabel.labelLine) && prevLabel.labelLine.setAttributes({
|
|
244
289
|
points: null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.points
|
|
245
290
|
});
|
|
246
291
|
}
|
|
@@ -248,34 +293,42 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
248
293
|
this.removeChild(label.text), (null == label ? void 0 : label.labelLine) && this.removeChild(label.labelLine);
|
|
249
294
|
})), this._graphicToText = currentTextMap;
|
|
250
295
|
}
|
|
251
|
-
|
|
296
|
+
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
297
|
+
this.attribute.syncState && relatedGraphic.on("afterAttributeUpdate", this._handleRelatedGraphicSetState);
|
|
298
|
+
}
|
|
299
|
+
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, {mode: mode, duration: duration, easing: easing, delay: delay}) {
|
|
252
300
|
const listener = event => {
|
|
253
|
-
var _a;
|
|
301
|
+
var _a, _b;
|
|
254
302
|
const {detail: detail} = event;
|
|
255
303
|
if (!detail) return {};
|
|
256
304
|
if (!(detail && detail.type === vrender_core_1.AttributeUpdateType.ANIMATE_UPDATE && detail.animationState && "wait" !== (null === (_a = detail.animationState.step) || void 0 === _a ? void 0 : _a.type))) return {};
|
|
257
305
|
if (detail.type === vrender_core_1.AttributeUpdateType.ANIMATE_END) return void text.setAttributes(to);
|
|
258
|
-
const
|
|
306
|
+
const onStart = () => {
|
|
259
307
|
relatedGraphic && (relatedGraphic.onAnimateBind = void 0, relatedGraphic.removeEventListener("afterAttributeUpdate", listener));
|
|
260
308
|
};
|
|
261
309
|
switch (mode) {
|
|
262
310
|
case "after":
|
|
263
311
|
detail.animationState.end && text.animate({
|
|
264
|
-
|
|
312
|
+
onStart: onStart
|
|
265
313
|
}).wait(delay).to(to, duration, easing);
|
|
266
314
|
break;
|
|
267
315
|
|
|
268
316
|
case "after-all":
|
|
269
317
|
index === texts.length - 1 && detail.animationState.end && texts.forEach((t => {
|
|
270
318
|
t.animate({
|
|
271
|
-
|
|
319
|
+
onStart: onStart
|
|
272
320
|
}).wait(delay).to(to, duration, easing);
|
|
273
321
|
}));
|
|
274
322
|
break;
|
|
275
323
|
|
|
276
324
|
default:
|
|
277
|
-
|
|
278
|
-
|
|
325
|
+
if (this._isCollectionBase) {
|
|
326
|
+
const point = this._idToPoint.get(text.attribute.id);
|
|
327
|
+
!point || text.animates && text.animates.has("label-animate") || !relatedGraphic.containsPoint(point.x, point.y, vrender_core_1.IContainPointMode.LOCAL, null === (_b = this.stage) || void 0 === _b ? void 0 : _b.pickerService) || text.animate({
|
|
328
|
+
onStart: onStart
|
|
329
|
+
}).wait(delay).to(to, duration, easing);
|
|
330
|
+
} else detail.animationState.isFirstFrameOfStep && text.animate({
|
|
331
|
+
onStart: onStart
|
|
279
332
|
}).wait(delay).to(to, duration, easing);
|
|
280
333
|
}
|
|
281
334
|
};
|
|
@@ -283,12 +336,12 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
283
336
|
}
|
|
284
337
|
_smartInvert(labels) {
|
|
285
338
|
var _a, _b, _c, _d, _e;
|
|
286
|
-
const option = this.attribute.smartInvert || {}, {textType: textType, contrastRatiosThreshold: contrastRatiosThreshold, alternativeColors: alternativeColors} = option, fillStrategy = null !== (_a = option.fillStrategy) && void 0 !== _a ? _a : "invertBase", strokeStrategy = null !== (_b = option.strokeStrategy) && void 0 !== _b ? _b : "base", brightColor = null !== (_c = option.brightColor) && void 0 !== _c ? _c : "#ffffff", darkColor = null !== (_d = option.darkColor) && void 0 !== _d ? _d : "#000000", outsideEnable = null !== (_e = option.outsideEnable) && void 0 !== _e && _e;
|
|
339
|
+
const option = this.attribute.smartInvert || {}, {textType: textType, contrastRatiosThreshold: contrastRatiosThreshold, alternativeColors: alternativeColors, mode: mode} = option, fillStrategy = null !== (_a = option.fillStrategy) && void 0 !== _a ? _a : "invertBase", strokeStrategy = null !== (_b = option.strokeStrategy) && void 0 !== _b ? _b : "base", brightColor = null !== (_c = option.brightColor) && void 0 !== _c ? _c : "#ffffff", darkColor = null !== (_d = option.darkColor) && void 0 !== _d ? _d : "#000000", outsideEnable = null !== (_e = option.outsideEnable) && void 0 !== _e && _e;
|
|
287
340
|
if ("null" !== fillStrategy || "null" !== strokeStrategy) for (let i = 0; i < labels.length; i++) {
|
|
288
341
|
const label = labels[i];
|
|
289
342
|
if (!label) continue;
|
|
290
|
-
const baseMark = this.
|
|
291
|
-
label_smartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors), similarColor = (0,
|
|
343
|
+
const baseMark = this.getRelatedGrphic(label.attribute), backgroundColor = baseMark.attribute.fill, foregroundColor = label.attribute.fill, baseColor = backgroundColor, invertColor = (0,
|
|
344
|
+
label_smartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode), similarColor = (0,
|
|
292
345
|
label_smartInvert_1.contrastAccessibilityChecker)(invertColor, brightColor) ? brightColor : darkColor;
|
|
293
346
|
if (outsideEnable) {
|
|
294
347
|
const fill = (0, label_smartInvert_1.smartInvertStrategy)(fillStrategy, baseColor, invertColor, similarColor);
|
|
@@ -313,7 +366,7 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
313
366
|
if (0 === label.attribute.lineWidth) continue;
|
|
314
367
|
if (label.attribute.stroke) {
|
|
315
368
|
label.setAttributes({
|
|
316
|
-
fill: (0, label_smartInvert_1.labelSmartInvert)(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
369
|
+
fill: (0, label_smartInvert_1.labelSmartInvert)(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
317
370
|
});
|
|
318
371
|
continue;
|
|
319
372
|
}
|