@antv/component 2.1.1-alpha.1 → 2.1.1-alpha.3
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/dist/component.min.js +1 -1
- package/esm/animation/fadeIn.d.ts +1 -1
- package/esm/animation/fadeOut.d.ts +1 -1
- package/esm/animation/utils.d.ts +3 -3
- package/esm/animation/utils.js +37 -31
- package/esm/animation/utils.js.map +1 -1
- package/esm/constant.js +1 -1
- package/esm/constant.js.map +1 -1
- package/esm/core/component.js +43 -30
- package/esm/core/component.js.map +1 -1
- package/esm/shapes/Text.js +21 -13
- package/esm/shapes/Text.js.map +1 -1
- package/esm/ui/axis/axis.d.ts +1 -1
- package/esm/ui/axis/axis.js +31 -25
- package/esm/ui/axis/axis.js.map +1 -1
- package/esm/ui/axis/constant.js +13 -11
- package/esm/ui/axis/constant.js.map +1 -1
- package/esm/ui/axis/guides/grid.d.ts +1 -1
- package/esm/ui/axis/guides/grid.js +34 -29
- package/esm/ui/axis/guides/grid.js.map +1 -1
- package/esm/ui/axis/guides/labels.js +83 -76
- package/esm/ui/axis/guides/labels.js.map +1 -1
- package/esm/ui/axis/guides/line.js +87 -74
- package/esm/ui/axis/guides/line.js.map +1 -1
- package/esm/ui/axis/guides/ticks.d.ts +1 -1
- package/esm/ui/axis/guides/ticks.js +39 -31
- package/esm/ui/axis/guides/ticks.js.map +1 -1
- package/esm/ui/axis/guides/title.d.ts +1 -1
- package/esm/ui/axis/guides/title.js +37 -33
- package/esm/ui/axis/guides/title.js.map +1 -1
- package/esm/ui/axis/guides/utils.js +12 -10
- package/esm/ui/axis/guides/utils.js.map +1 -1
- package/esm/ui/axis/overlap/autoEllipsis.js +19 -12
- package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/esm/ui/axis/overlap/autoHide.js +24 -20
- package/esm/ui/axis/overlap/autoHide.js.map +1 -1
- package/esm/ui/axis/overlap/autoRotate.js +25 -11
- package/esm/ui/axis/overlap/autoRotate.js.map +1 -1
- package/esm/ui/axis/overlap/autoWrap.js +14 -11
- package/esm/ui/axis/overlap/autoWrap.js.map +1 -1
- package/esm/ui/axis/overlap/index.js +7 -7
- package/esm/ui/axis/overlap/index.js.map +1 -1
- package/esm/ui/axis/utils/bounds.js +75 -48
- package/esm/ui/axis/utils/bounds.js.map +1 -1
- package/esm/ui/axis/utils/contain.js +14 -14
- package/esm/ui/axis/utils/contain.js.map +1 -1
- package/esm/ui/axis/utils/index.js +7 -3
- package/esm/ui/axis/utils/index.js.map +1 -1
- package/esm/ui/axis/utils/intersect.js +33 -21
- package/esm/ui/axis/utils/intersect.js.map +1 -1
- package/esm/ui/axis/utils/test.js +41 -29
- package/esm/ui/axis/utils/test.js.map +1 -1
- package/esm/ui/breadcrumb/index.js +72 -64
- package/esm/ui/breadcrumb/index.js.map +1 -1
- package/esm/ui/button/constant.js +3 -3
- package/esm/ui/button/constant.js.map +1 -1
- package/esm/ui/button/index.js +97 -81
- package/esm/ui/button/index.js.map +1 -1
- package/esm/ui/checkbox/constant.js +4 -4
- package/esm/ui/checkbox/constant.js.map +1 -1
- package/esm/ui/checkbox/index.js +26 -23
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/crosshair/base.js +45 -29
- package/esm/ui/crosshair/base.js.map +1 -1
- package/esm/ui/crosshair/circle.js +34 -25
- package/esm/ui/crosshair/circle.js.map +1 -1
- package/esm/ui/crosshair/constant.js +4 -4
- package/esm/ui/crosshair/constant.js.map +1 -1
- package/esm/ui/crosshair/line.js +75 -55
- package/esm/ui/crosshair/line.js.map +1 -1
- package/esm/ui/crosshair/polygon.js +70 -54
- package/esm/ui/crosshair/polygon.js.map +1 -1
- package/esm/ui/grid/index.d.ts +1 -1
- package/esm/ui/grid/index.js +95 -73
- package/esm/ui/grid/index.js.map +1 -1
- package/esm/ui/indicator/constant.js +2 -2
- package/esm/ui/indicator/constant.js.map +1 -1
- package/esm/ui/indicator/indicator.js +63 -58
- package/esm/ui/indicator/indicator.js.map +1 -1
- package/esm/ui/layout/layout.js +66 -52
- package/esm/ui/layout/layout.js.map +1 -1
- package/esm/ui/legend/base.js +13 -12
- package/esm/ui/legend/base.js.map +1 -1
- package/esm/ui/legend/category/item.js +156 -122
- package/esm/ui/legend/category/item.js.map +1 -1
- package/esm/ui/legend/category/items.js +201 -158
- package/esm/ui/legend/category/items.js.map +1 -1
- package/esm/ui/legend/category.js +56 -46
- package/esm/ui/legend/category.js.map +1 -1
- package/esm/ui/legend/constant.js +6 -6
- package/esm/ui/legend/constant.js.map +1 -1
- package/esm/ui/legend/continuous/handle.js +33 -28
- package/esm/ui/legend/continuous/handle.js.map +1 -1
- package/esm/ui/legend/continuous/ribbon.js +38 -34
- package/esm/ui/legend/continuous/ribbon.js.map +1 -1
- package/esm/ui/legend/continuous/utils.js +11 -10
- package/esm/ui/legend/continuous/utils.js.map +1 -1
- package/esm/ui/legend/continuous.js +521 -417
- package/esm/ui/legend/continuous.js.map +1 -1
- package/esm/ui/legend/utils.js +31 -24
- package/esm/ui/legend/utils.js.map +1 -1
- package/esm/ui/marker/index.js +44 -38
- package/esm/ui/marker/index.js.map +1 -1
- package/esm/ui/marker/symbol.js +24 -24
- package/esm/ui/marker/symbol.js.map +1 -1
- package/esm/ui/marker/utils.js +2 -2
- package/esm/ui/marker/utils.js.map +1 -1
- package/esm/ui/navigator/index.js +159 -128
- package/esm/ui/navigator/index.js.map +1 -1
- package/esm/ui/poptip/constant.d.ts +1 -1
- package/esm/ui/poptip/constant.js +69 -68
- package/esm/ui/poptip/constant.js.map +1 -1
- package/esm/ui/poptip/index.js +111 -95
- package/esm/ui/poptip/index.js.map +1 -1
- package/esm/ui/poptip/utils.js +15 -8
- package/esm/ui/poptip/utils.js.map +1 -1
- package/esm/ui/scrollbar/index.js +132 -102
- package/esm/ui/scrollbar/index.js.map +1 -1
- package/esm/ui/select/option.js +58 -48
- package/esm/ui/select/option.js.map +1 -1
- package/esm/ui/select/select.js +164 -142
- package/esm/ui/select/select.js.map +1 -1
- package/esm/ui/slider/constant.js +4 -4
- package/esm/ui/slider/constant.js.map +1 -1
- package/esm/ui/slider/handle.js +54 -46
- package/esm/ui/slider/handle.js.map +1 -1
- package/esm/ui/slider/index.js +328 -282
- package/esm/ui/slider/index.js.map +1 -1
- package/esm/ui/sparkline/columns.js +34 -25
- package/esm/ui/sparkline/columns.js.map +1 -1
- package/esm/ui/sparkline/index.js +180 -145
- package/esm/ui/sparkline/index.js.map +1 -1
- package/esm/ui/sparkline/lines.js +50 -37
- package/esm/ui/sparkline/lines.js.map +1 -1
- package/esm/ui/sparkline/path.js +40 -36
- package/esm/ui/sparkline/path.js.map +1 -1
- package/esm/ui/sparkline/utils.js +9 -8
- package/esm/ui/sparkline/utils.js.map +1 -1
- package/esm/ui/switch/constant.js +1 -1
- package/esm/ui/switch/constant.js.map +1 -1
- package/esm/ui/switch/index.js +54 -44
- package/esm/ui/switch/index.js.map +1 -1
- package/esm/ui/tag/index.js +32 -29
- package/esm/ui/tag/index.js.map +1 -1
- package/esm/ui/timebar/controller.js +79 -69
- package/esm/ui/timebar/controller.js.map +1 -1
- package/esm/ui/timebar/handle.js +71 -62
- package/esm/ui/timebar/handle.js.map +1 -1
- package/esm/ui/timebar/icons.js +478 -308
- package/esm/ui/timebar/icons.js.map +1 -1
- package/esm/ui/timebar/timebar.js +318 -263
- package/esm/ui/timebar/timebar.js.map +1 -1
- package/esm/ui/timebar/utils.js +7 -7
- package/esm/ui/timebar/utils.js.map +1 -1
- package/esm/ui/timeline/index.js +6 -2
- package/esm/ui/timeline/index.js.map +1 -1
- package/esm/ui/title/index.js +64 -59
- package/esm/ui/title/index.js.map +1 -1
- package/esm/ui/tooltip/constant.js +30 -26
- package/esm/ui/tooltip/constant.js.map +1 -1
- package/esm/ui/tooltip/index.js +126 -109
- package/esm/ui/tooltip/index.js.map +1 -1
- package/esm/util/bbox.js +47 -24
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/callback.js +2 -1
- package/esm/util/callback.js.map +1 -1
- package/esm/util/classnames.js +10 -8
- package/esm/util/classnames.js.map +1 -1
- package/esm/util/deep-assign.js +14 -6
- package/esm/util/deep-assign.js.map +1 -1
- package/esm/util/defined.js +1 -1
- package/esm/util/defined.js.map +1 -1
- package/esm/util/ellipsis.js +2 -1
- package/esm/util/ellipsis.js.map +1 -1
- package/esm/util/event.js +3 -3
- package/esm/util/event.js.map +1 -1
- package/esm/util/geometry/line-length.js +4 -1
- package/esm/util/geometry/line-length.js.map +1 -1
- package/esm/util/geometry/lines-intersection.js +10 -5
- package/esm/util/geometry/lines-intersection.js.map +1 -1
- package/esm/util/group-by.js +1 -1
- package/esm/util/group-by.js.map +1 -1
- package/esm/util/group.js +3 -3
- package/esm/util/group.js.map +1 -1
- package/esm/util/html.js +1 -1
- package/esm/util/html.js.map +1 -1
- package/esm/util/if-show.js +5 -3
- package/esm/util/if-show.js.map +1 -1
- package/esm/util/in-range.js +3 -1
- package/esm/util/in-range.js.map +1 -1
- package/esm/util/interpolate.js +19 -12
- package/esm/util/interpolate.js.map +1 -1
- package/esm/util/keyframe-interpolate.d.ts +1 -1
- package/esm/util/keyframe-interpolate.js +7 -6
- package/esm/util/keyframe-interpolate.js.map +1 -1
- package/esm/util/layout/executer.js +4 -4
- package/esm/util/layout/executer.js.map +1 -1
- package/esm/util/layout/flex/index.js +26 -24
- package/esm/util/layout/flex/index.js.map +1 -1
- package/esm/util/layout/grid/index.js +1 -1
- package/esm/util/layout/grid/index.js.map +1 -1
- package/esm/util/layout/utils/helper.js +8 -7
- package/esm/util/layout/utils/helper.js.map +1 -1
- package/esm/util/matrix.js +8 -7
- package/esm/util/matrix.js.map +1 -1
- package/esm/util/number.js +7 -6
- package/esm/util/number.js.map +1 -1
- package/esm/util/offscreen.js +17 -9
- package/esm/util/offscreen.js.map +1 -1
- package/esm/util/omit.js +3 -3
- package/esm/util/omit.js.map +1 -1
- package/esm/util/path.js +41 -36
- package/esm/util/path.js.map +1 -1
- package/esm/util/primitive.js +3 -3
- package/esm/util/primitive.js.map +1 -1
- package/esm/util/replace-children.js +4 -3
- package/esm/util/replace-children.js.map +1 -1
- package/esm/util/sampling.js +3 -3
- package/esm/util/sampling.js.map +1 -1
- package/esm/util/scale-to-pixel.js +5 -4
- package/esm/util/scale-to-pixel.js.map +1 -1
- package/esm/util/selection.js +186 -142
- package/esm/util/selection.js.map +1 -1
- package/esm/util/series.js +1 -1
- package/esm/util/series.js.map +1 -1
- package/esm/util/shape.js +27 -15
- package/esm/util/shape.js.map +1 -1
- package/esm/util/string.js +5 -4
- package/esm/util/string.js.map +1 -1
- package/esm/util/style.js +29 -23
- package/esm/util/style.js.map +1 -1
- package/esm/util/svg2marker.js +16 -13
- package/esm/util/svg2marker.js.map +1 -1
- package/esm/util/text.js +14 -14
- package/esm/util/text.js.map +1 -1
- package/esm/util/throttle.js +13 -7
- package/esm/util/throttle.js.map +1 -1
- package/esm/util/time.js +24 -22
- package/esm/util/time.js.map +1 -1
- package/esm/util/timer.js +9 -5
- package/esm/util/timer.js.map +1 -1
- package/esm/util/transform.js +6 -5
- package/esm/util/transform.js.map +1 -1
- package/esm/util/transpose.js +1 -1
- package/esm/util/transpose.js.map +1 -1
- package/esm/util/traverse.js +1 -1
- package/esm/util/traverse.js.map +1 -1
- package/esm/util/visibility.js +2 -2
- package/esm/util/visibility.js.map +1 -1
- package/esm/util/wrap.js +4 -2
- package/esm/util/wrap.js.map +1 -1
- package/lib/animation/fadeIn.d.ts +1 -1
- package/lib/animation/fadeIn.js +1 -1
- package/lib/animation/fadeIn.js.map +1 -1
- package/lib/animation/fadeOut.d.ts +1 -1
- package/lib/animation/fadeOut.js +1 -1
- package/lib/animation/fadeOut.js.map +1 -1
- package/lib/animation/index.js +1 -1
- package/lib/animation/utils.d.ts +3 -3
- package/lib/animation/utils.js +39 -33
- package/lib/animation/utils.js.map +1 -1
- package/lib/core/component.js +43 -31
- package/lib/core/component.js.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/shapes/Text.js +22 -15
- package/lib/shapes/Text.js.map +1 -1
- package/lib/shapes/index.js +1 -1
- package/lib/types/index.js +1 -1
- package/lib/ui/axis/axis.d.ts +1 -1
- package/lib/ui/axis/axis.js +39 -34
- package/lib/ui/axis/axis.js.map +1 -1
- package/lib/ui/axis/constant.js +12 -10
- package/lib/ui/axis/constant.js.map +1 -1
- package/lib/ui/axis/guides/grid.d.ts +1 -1
- package/lib/ui/axis/guides/grid.js +40 -35
- package/lib/ui/axis/guides/grid.js.map +1 -1
- package/lib/ui/axis/guides/labels.js +89 -82
- package/lib/ui/axis/guides/labels.js.map +1 -1
- package/lib/ui/axis/guides/line.js +92 -79
- package/lib/ui/axis/guides/line.js.map +1 -1
- package/lib/ui/axis/guides/ticks.d.ts +1 -1
- package/lib/ui/axis/guides/ticks.js +45 -37
- package/lib/ui/axis/guides/ticks.js.map +1 -1
- package/lib/ui/axis/guides/title.d.ts +1 -1
- package/lib/ui/axis/guides/title.js +41 -37
- package/lib/ui/axis/guides/title.js.map +1 -1
- package/lib/ui/axis/guides/utils.js +14 -12
- package/lib/ui/axis/guides/utils.js.map +1 -1
- package/lib/ui/axis/overlap/autoEllipsis.js +22 -15
- package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/lib/ui/axis/overlap/autoHide.js +27 -23
- package/lib/ui/axis/overlap/autoHide.js.map +1 -1
- package/lib/ui/axis/overlap/autoRotate.js +26 -12
- package/lib/ui/axis/overlap/autoRotate.js.map +1 -1
- package/lib/ui/axis/overlap/autoWrap.js +16 -13
- package/lib/ui/axis/overlap/autoWrap.js.map +1 -1
- package/lib/ui/axis/overlap/index.js +12 -12
- package/lib/ui/axis/overlap/index.js.map +1 -1
- package/lib/ui/axis/utils/bounds.js +75 -49
- package/lib/ui/axis/utils/bounds.js.map +1 -1
- package/lib/ui/axis/utils/contain.js +15 -15
- package/lib/ui/axis/utils/contain.js.map +1 -1
- package/lib/ui/axis/utils/index.js +8 -4
- package/lib/ui/axis/utils/index.js.map +1 -1
- package/lib/ui/axis/utils/intersect.js +34 -22
- package/lib/ui/axis/utils/intersect.js.map +1 -1
- package/lib/ui/axis/utils/test.js +47 -35
- package/lib/ui/axis/utils/test.js.map +1 -1
- package/lib/ui/breadcrumb/index.js +77 -70
- package/lib/ui/breadcrumb/index.js.map +1 -1
- package/lib/ui/button/index.js +101 -86
- package/lib/ui/button/index.js.map +1 -1
- package/lib/ui/checkbox/constant.js +2 -2
- package/lib/ui/checkbox/constant.js.map +1 -1
- package/lib/ui/checkbox/index.js +28 -26
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/crosshair/base.js +48 -33
- package/lib/ui/crosshair/base.js.map +1 -1
- package/lib/ui/crosshair/circle.js +37 -29
- package/lib/ui/crosshair/circle.js.map +1 -1
- package/lib/ui/crosshair/constant.js +1 -1
- package/lib/ui/crosshair/constant.js.map +1 -1
- package/lib/ui/crosshair/index.js +1 -1
- package/lib/ui/crosshair/line.js +77 -58
- package/lib/ui/crosshair/line.js.map +1 -1
- package/lib/ui/crosshair/polygon.js +72 -57
- package/lib/ui/crosshair/polygon.js.map +1 -1
- package/lib/ui/grid/index.d.ts +1 -1
- package/lib/ui/grid/index.js +97 -76
- package/lib/ui/grid/index.js.map +1 -1
- package/lib/ui/indicator/constant.js +1 -1
- package/lib/ui/indicator/constant.js.map +1 -1
- package/lib/ui/indicator/index.js +1 -1
- package/lib/ui/indicator/indicator.js +67 -63
- package/lib/ui/indicator/indicator.js.map +1 -1
- package/lib/ui/layout/layout.js +70 -57
- package/lib/ui/layout/layout.js.map +1 -1
- package/lib/ui/legend/base.js +15 -14
- package/lib/ui/legend/base.js.map +1 -1
- package/lib/ui/legend/category/item.js +159 -126
- package/lib/ui/legend/category/item.js.map +1 -1
- package/lib/ui/legend/category/items.js +208 -166
- package/lib/ui/legend/category/items.js.map +1 -1
- package/lib/ui/legend/category.js +60 -51
- package/lib/ui/legend/category.js.map +1 -1
- package/lib/ui/legend/constant.js +2 -2
- package/lib/ui/legend/constant.js.map +1 -1
- package/lib/ui/legend/continuous/handle.js +35 -31
- package/lib/ui/legend/continuous/handle.js.map +1 -1
- package/lib/ui/legend/continuous/ribbon.js +43 -40
- package/lib/ui/legend/continuous/ribbon.js.map +1 -1
- package/lib/ui/legend/continuous/utils.js +11 -10
- package/lib/ui/legend/continuous/utils.js.map +1 -1
- package/lib/ui/legend/continuous.js +535 -432
- package/lib/ui/legend/continuous.js.map +1 -1
- package/lib/ui/legend/index.js +2 -2
- package/lib/ui/legend/index.js.map +1 -1
- package/lib/ui/legend/utils.js +32 -25
- package/lib/ui/legend/utils.js.map +1 -1
- package/lib/ui/marker/index.js +48 -43
- package/lib/ui/marker/index.js.map +1 -1
- package/lib/ui/marker/symbol.js +22 -22
- package/lib/ui/marker/symbol.js.map +1 -1
- package/lib/ui/marker/utils.js +3 -3
- package/lib/ui/marker/utils.js.map +1 -1
- package/lib/ui/navigator/index.js +165 -135
- package/lib/ui/navigator/index.js.map +1 -1
- package/lib/ui/poptip/constant.d.ts +1 -1
- package/lib/ui/poptip/constant.js +67 -66
- package/lib/ui/poptip/constant.js.map +1 -1
- package/lib/ui/poptip/index.js +115 -100
- package/lib/ui/poptip/index.js.map +1 -1
- package/lib/ui/poptip/utils.js +15 -8
- package/lib/ui/poptip/utils.js.map +1 -1
- package/lib/ui/scrollbar/index.js +136 -107
- package/lib/ui/scrollbar/index.js.map +1 -1
- package/lib/ui/select/option.js +61 -52
- package/lib/ui/select/option.js.map +1 -1
- package/lib/ui/select/select.js +169 -148
- package/lib/ui/select/select.js.map +1 -1
- package/lib/ui/slider/constant.js +1 -1
- package/lib/ui/slider/constant.js.map +1 -1
- package/lib/ui/slider/handle.js +56 -49
- package/lib/ui/slider/handle.js.map +1 -1
- package/lib/ui/slider/index.js +336 -291
- package/lib/ui/slider/index.js.map +1 -1
- package/lib/ui/sparkline/columns.js +36 -28
- package/lib/ui/sparkline/columns.js.map +1 -1
- package/lib/ui/sparkline/index.js +187 -153
- package/lib/ui/sparkline/index.js.map +1 -1
- package/lib/ui/sparkline/lines.js +52 -40
- package/lib/ui/sparkline/lines.js.map +1 -1
- package/lib/ui/sparkline/path.js +42 -38
- package/lib/ui/sparkline/path.js.map +1 -1
- package/lib/ui/sparkline/utils.js +10 -9
- package/lib/ui/sparkline/utils.js.map +1 -1
- package/lib/ui/switch/index.js +58 -49
- package/lib/ui/switch/index.js.map +1 -1
- package/lib/ui/tag/index.js +36 -34
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/timebar/controller.js +82 -73
- package/lib/ui/timebar/controller.js.map +1 -1
- package/lib/ui/timebar/handle.js +74 -67
- package/lib/ui/timebar/handle.js.map +1 -1
- package/lib/ui/timebar/icons.js +466 -312
- package/lib/ui/timebar/icons.js.map +1 -1
- package/lib/ui/timebar/timebar.js +326 -272
- package/lib/ui/timebar/timebar.js.map +1 -1
- package/lib/ui/timebar/utils.js +8 -8
- package/lib/ui/timebar/utils.js.map +1 -1
- package/lib/ui/timeline/index.js +5 -2
- package/lib/ui/timeline/index.js.map +1 -1
- package/lib/ui/title/index.js +65 -61
- package/lib/ui/title/index.js.map +1 -1
- package/lib/ui/tooltip/constant.js +30 -26
- package/lib/ui/tooltip/constant.js.map +1 -1
- package/lib/ui/tooltip/index.js +129 -113
- package/lib/ui/tooltip/index.js.map +1 -1
- package/lib/util/bbox.js +46 -24
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/callback.js +3 -2
- package/lib/util/callback.js.map +1 -1
- package/lib/util/classnames.js +10 -8
- package/lib/util/classnames.js.map +1 -1
- package/lib/util/deep-assign.js +15 -7
- package/lib/util/deep-assign.js.map +1 -1
- package/lib/util/defined.js +1 -1
- package/lib/util/defined.js.map +1 -1
- package/lib/util/ellipsis.js +3 -2
- package/lib/util/ellipsis.js.map +1 -1
- package/lib/util/event.js +3 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend-display-object.js +2 -2
- package/lib/util/extend-display-object.js.map +1 -1
- package/lib/util/geometry/index.js +1 -1
- package/lib/util/geometry/line-length.js +4 -1
- package/lib/util/geometry/line-length.js.map +1 -1
- package/lib/util/geometry/lines-intersection.js +10 -5
- package/lib/util/geometry/lines-intersection.js.map +1 -1
- package/lib/util/group-by.js +1 -1
- package/lib/util/group-by.js.map +1 -1
- package/lib/util/group.js +3 -3
- package/lib/util/group.js.map +1 -1
- package/lib/util/html.js +1 -1
- package/lib/util/html.js.map +1 -1
- package/lib/util/if-show.js +5 -3
- package/lib/util/if-show.js.map +1 -1
- package/lib/util/in-range.js +3 -1
- package/lib/util/in-range.js.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/interpolate.js +19 -12
- package/lib/util/interpolate.js.map +1 -1
- package/lib/util/keyframe-interpolate.d.ts +1 -1
- package/lib/util/keyframe-interpolate.js +8 -7
- package/lib/util/keyframe-interpolate.js.map +1 -1
- package/lib/util/layout/executer.js +6 -6
- package/lib/util/layout/executer.js.map +1 -1
- package/lib/util/layout/flex/index.js +28 -26
- package/lib/util/layout/flex/index.js.map +1 -1
- package/lib/util/layout/grid/index.js +1 -1
- package/lib/util/layout/grid/index.js.map +1 -1
- package/lib/util/layout/index.js +1 -1
- package/lib/util/layout/utils/helper.js +9 -8
- package/lib/util/layout/utils/helper.js.map +1 -1
- package/lib/util/matrix.js +8 -7
- package/lib/util/matrix.js.map +1 -1
- package/lib/util/number.js +7 -6
- package/lib/util/number.js.map +1 -1
- package/lib/util/offscreen.js +20 -12
- package/lib/util/offscreen.js.map +1 -1
- package/lib/util/omit.js +3 -3
- package/lib/util/omit.js.map +1 -1
- package/lib/util/path.js +42 -37
- package/lib/util/path.js.map +1 -1
- package/lib/util/primitive.js +2 -2
- package/lib/util/primitive.js.map +1 -1
- package/lib/util/replace-children.js +4 -3
- package/lib/util/replace-children.js.map +1 -1
- package/lib/util/sampling.js +3 -3
- package/lib/util/sampling.js.map +1 -1
- package/lib/util/scale-to-pixel.js +5 -4
- package/lib/util/scale-to-pixel.js.map +1 -1
- package/lib/util/selection.js +187 -144
- package/lib/util/selection.js.map +1 -1
- package/lib/util/series.js +2 -2
- package/lib/util/series.js.map +1 -1
- package/lib/util/shape.js +28 -16
- package/lib/util/shape.js.map +1 -1
- package/lib/util/string.js +5 -4
- package/lib/util/string.js.map +1 -1
- package/lib/util/style.js +30 -24
- package/lib/util/style.js.map +1 -1
- package/lib/util/svg2marker.js +17 -15
- package/lib/util/svg2marker.js.map +1 -1
- package/lib/util/text.js +16 -16
- package/lib/util/text.js.map +1 -1
- package/lib/util/throttle.js +13 -7
- package/lib/util/throttle.js.map +1 -1
- package/lib/util/time.js +24 -22
- package/lib/util/time.js.map +1 -1
- package/lib/util/timer.js +9 -5
- package/lib/util/timer.js.map +1 -1
- package/lib/util/transform.js +6 -5
- package/lib/util/transform.js.map +1 -1
- package/lib/util/transpose.js +1 -1
- package/lib/util/transpose.js.map +1 -1
- package/lib/util/traverse.js +1 -1
- package/lib/util/traverse.js.map +1 -1
- package/lib/util/visibility.js +3 -3
- package/lib/util/visibility.js.map +1 -1
- package/lib/util/wrap.js +5 -3
- package/lib/util/wrap.js.map +1 -1
- package/package.json +8 -8
- package/src/ui/poptip/constant.ts +1 -1
- package/src/ui/slider/index.ts +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"src/","sources":["ui/crosshair/constant.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"src/","sources":["ui/crosshair/constant.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAQ3B,QAAA,4BAA4B,GAAqC;IAC5E,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,SAAS;IACrB,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACrB,CAAC;AAEW,QAAA,4BAA4B,GAAqC,IAAA,iBAAU,EACtF,EAAE,EACF,oCAA4B,EAC5B;IACE,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,OAAO;IACpB,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,QAAQ;CAC3B,CACF,CAAC;AAEW,QAAA,8BAA8B,GAAuC,IAAA,iBAAU,EAC1F,EAAE,EACF,oCAA4B,EAC5B;IACE,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,CAAC;CACjB,CACF,CAAC;AAEW,QAAA,+BAA+B,GAAwC,IAAA,iBAAU,EAC5F,EAAE,EACF,oCAA4B,EAC5B;IACE,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;CACd,CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./base"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./line"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./circle"), exports);
|
package/lib/ui/crosshair/line.js
CHANGED
|
@@ -1,91 +1,110 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LineCrosshair = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 获得 pointer 的相对坐标
|
|
15
|
-
*/
|
|
16
|
-
get localPointer() {
|
|
17
|
-
if (!this.pointer)
|
|
18
|
-
return this.attributes.startPos;
|
|
19
|
-
const [bx, by] = this.getPosition();
|
|
20
|
-
const [x, y] = this.pointer;
|
|
21
|
-
return [x - bx, y - by];
|
|
22
|
-
}
|
|
23
|
-
get isVertical() {
|
|
24
|
-
const { startPos: [x1, y1], endPos: [x2, y2], } = this.attributes;
|
|
25
|
-
return x1 === x2 && y1 !== y2;
|
|
26
|
-
}
|
|
27
|
-
get tagShapeSpace() {
|
|
28
|
-
const { width, height } = (0, util_1.getShapeSpace)(this.tagShape);
|
|
29
|
-
return { width, height };
|
|
30
|
-
}
|
|
31
|
-
constructor(options) {
|
|
32
|
-
super((0, util_1.deepAssign)({}, LineCrosshair.defaultOptions, options));
|
|
33
|
-
}
|
|
34
|
-
update(cfg) {
|
|
35
|
-
super.update(cfg);
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var util_1 = require("../../util");
|
|
6
|
+
var base_1 = require("./base");
|
|
7
|
+
var constant_1 = require("./constant");
|
|
8
|
+
var LineCrosshair = /** @class */ (function (_super) {
|
|
9
|
+
tslib_1.__extends(LineCrosshair, _super);
|
|
10
|
+
function LineCrosshair(options) {
|
|
11
|
+
return _super.call(this, (0, util_1.deepAssign)({}, LineCrosshair.defaultOptions, options)) || this;
|
|
36
12
|
}
|
|
13
|
+
Object.defineProperty(LineCrosshair.prototype, "crosshairPath", {
|
|
14
|
+
get: function () {
|
|
15
|
+
var _a = this.attributes, _b = tslib_1.__read(_a.startPos, 2), sx = _b[0], sy = _b[1], _c = tslib_1.__read(_a.endPos, 2), ex = _c[0], ey = _c[1];
|
|
16
|
+
var path = [['M', 0, 0], ['L', ex - sx, ey - sy], ['Z']];
|
|
17
|
+
return path;
|
|
18
|
+
},
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(LineCrosshair.prototype, "localPointer", {
|
|
23
|
+
/**
|
|
24
|
+
* 获得 pointer 的相对坐标
|
|
25
|
+
*/
|
|
26
|
+
get: function () {
|
|
27
|
+
if (!this.pointer)
|
|
28
|
+
return this.attributes.startPos;
|
|
29
|
+
var _a = tslib_1.__read(this.getPosition(), 2), bx = _a[0], by = _a[1];
|
|
30
|
+
var _b = tslib_1.__read(this.pointer, 2), x = _b[0], y = _b[1];
|
|
31
|
+
return [x - bx, y - by];
|
|
32
|
+
},
|
|
33
|
+
enumerable: false,
|
|
34
|
+
configurable: true
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(LineCrosshair.prototype, "isVertical", {
|
|
37
|
+
get: function () {
|
|
38
|
+
var _a = this.attributes, _b = tslib_1.__read(_a.startPos, 2), x1 = _b[0], y1 = _b[1], _c = tslib_1.__read(_a.endPos, 2), x2 = _c[0], y2 = _c[1];
|
|
39
|
+
return x1 === x2 && y1 !== y2;
|
|
40
|
+
},
|
|
41
|
+
enumerable: false,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(LineCrosshair.prototype, "tagShapeSpace", {
|
|
45
|
+
get: function () {
|
|
46
|
+
var _a = (0, util_1.getShapeSpace)(this.tagShape), width = _a.width, height = _a.height;
|
|
47
|
+
return { width: width, height: height };
|
|
48
|
+
},
|
|
49
|
+
enumerable: false,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
LineCrosshair.prototype.update = function (cfg) {
|
|
53
|
+
_super.prototype.update.call(this, cfg);
|
|
54
|
+
};
|
|
37
55
|
/**
|
|
38
56
|
* 将线移动至对应位置
|
|
39
57
|
*/
|
|
40
|
-
setPointer(pointer) {
|
|
41
|
-
|
|
58
|
+
LineCrosshair.prototype.setPointer = function (pointer) {
|
|
59
|
+
_super.prototype.setPointer.call(this, pointer);
|
|
42
60
|
this.adjustPosition();
|
|
43
|
-
}
|
|
44
|
-
setText(text) {
|
|
45
|
-
this.tagShape.update({ text });
|
|
61
|
+
};
|
|
62
|
+
LineCrosshair.prototype.setText = function (text) {
|
|
63
|
+
this.tagShape.update({ text: text });
|
|
46
64
|
this.adjustTag();
|
|
47
|
-
}
|
|
48
|
-
adjustLayout() {
|
|
65
|
+
};
|
|
66
|
+
LineCrosshair.prototype.adjustLayout = function () {
|
|
49
67
|
this.adjustPosition();
|
|
50
68
|
this.adjustTag();
|
|
51
|
-
}
|
|
69
|
+
};
|
|
52
70
|
/**
|
|
53
71
|
* 调整this位置
|
|
54
72
|
*/
|
|
55
|
-
adjustPosition() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
LineCrosshair.prototype.adjustPosition = function () {
|
|
74
|
+
var _a = tslib_1.__read(this.localPointer, 2), lx = _a[0], ly = _a[1];
|
|
75
|
+
var _b = tslib_1.__read(this.attributes.startPos, 2), sx = _b[0], sy = _b[1];
|
|
76
|
+
var targetPos = this.getOrientVal([sx, ly], [lx, sy]);
|
|
59
77
|
this.shapesGroup.setLocalPosition(targetPos);
|
|
60
|
-
}
|
|
78
|
+
};
|
|
61
79
|
/**
|
|
62
80
|
* 调整tag位置
|
|
63
81
|
*/
|
|
64
|
-
adjustTag() {
|
|
65
|
-
|
|
82
|
+
LineCrosshair.prototype.adjustTag = function () {
|
|
83
|
+
var _a = this.attributes, tagText = _a.tagText, tagPosition = _a.tagPosition, _b = tslib_1.__read(_a.startPos, 2), x1 = _b[0], y1 = _b[1], _c = tslib_1.__read(_a.endPos, 2), x2 = _c[0], y2 = _c[1];
|
|
66
84
|
if (!tagText || tagText === '') {
|
|
67
85
|
(0, util_1.hide)(this.tagShape);
|
|
68
86
|
return;
|
|
69
87
|
}
|
|
70
88
|
(0, util_1.show)(this.tagShape);
|
|
71
|
-
|
|
89
|
+
var _d = this.tagShapeSpace, width = _d.width, height = _d.height;
|
|
72
90
|
// 偏移量
|
|
73
|
-
|
|
91
|
+
var _e = tslib_1.__read(this.getOrientVal({
|
|
74
92
|
start: [-width / 2, height / 2],
|
|
75
93
|
end: [x2 - x1 + width / 2, height / 2],
|
|
76
94
|
}, {
|
|
77
95
|
start: [0, 0],
|
|
78
96
|
end: [0, y2 - y1 + height],
|
|
79
|
-
})[tagPosition];
|
|
97
|
+
})[tagPosition], 2), xOffset = _e[0], yOffset = _e[1];
|
|
80
98
|
this.tagShape.setLocalPosition(xOffset, yOffset);
|
|
81
|
-
}
|
|
82
|
-
getOrientVal(v1, v2) {
|
|
99
|
+
};
|
|
100
|
+
LineCrosshair.prototype.getOrientVal = function (v1, v2) {
|
|
83
101
|
return this.isVertical ? v2 : v1;
|
|
84
|
-
}
|
|
85
|
-
|
|
102
|
+
};
|
|
103
|
+
LineCrosshair.tag = 'line-crosshair';
|
|
104
|
+
LineCrosshair.defaultOptions = {
|
|
105
|
+
style: constant_1.LINE_CROSSHAIR_DEFAULT_STYLE,
|
|
106
|
+
};
|
|
107
|
+
return LineCrosshair;
|
|
108
|
+
}(base_1.CrosshairBase));
|
|
86
109
|
exports.LineCrosshair = LineCrosshair;
|
|
87
|
-
LineCrosshair.tag = 'line-crosshair';
|
|
88
|
-
LineCrosshair.defaultOptions = {
|
|
89
|
-
style: constant_1.LINE_CROSSHAIR_DEFAULT_STYLE,
|
|
90
|
-
};
|
|
91
110
|
//# sourceMappingURL=line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"src/","sources":["ui/crosshair/line.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"src/","sources":["ui/crosshair/line.ts"],"names":[],"mappings":";;;;AACA,mCAAmE;AACnE,+BAAuC;AACvC,uCAA0D;AAK1D;IAAmC,yCAAgD;IAuCjF,uBAAY,OAA6B;QACvC,OAAA,MAAK,YAAC,IAAA,iBAAU,EAAC,EAAE,EAAE,aAAa,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAC;IAC/D,CAAC;IAlCD,sBAAc,wCAAa;aAA3B;YACQ,IAAA,KAGF,IAAI,CAAC,UAAU,EAFjB,KAAA,8BAAkB,EAAP,EAAE,QAAA,EAAE,EAAE,QAAA,EACjB,KAAA,4BAAgB,EAAP,EAAE,QAAA,EAAE,EAAE,QACE,CAAC;YACpB,IAAM,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,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GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;YAC/B,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;SACvC,EACD;YACE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACb,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;SAC3B,CACF,CAAC,WAAW,CAAC,IAAA,EATP,OAAO,QAAA,EAAE,OAAO,QAST,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAEO,oCAAY,GAApB,UAAwB,EAAK,EAAE,EAAK;QAClC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,CAAC;IA9GM,iBAAG,GAAG,gBAAgB,CAAC;IAEb,4BAAc,GAAG;QAChC,KAAK,EAAE,uCAA4B;KACpC,CAAC;IA2GJ,oBAAC;CAAA,AAhHD,CAAmC,oBAAa,GAgH/C;AAhHY,sCAAa"}
|
|
@@ -1,86 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PolygonCrosshair = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
super((0, util_1.deepAssign)({}, PolygonCrosshair.defaultOptions, options));
|
|
13
|
-
}
|
|
14
|
-
update(cfg) {
|
|
15
|
-
super.update(cfg);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 得到从中心出发,各个点方向的单位向量
|
|
19
|
-
*/
|
|
20
|
-
get points() {
|
|
21
|
-
const { startAngle, sides } = this.attributes;
|
|
22
|
-
const a = (Math.PI * 2) / sides;
|
|
23
|
-
// 单位向量
|
|
24
|
-
const unit = [1, 0];
|
|
25
|
-
const points = [];
|
|
26
|
-
for (let i = 0; i < sides; i += 1) {
|
|
27
|
-
points.push((0, util_1.rotate)(unit, [0, 0], (startAngle / 180) * Math.PI + a * i));
|
|
28
|
-
}
|
|
29
|
-
return points;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var util_1 = require("../../util");
|
|
6
|
+
var base_1 = require("./base");
|
|
7
|
+
var constant_1 = require("./constant");
|
|
8
|
+
var PolygonCrosshair = /** @class */ (function (_super) {
|
|
9
|
+
tslib_1.__extends(PolygonCrosshair, _super);
|
|
10
|
+
function PolygonCrosshair(options) {
|
|
11
|
+
return _super.call(this, (0, util_1.deepAssign)({}, PolygonCrosshair.defaultOptions, options)) || this;
|
|
30
12
|
}
|
|
13
|
+
Object.defineProperty(PolygonCrosshair.prototype, "crosshairPath", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this.createPolygonPath();
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
PolygonCrosshair.prototype.update = function (cfg) {
|
|
21
|
+
_super.prototype.update.call(this, cfg);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(PolygonCrosshair.prototype, "points", {
|
|
24
|
+
/**
|
|
25
|
+
* 得到从中心出发,各个点方向的单位向量
|
|
26
|
+
*/
|
|
27
|
+
get: function () {
|
|
28
|
+
var _a = this.attributes, startAngle = _a.startAngle, sides = _a.sides;
|
|
29
|
+
var a = (Math.PI * 2) / sides;
|
|
30
|
+
// 单位向量
|
|
31
|
+
var unit = [1, 0];
|
|
32
|
+
var points = [];
|
|
33
|
+
for (var i = 0; i < sides; i += 1) {
|
|
34
|
+
points.push((0, util_1.rotate)(unit, [0, 0], (startAngle / 180) * Math.PI + a * i));
|
|
35
|
+
}
|
|
36
|
+
return points;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
31
41
|
/**
|
|
32
42
|
* 1. 判断point位于哪一个扇区
|
|
33
43
|
* 2. 计算中心到point的线段与所在扇区的边的交点
|
|
34
44
|
* 3. 计算等效半径
|
|
35
45
|
*/
|
|
36
|
-
setPointer(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
PolygonCrosshair.prototype.setPointer = function (_a) {
|
|
47
|
+
var _b = tslib_1.__read(_a, 2), x = _b[0], y = _b[1];
|
|
48
|
+
_super.prototype.setPointer.call(this, [x, y]);
|
|
49
|
+
var _c = tslib_1.__read(this.localPointer, 2), lx = _c[0], ly = _c[1];
|
|
50
|
+
var center = this.attributes.center;
|
|
40
51
|
// 求交点
|
|
41
|
-
|
|
52
|
+
var _d = tslib_1.__read(this.intersection([lx, ly]), 2), ix = _d[0], iy = _d[1];
|
|
42
53
|
if (!ix || !iy)
|
|
43
54
|
return;
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
var equivalentRadius = (0, util_1.lineLen)(center, [lx, ly]) / (0, util_1.lineLen)(center, [ix, iy]);
|
|
56
|
+
var path = this.createPolygonPath(equivalentRadius);
|
|
46
57
|
this.crosshairShape.attr({ d: path });
|
|
47
|
-
}
|
|
48
|
-
adjustLayout() {
|
|
58
|
+
};
|
|
59
|
+
PolygonCrosshair.prototype.adjustLayout = function () {
|
|
49
60
|
(0, util_1.hide)(this.tagShape);
|
|
50
|
-
}
|
|
51
|
-
createPolygonPath(radius) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
};
|
|
62
|
+
PolygonCrosshair.prototype.createPolygonPath = function (radius) {
|
|
63
|
+
var _a = this.attributes, defaultRadius = _a.defaultRadius, _b = tslib_1.__read(_a.center, 2), cx = _b[0], cy = _b[1];
|
|
64
|
+
var path = this.points.map(function (_a, index) {
|
|
65
|
+
var _b = tslib_1.__read(_a, 2), x = _b[0], y = _b[1];
|
|
66
|
+
var _c = tslib_1.__read((0, util_1.scale)([x, y], radius || defaultRadius), 2), tx = _c[0], ty = _c[1];
|
|
55
67
|
return [index === 0 ? 'M' : 'L', cx + tx, cy + ty];
|
|
56
68
|
});
|
|
57
69
|
path.push(['Z']);
|
|
58
70
|
return path;
|
|
59
|
-
}
|
|
71
|
+
};
|
|
60
72
|
/**
|
|
61
73
|
* 求点与扇区单位边的交点
|
|
62
74
|
*/
|
|
63
|
-
intersection(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
PolygonCrosshair.prototype.intersection = function (_a) {
|
|
76
|
+
var _b;
|
|
77
|
+
var _c = tslib_1.__read(_a, 2), x = _c[0], y = _c[1];
|
|
78
|
+
var points = this.points;
|
|
79
|
+
var _d = tslib_1.__read(this.attributes.center, 2), cx = _d[0], cy = _d[1];
|
|
80
|
+
var ix;
|
|
81
|
+
var iy;
|
|
68
82
|
// 遍历每个边
|
|
69
|
-
for (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
for (var i = 1; i <= points.length; i += 1) {
|
|
84
|
+
var _e = tslib_1.__read(points[i - 1], 2), sx = _e[0], sy = _e[1];
|
|
85
|
+
var _f = tslib_1.__read(points[i % points.length], 2), ex = _f[0], ey = _f[1];
|
|
86
|
+
var inter = (0, util_1.intersection)([x, y], [cx, cy], [sx + cx, sy + cy], [ex + cx, ey + cy]);
|
|
73
87
|
if (inter.length !== 0) {
|
|
74
88
|
// 存在交点
|
|
75
|
-
[
|
|
89
|
+
_b = tslib_1.__read(inter, 2), ix = _b[0], iy = _b[1];
|
|
76
90
|
}
|
|
77
91
|
}
|
|
78
92
|
return [ix, iy];
|
|
79
|
-
}
|
|
80
|
-
|
|
93
|
+
};
|
|
94
|
+
PolygonCrosshair.tag = 'polygon-crosshair';
|
|
95
|
+
PolygonCrosshair.defaultOptions = {
|
|
96
|
+
style: constant_1.POLYGON_CROSSHAIR_DEFAULT_STYLE,
|
|
97
|
+
};
|
|
98
|
+
return PolygonCrosshair;
|
|
99
|
+
}(base_1.CrosshairBase));
|
|
81
100
|
exports.PolygonCrosshair = PolygonCrosshair;
|
|
82
|
-
PolygonCrosshair.tag = 'polygon-crosshair';
|
|
83
|
-
PolygonCrosshair.defaultOptions = {
|
|
84
|
-
style: constant_1.POLYGON_CROSSHAIR_DEFAULT_STYLE,
|
|
85
|
-
};
|
|
86
101
|
//# sourceMappingURL=polygon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"src/","sources":["ui/crosshair/polygon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"polygon.js","sourceRoot":"src/","sources":["ui/crosshair/polygon.ts"],"names":[],"mappings":";;;;AACA,mCAAoF;AACpF,+BAAuC;AACvC,uCAA6D;AAK7D;IAAsC,4CAAmD;IAWvF,0BAAY,OAAgC;QAC1C,OAAA,MAAK,YAAC,IAAA,iBAAU,EAAC,EAAE,EAAE,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAC;IAClE,CAAC;IAND,sBAAc,2CAAa;aAA3B;YACE,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAClC,CAAC;;;OAAA;IAMM,iCAAM,GAAb,UAAc,GAAwC;QACpD,gBAAK,CAAC,MAAM,YAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAKD,sBAAY,oCAAM;QAHlB;;WAEG;aACH;YACQ,IAAA,KAAwB,IAAI,CAAC,UAAU,EAArC,UAAU,gBAAA,EAAE,KAAK,WAAoB,CAAC;YAC9C,IAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;YAChC,OAAO;YACP,IAAM,IAAI,GAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACtC,IAAM,MAAM,GAAG,EAAE,CAAC;YAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,EA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AAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,EAAnC,EAAE,QAAA,EAAE,EAAE,QAA6B,CAAC;YAC3C,IAAM,KAAK,GAAG,IAAA,mBAAY,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;YACrF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO;gBACP,KAAA,eAAW,KAAc,IAAA,EAAxB,EAAE,QAAA,EAAE,EAAE,QAAA,CAAmB;YAC5B,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAG,EAAE,EAAG,CAAC,CAAC;IACpB,CAAC;IAxFa,oBAAG,GAAG,mBAAmB,CAAC;IAEvB,+BAAc,GAAG;QAChC,KAAK,EAAE,0CAA+B;KACvC,CAAC;IAqFJ,uBAAC;CAAA,AA1FD,CAAsC,oBAAa,GA0FlD;AA1FY,4CAAgB"}
|
package/lib/ui/grid/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { Group } from '../../shapes';
|
|
|
3
3
|
import type { GridOptions, GridStyleProps } from './types';
|
|
4
4
|
export type { GridOptions, GridStyleProps };
|
|
5
5
|
export declare class Grid extends Component<GridStyleProps> {
|
|
6
|
-
render(attributes: GridStyleProps, container: Group): import("@antv/g").IAnimation[];
|
|
6
|
+
render(attributes: GridStyleProps, container: Group): import("@antv/g-lite").IAnimation[];
|
|
7
7
|
}
|
package/lib/ui/grid/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Grid = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var animation_1 = require("../../animation");
|
|
6
|
+
var core_1 = require("../../core");
|
|
7
|
+
var util_1 = require("../../util");
|
|
8
|
+
var CLASS_NAMES = (0, util_1.classNames)({
|
|
9
9
|
lineGroup: 'line-group',
|
|
10
10
|
line: 'line',
|
|
11
11
|
regionGroup: 'region-group',
|
|
12
12
|
region: 'region',
|
|
13
13
|
}, 'grid');
|
|
14
14
|
function getStraightPath(points) {
|
|
15
|
-
return points.reduce((acc, curr, idx)
|
|
16
|
-
acc.push([idx === 0 ? 'M' : 'L',
|
|
15
|
+
return points.reduce(function (acc, curr, idx) {
|
|
16
|
+
acc.push(tslib_1.__spreadArray([idx === 0 ? 'M' : 'L'], tslib_1.__read(curr), false));
|
|
17
17
|
return acc;
|
|
18
18
|
}, []);
|
|
19
19
|
}
|
|
20
20
|
function getSurroundPath(points, attr, reversed) {
|
|
21
|
-
|
|
21
|
+
var _a = attr.connect, connect = _a === void 0 ? 'line' : _a, center = attr.center;
|
|
22
22
|
if (connect === 'line')
|
|
23
23
|
return getStraightPath(points);
|
|
24
24
|
if (!center)
|
|
25
25
|
return [];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return points.reduce((r, p, idx)
|
|
26
|
+
var radius = (0, util_1.distance)(points[0], center);
|
|
27
|
+
var sweepFlag = reversed ? 0 : 1;
|
|
28
|
+
return points.reduce(function (r, p, idx) {
|
|
29
29
|
if (idx === 0)
|
|
30
|
-
r.push(['M',
|
|
30
|
+
r.push(tslib_1.__spreadArray(['M'], tslib_1.__read(p), false));
|
|
31
31
|
else
|
|
32
|
-
r.push(['A', radius, radius, 0, 0, sweepFlag,
|
|
32
|
+
r.push(tslib_1.__spreadArray(['A', radius, radius, 0, 0, sweepFlag], tslib_1.__read(p), false));
|
|
33
33
|
return r;
|
|
34
34
|
}, []);
|
|
35
35
|
}
|
|
@@ -39,101 +39,122 @@ function getLinePath(points, cfg, reversed) {
|
|
|
39
39
|
return getStraightPath(points);
|
|
40
40
|
}
|
|
41
41
|
function connectPaths(from, to, cfg) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
var type = cfg.type, connect = cfg.connect, center = cfg.center, closed = cfg.closed;
|
|
43
|
+
var closeFlag = closed ? [['Z']] : [];
|
|
44
|
+
var _a = tslib_1.__read([getLinePath(from, cfg), getLinePath(to.slice().reverse(), cfg, true)], 2), path1 = _a[0], path2 = _a[1];
|
|
45
|
+
var _b = tslib_1.__read([from[0], to.slice(-1)[0]], 2), startOfFrom = _b[0], endOfTo = _b[1];
|
|
46
|
+
var createPath = function (insertA, insertB) {
|
|
47
|
+
return [path1, insertA, path2, insertB, closeFlag].flat();
|
|
48
|
+
};
|
|
47
49
|
if (connect === 'line' || type === 'surround') {
|
|
48
|
-
return createPath([['L',
|
|
50
|
+
return createPath([tslib_1.__spreadArray(['L'], tslib_1.__read(endOfTo), false)], [tslib_1.__spreadArray(['L'], tslib_1.__read(startOfFrom), false)]);
|
|
49
51
|
}
|
|
50
52
|
if (!center)
|
|
51
53
|
throw new Error('Arc grid need to specified center');
|
|
52
|
-
|
|
54
|
+
var _c = tslib_1.__read([(0, util_1.distance)(endOfTo, center), (0, util_1.distance)(startOfFrom, center)], 2), raduis1 = _c[0], radius2 = _c[1];
|
|
53
55
|
return createPath([
|
|
54
|
-
['A', raduis1, raduis1, 0, 0, 1,
|
|
55
|
-
['L',
|
|
56
|
+
tslib_1.__spreadArray(['A', raduis1, raduis1, 0, 0, 1], tslib_1.__read(endOfTo), false),
|
|
57
|
+
tslib_1.__spreadArray(['L'], tslib_1.__read(endOfTo), false),
|
|
56
58
|
], [
|
|
57
|
-
['A', radius2, radius2, 0, 0, 0,
|
|
58
|
-
['L',
|
|
59
|
+
tslib_1.__spreadArray(['A', radius2, radius2, 0, 0, 0], tslib_1.__read(startOfFrom), false),
|
|
60
|
+
tslib_1.__spreadArray(['L'], tslib_1.__read(startOfFrom), false),
|
|
59
61
|
]);
|
|
60
62
|
}
|
|
61
63
|
function renderGridLine(container, data, attr, style) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
var animate = attr.animate, isBillboard = attr.isBillboard;
|
|
65
|
+
var lines = data.map(function (item, idx) {
|
|
64
66
|
return {
|
|
65
|
-
id: item.id ||
|
|
67
|
+
id: item.id || "grid-line-".concat(idx),
|
|
66
68
|
d: getLinePath(item.points, attr),
|
|
67
69
|
};
|
|
68
70
|
});
|
|
69
71
|
return container
|
|
70
72
|
.selectAll(CLASS_NAMES.line.class)
|
|
71
|
-
.data(lines, (d)
|
|
72
|
-
.join(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
73
|
+
.data(lines, function (d) { return d.id; })
|
|
74
|
+
.join(function (enter) {
|
|
75
|
+
return enter.append('path').each(function (datum, index) {
|
|
76
|
+
var lineStyle = (0, util_1.getCallbackValue)((0, util_1.getPrimitiveAttributes)(tslib_1.__assign({ d: datum.d }, style)), [datum, index, lines]);
|
|
77
|
+
this.attr(tslib_1.__assign({ class: CLASS_NAMES.line.name, stroke: '#D9D9D9', lineWidth: 1, lineDash: [4, 4], isBillboard: isBillboard }, lineStyle));
|
|
78
|
+
});
|
|
79
|
+
}, function (update) {
|
|
80
|
+
return update.transition(function (datum, index) {
|
|
81
|
+
var lineStyle = (0, util_1.getCallbackValue)((0, util_1.getPrimitiveAttributes)(tslib_1.__assign({ d: datum.d }, style)), [datum, index, lines]);
|
|
82
|
+
return (0, animation_1.transition)(this, lineStyle, animate.update);
|
|
83
|
+
});
|
|
84
|
+
}, function (exit) {
|
|
85
|
+
return exit.transition(function () {
|
|
86
|
+
var _this = this;
|
|
87
|
+
var animation = (0, animation_1.fadeOut)(this, animate.exit);
|
|
88
|
+
(0, animation_1.onAnimateFinished)(animation, function () { return _this.remove(); });
|
|
89
|
+
return animation;
|
|
90
|
+
});
|
|
91
|
+
})
|
|
83
92
|
.transitions();
|
|
84
93
|
}
|
|
85
94
|
function renderAlternateRegion(container, data, style) {
|
|
86
|
-
|
|
95
|
+
var animate = style.animate, connect = style.connect, areaFill = style.areaFill;
|
|
87
96
|
if (data.length < 2 || !areaFill || !connect)
|
|
88
97
|
return [];
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for (
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
var colors = Array.isArray(areaFill) ? areaFill : [areaFill, 'transparent'];
|
|
99
|
+
var getColor = function (idx) { return colors[idx % colors.length]; };
|
|
100
|
+
var regions = [];
|
|
101
|
+
for (var idx = 0; idx < data.length - 1; idx++) {
|
|
102
|
+
var _a = tslib_1.__read([data[idx].points, data[idx + 1].points], 2), prev = _a[0], curr = _a[1];
|
|
103
|
+
var path = connectPaths(prev, curr, style);
|
|
95
104
|
regions.push({ d: path, fill: getColor(idx) });
|
|
96
105
|
}
|
|
97
106
|
return container
|
|
98
107
|
.selectAll(CLASS_NAMES.region.class)
|
|
99
|
-
.data(regions, (_, i)
|
|
100
|
-
.join((enter)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
.data(regions, function (_, i) { return i; })
|
|
109
|
+
.join(function (enter) {
|
|
110
|
+
return enter
|
|
111
|
+
.append('path')
|
|
112
|
+
.each(function (datum, index) {
|
|
113
|
+
var regionStyle = (0, util_1.getCallbackValue)(datum, [datum, index, regions]);
|
|
114
|
+
this.attr(regionStyle);
|
|
115
|
+
})
|
|
116
|
+
.attr('className', CLASS_NAMES.region.name);
|
|
117
|
+
}, function (update) {
|
|
118
|
+
return update.transition(function (datum, index) {
|
|
119
|
+
var regionStyle = (0, util_1.getCallbackValue)(datum, [datum, index, regions]);
|
|
120
|
+
return (0, animation_1.transition)(this, regionStyle, animate.update);
|
|
121
|
+
});
|
|
122
|
+
}, function (exit) {
|
|
123
|
+
return exit.transition(function () {
|
|
124
|
+
var _this = this;
|
|
125
|
+
var animation = (0, animation_1.fadeOut)(this, animate.exit);
|
|
126
|
+
(0, animation_1.onAnimateFinished)(animation, function () { return _this.remove(); });
|
|
127
|
+
return animation;
|
|
128
|
+
});
|
|
105
129
|
})
|
|
106
|
-
.attr('className', CLASS_NAMES.region.name), (update) => update.transition(function (datum, index) {
|
|
107
|
-
const regionStyle = (0, util_1.getCallbackValue)(datum, [datum, index, regions]);
|
|
108
|
-
return (0, animation_1.transition)(this, regionStyle, animate.update);
|
|
109
|
-
}), (exit) => exit.transition(function () {
|
|
110
|
-
const animation = (0, animation_1.fadeOut)(this, animate.exit);
|
|
111
|
-
(0, animation_1.onAnimateFinished)(animation, () => this.remove());
|
|
112
|
-
return animation;
|
|
113
|
-
}))
|
|
114
130
|
.transitions();
|
|
115
131
|
}
|
|
116
132
|
function getData(attr) {
|
|
117
|
-
|
|
133
|
+
var _a = attr.data, data = _a === void 0 ? [] : _a, closed = attr.closed;
|
|
118
134
|
if (!closed)
|
|
119
135
|
return data;
|
|
120
|
-
return data.map((datum)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return
|
|
136
|
+
return data.map(function (datum) {
|
|
137
|
+
var points = datum.points;
|
|
138
|
+
var _a = tslib_1.__read(points, 1), start = _a[0];
|
|
139
|
+
return tslib_1.__assign(tslib_1.__assign({}, datum), { points: tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(points), false), [start], false) });
|
|
124
140
|
});
|
|
125
141
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const data = getData(attributes);
|
|
131
|
-
const lineGroup = (0, util_1.select)(container).maybeAppendByClassName(CLASS_NAMES.lineGroup, 'g');
|
|
132
|
-
const regionGroup = (0, util_1.select)(container).maybeAppendByClassName(CLASS_NAMES.regionGroup, 'g');
|
|
133
|
-
const lineTransitions = renderGridLine(lineGroup, data, attributes, style);
|
|
134
|
-
const reigionTransitions = renderAlternateRegion(regionGroup, data, attributes);
|
|
135
|
-
return [...lineTransitions, ...reigionTransitions];
|
|
142
|
+
var Grid = /** @class */ (function (_super) {
|
|
143
|
+
tslib_1.__extends(Grid, _super);
|
|
144
|
+
function Grid() {
|
|
145
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
136
146
|
}
|
|
137
|
-
|
|
147
|
+
Grid.prototype.render = function (attributes, container) {
|
|
148
|
+
// @ts-ignore do no passBy className
|
|
149
|
+
var type = attributes.type, center = attributes.center, areaFill = attributes.areaFill, closed = attributes.closed, style = tslib_1.__rest(attributes, ["type", "center", "areaFill", "closed"]);
|
|
150
|
+
var data = getData(attributes);
|
|
151
|
+
var lineGroup = (0, util_1.select)(container).maybeAppendByClassName(CLASS_NAMES.lineGroup, 'g');
|
|
152
|
+
var regionGroup = (0, util_1.select)(container).maybeAppendByClassName(CLASS_NAMES.regionGroup, 'g');
|
|
153
|
+
var lineTransitions = renderGridLine(lineGroup, data, attributes, style);
|
|
154
|
+
var reigionTransitions = renderAlternateRegion(regionGroup, data, attributes);
|
|
155
|
+
return tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(lineTransitions), false), tslib_1.__read(reigionTransitions), false);
|
|
156
|
+
};
|
|
157
|
+
return Grid;
|
|
158
|
+
}(core_1.Component));
|
|
138
159
|
exports.Grid = Grid;
|
|
139
160
|
//# sourceMappingURL=index.js.map
|