@antv/component 1.0.1-beta.1 → 1.0.1-beta.2
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 +14 -10
- package/esm/animation/utils.js.map +1 -1
- package/esm/ui/axis/constant.js +1 -0
- package/esm/ui/axis/constant.js.map +1 -1
- package/esm/ui/axis/guides/labels.js +9 -11
- package/esm/ui/axis/guides/labels.js.map +1 -1
- package/esm/ui/axis/guides/ticks.js +1 -1
- package/esm/ui/axis/guides/ticks.js.map +1 -1
- package/esm/ui/axis/guides/title.js +9 -6
- package/esm/ui/axis/guides/title.js.map +1 -1
- package/esm/ui/axis/overlap/autoEllipsis.js +2 -1
- package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/esm/ui/axis/overlap/autoHide.js +2 -1
- package/esm/ui/axis/overlap/autoHide.js.map +1 -1
- package/esm/ui/axis/utils/bounds.d.ts +1 -3
- package/esm/ui/axis/utils/bounds.js +7 -4
- package/esm/ui/axis/utils/bounds.js.map +1 -1
- package/esm/ui/breadcrumb/index.js +2 -2
- package/esm/ui/breadcrumb/index.js.map +1 -1
- package/esm/ui/button/index.js +6 -8
- package/esm/ui/button/index.js.map +1 -1
- package/esm/ui/button/types.d.ts +0 -2
- package/esm/ui/checkbox/constant.d.ts +2 -2
- package/esm/ui/checkbox/index.js +1 -1
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/indicator/indicator.js +1 -2
- package/esm/ui/indicator/indicator.js.map +1 -1
- package/esm/ui/indicator/types.d.ts +0 -2
- package/esm/ui/layout/layout.js +1 -3
- package/esm/ui/layout/layout.js.map +1 -1
- package/esm/ui/layout/types.d.ts +0 -2
- package/esm/ui/legend/category/item.d.ts +0 -2
- package/esm/ui/legend/category/item.js +4 -10
- package/esm/ui/legend/category/item.js.map +1 -1
- package/esm/ui/legend/category/items.d.ts +0 -2
- package/esm/ui/legend/category/items.js.map +1 -1
- package/esm/ui/legend/category.js +2 -4
- package/esm/ui/legend/category.js.map +1 -1
- package/esm/ui/legend/continuous.d.ts +1 -0
- package/esm/ui/legend/continuous.js +17 -5
- package/esm/ui/legend/continuous.js.map +1 -1
- package/esm/ui/marker/index.js +4 -4
- package/esm/ui/marker/index.js.map +1 -1
- package/esm/ui/marker/types.d.ts +0 -2
- package/esm/ui/navigator/index.js +0 -5
- package/esm/ui/navigator/index.js.map +1 -1
- package/esm/ui/navigator/types.d.ts +0 -2
- package/esm/ui/scrollbar/index.js +2 -4
- package/esm/ui/scrollbar/index.js.map +1 -1
- package/esm/ui/scrollbar/types.d.ts +0 -2
- package/esm/ui/select/option.js +1 -1
- package/esm/ui/select/option.js.map +1 -1
- package/esm/ui/select/select.js +9 -11
- package/esm/ui/select/select.js.map +1 -1
- package/esm/ui/select/types.d.ts +0 -4
- package/esm/ui/slider/constant.d.ts +0 -2
- package/esm/ui/slider/constant.js +0 -2
- package/esm/ui/slider/constant.js.map +1 -1
- package/esm/ui/slider/handle.d.ts +0 -4
- package/esm/ui/slider/handle.js +17 -14
- package/esm/ui/slider/handle.js.map +1 -1
- package/esm/ui/slider/index.js +16 -17
- package/esm/ui/slider/index.js.map +1 -1
- package/esm/ui/slider/types.d.ts +0 -2
- package/esm/ui/sparkline/columns.d.ts +0 -2
- package/esm/ui/sparkline/columns.js +1 -2
- package/esm/ui/sparkline/columns.js.map +1 -1
- package/esm/ui/sparkline/index.js +2 -4
- package/esm/ui/sparkline/index.js.map +1 -1
- package/esm/ui/sparkline/lines.d.ts +0 -2
- package/esm/ui/sparkline/lines.js +1 -2
- package/esm/ui/sparkline/lines.js.map +1 -1
- package/esm/ui/sparkline/types.d.ts +0 -2
- package/esm/ui/switch/index.js +0 -1
- package/esm/ui/switch/index.js.map +1 -1
- package/esm/ui/switch/types.d.ts +0 -2
- package/esm/ui/tag/index.js +0 -1
- package/esm/ui/tag/index.js.map +1 -1
- package/esm/ui/tag/types.d.ts +0 -2
- package/esm/ui/timebar/controller.js +8 -8
- package/esm/ui/timebar/controller.js.map +1 -1
- package/esm/ui/timebar/handle.d.ts +0 -4
- package/esm/ui/timebar/handle.js +7 -9
- package/esm/ui/timebar/handle.js.map +1 -1
- package/esm/ui/timebar/icons.js +90 -103
- package/esm/ui/timebar/icons.js.map +1 -1
- package/esm/ui/timebar/timebar.js +6 -14
- package/esm/ui/timebar/timebar.js.map +1 -1
- package/esm/ui/timebar/types.d.ts +0 -4
- package/esm/ui/tooltip/types.d.ts +0 -2
- package/esm/util/keyframe-interpolate.d.ts +1 -1
- package/esm/util/primitive.js +3 -0
- package/esm/util/primitive.js.map +1 -1
- package/esm/util/scale-to-pixel.js +2 -3
- package/esm/util/scale-to-pixel.js.map +1 -1
- package/lib/animation/fadeIn.d.ts +1 -1
- package/lib/animation/fadeOut.d.ts +1 -1
- package/lib/animation/utils.d.ts +3 -3
- package/lib/animation/utils.js +14 -10
- package/lib/animation/utils.js.map +1 -1
- package/lib/ui/axis/constant.js +1 -0
- package/lib/ui/axis/constant.js.map +1 -1
- package/lib/ui/axis/guides/labels.js +9 -11
- package/lib/ui/axis/guides/labels.js.map +1 -1
- package/lib/ui/axis/guides/ticks.js +1 -1
- package/lib/ui/axis/guides/ticks.js.map +1 -1
- package/lib/ui/axis/guides/title.js +8 -5
- package/lib/ui/axis/guides/title.js.map +1 -1
- package/lib/ui/axis/overlap/autoEllipsis.js +2 -1
- package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/lib/ui/axis/overlap/autoHide.js +2 -1
- package/lib/ui/axis/overlap/autoHide.js.map +1 -1
- package/lib/ui/axis/utils/bounds.d.ts +1 -3
- package/lib/ui/axis/utils/bounds.js +9 -5
- package/lib/ui/axis/utils/bounds.js.map +1 -1
- package/lib/ui/breadcrumb/index.js +2 -2
- package/lib/ui/breadcrumb/index.js.map +1 -1
- package/lib/ui/button/index.js +6 -8
- package/lib/ui/button/index.js.map +1 -1
- package/lib/ui/button/types.d.ts +0 -2
- package/lib/ui/checkbox/constant.d.ts +2 -2
- package/lib/ui/checkbox/index.js +1 -1
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/indicator/indicator.js +1 -2
- package/lib/ui/indicator/indicator.js.map +1 -1
- package/lib/ui/indicator/types.d.ts +0 -2
- package/lib/ui/layout/layout.js +1 -3
- package/lib/ui/layout/layout.js.map +1 -1
- package/lib/ui/layout/types.d.ts +0 -2
- package/lib/ui/legend/category/item.d.ts +0 -2
- package/lib/ui/legend/category/item.js +4 -10
- package/lib/ui/legend/category/item.js.map +1 -1
- package/lib/ui/legend/category/items.d.ts +0 -2
- package/lib/ui/legend/category/items.js.map +1 -1
- package/lib/ui/legend/category.js +2 -4
- package/lib/ui/legend/category.js.map +1 -1
- package/lib/ui/legend/continuous.d.ts +1 -0
- package/lib/ui/legend/continuous.js +17 -5
- package/lib/ui/legend/continuous.js.map +1 -1
- package/lib/ui/marker/index.js +4 -4
- package/lib/ui/marker/index.js.map +1 -1
- package/lib/ui/marker/types.d.ts +0 -2
- package/lib/ui/navigator/index.js +0 -5
- package/lib/ui/navigator/index.js.map +1 -1
- package/lib/ui/navigator/types.d.ts +0 -2
- package/lib/ui/scrollbar/index.js +2 -4
- package/lib/ui/scrollbar/index.js.map +1 -1
- package/lib/ui/scrollbar/types.d.ts +0 -2
- package/lib/ui/select/option.js +1 -1
- package/lib/ui/select/option.js.map +1 -1
- package/lib/ui/select/select.js +9 -11
- package/lib/ui/select/select.js.map +1 -1
- package/lib/ui/select/types.d.ts +0 -4
- package/lib/ui/slider/constant.d.ts +0 -2
- package/lib/ui/slider/constant.js +0 -2
- package/lib/ui/slider/constant.js.map +1 -1
- package/lib/ui/slider/handle.d.ts +0 -4
- package/lib/ui/slider/handle.js +17 -14
- package/lib/ui/slider/handle.js.map +1 -1
- package/lib/ui/slider/index.js +16 -17
- package/lib/ui/slider/index.js.map +1 -1
- package/lib/ui/slider/types.d.ts +0 -2
- package/lib/ui/sparkline/columns.d.ts +0 -2
- package/lib/ui/sparkline/columns.js +1 -2
- package/lib/ui/sparkline/columns.js.map +1 -1
- package/lib/ui/sparkline/index.js +2 -4
- package/lib/ui/sparkline/index.js.map +1 -1
- package/lib/ui/sparkline/lines.d.ts +0 -2
- package/lib/ui/sparkline/lines.js +1 -2
- package/lib/ui/sparkline/lines.js.map +1 -1
- package/lib/ui/sparkline/types.d.ts +0 -2
- package/lib/ui/switch/index.js +0 -1
- package/lib/ui/switch/index.js.map +1 -1
- package/lib/ui/switch/types.d.ts +0 -2
- package/lib/ui/tag/index.js +0 -1
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/tag/types.d.ts +0 -2
- package/lib/ui/timebar/controller.js +8 -8
- package/lib/ui/timebar/controller.js.map +1 -1
- package/lib/ui/timebar/handle.d.ts +0 -4
- package/lib/ui/timebar/handle.js +7 -9
- package/lib/ui/timebar/handle.js.map +1 -1
- package/lib/ui/timebar/icons.js +90 -103
- package/lib/ui/timebar/icons.js.map +1 -1
- package/lib/ui/timebar/timebar.js +6 -14
- package/lib/ui/timebar/timebar.js.map +1 -1
- package/lib/ui/timebar/types.d.ts +0 -4
- package/lib/ui/tooltip/types.d.ts +0 -2
- package/lib/util/keyframe-interpolate.d.ts +1 -1
- package/lib/util/primitive.js +3 -0
- package/lib/util/primitive.js.map +1 -1
- package/lib/util/scale-to-pixel.js +2 -3
- package/lib/util/scale-to-pixel.js.map +1 -1
- package/package.json +6 -6
- package/src/animation/utils.ts +15 -16
- package/src/ui/axis/constant.ts +1 -0
- package/src/ui/axis/guides/labels.ts +10 -18
- package/src/ui/axis/guides/ticks.ts +1 -1
- package/src/ui/axis/guides/title.ts +9 -9
- package/src/ui/axis/overlap/autoEllipsis.ts +2 -1
- package/src/ui/axis/overlap/autoHide.ts +2 -1
- package/src/ui/axis/utils/bounds.ts +7 -4
- package/src/ui/breadcrumb/index.ts +3 -2
- package/src/ui/button/index.ts +6 -10
- package/src/ui/button/types.ts +0 -2
- package/src/ui/checkbox/index.ts +2 -0
- package/src/ui/indicator/indicator.ts +1 -2
- package/src/ui/indicator/types.ts +0 -2
- package/src/ui/layout/layout.ts +1 -4
- package/src/ui/layout/types.ts +0 -2
- package/src/ui/legend/category/item.ts +4 -14
- package/src/ui/legend/category/items.ts +0 -2
- package/src/ui/legend/category.ts +2 -4
- package/src/ui/legend/continuous.ts +20 -5
- package/src/ui/marker/index.ts +4 -5
- package/src/ui/marker/types.ts +0 -2
- package/src/ui/navigator/index.ts +0 -7
- package/src/ui/navigator/types.ts +0 -2
- package/src/ui/scrollbar/index.ts +1 -5
- package/src/ui/scrollbar/types.ts +0 -2
- package/src/ui/select/option.ts +1 -1
- package/src/ui/select/select.ts +9 -11
- package/src/ui/select/types.ts +0 -4
- package/src/ui/slider/constant.ts +0 -2
- package/src/ui/slider/handle.ts +14 -26
- package/src/ui/slider/index.ts +12 -20
- package/src/ui/slider/types.ts +0 -2
- package/src/ui/sparkline/columns.ts +1 -4
- package/src/ui/sparkline/index.ts +2 -8
- package/src/ui/sparkline/lines.ts +1 -4
- package/src/ui/sparkline/types.ts +0 -2
- package/src/ui/switch/index.ts +0 -1
- package/src/ui/switch/types.ts +0 -2
- package/src/ui/tag/index.ts +0 -1
- package/src/ui/tag/types.ts +0 -2
- package/src/ui/timebar/controller.ts +8 -8
- package/src/ui/timebar/handle.ts +10 -16
- package/src/ui/timebar/icons.ts +86 -93
- package/src/ui/timebar/timebar.ts +9 -13
- package/src/ui/timebar/types.ts +0 -4
- package/src/ui/tooltip/types.ts +0 -2
- package/src/util/primitive.ts +3 -0
- package/src/util/scale-to-pixel.ts +1 -3
|
@@ -41,8 +41,6 @@ const CLASS_NAMES = classNames(
|
|
|
41
41
|
export class Navigator extends Component<NavigatorStyleProps> {
|
|
42
42
|
constructor(options: NavigatorOptions) {
|
|
43
43
|
super(options, {
|
|
44
|
-
x: 0,
|
|
45
|
-
y: 0,
|
|
46
44
|
animate: {
|
|
47
45
|
easing: 'linear',
|
|
48
46
|
duration: 200,
|
|
@@ -307,8 +305,6 @@ export class Navigator extends Component<NavigatorStyleProps> {
|
|
|
307
305
|
|
|
308
306
|
this.updatePageInfo();
|
|
309
307
|
|
|
310
|
-
// group.node().style.transform = `translate(${pageWidth + spacing}, ${pageHeight / 2})`;
|
|
311
|
-
|
|
312
308
|
// put it on the right side of the container
|
|
313
309
|
group.node().setLocalPosition(pageWidth + spacing, pageHeight / 2);
|
|
314
310
|
if (whetherToAddEventListener) {
|
|
@@ -322,9 +318,6 @@ export class Navigator extends Component<NavigatorStyleProps> {
|
|
|
322
318
|
}
|
|
323
319
|
|
|
324
320
|
render(attributes: NavigatorStyleProps, container: Group) {
|
|
325
|
-
const { x = 0, y = 0 } = attributes;
|
|
326
|
-
this.attr('transform', `translate(${x}, ${y})`);
|
|
327
|
-
|
|
328
321
|
/**
|
|
329
322
|
* container
|
|
330
323
|
* |- contentGroup (with clip path)
|
|
@@ -6,8 +6,6 @@ import type { PrefixObject } from '../../types';
|
|
|
6
6
|
export type NavigatorStyleProps = Omit<RectStyleProps, 'width' | 'height'> &
|
|
7
7
|
PrefixObject<PathStyleProps & { size?: number }, 'button'> &
|
|
8
8
|
PrefixObject<TextStyleProps, 'pageNum'> & {
|
|
9
|
-
x?: number;
|
|
10
|
-
y?: number;
|
|
11
9
|
animate?: GenericAnimation;
|
|
12
10
|
/** padding between buttons and page number */
|
|
13
11
|
controllerPadding?: number;
|
|
@@ -23,8 +23,6 @@ export class Scrollbar extends Component<ScrollbarStyleProps> {
|
|
|
23
23
|
|
|
24
24
|
constructor(options: ScrollbarOptions) {
|
|
25
25
|
super(options, {
|
|
26
|
-
x: 0,
|
|
27
|
-
y: 0,
|
|
28
26
|
isRound: true,
|
|
29
27
|
orientation: 'vertical',
|
|
30
28
|
padding: [2, 2, 2, 2],
|
|
@@ -92,13 +90,11 @@ export class Scrollbar extends Component<ScrollbarStyleProps> {
|
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
private renderSlider(container: Group) {
|
|
95
|
-
const {
|
|
93
|
+
const { orientation, trackSize, padding, slidable } = this.attributes;
|
|
96
94
|
const trackStyle = subStyleProps<RectStyleProps>(this.attributes, 'track');
|
|
97
95
|
const selectionStyle = subStyleProps<RectStyleProps>(this.attributes, 'thumb');
|
|
98
96
|
|
|
99
97
|
const style: SliderStyleProps = {
|
|
100
|
-
x,
|
|
101
|
-
y,
|
|
102
98
|
brushable: false,
|
|
103
99
|
orientation,
|
|
104
100
|
padding,
|
|
@@ -8,8 +8,6 @@ import type { SliderStyleProps } from '../slider';
|
|
|
8
8
|
export type ScrollbarStyleProps = GroupStyleProps &
|
|
9
9
|
PrefixObject<RectStyleProps, 'track'> &
|
|
10
10
|
PrefixObject<RectStyleProps, 'thumb'> & {
|
|
11
|
-
x?: number;
|
|
12
|
-
y?: number;
|
|
13
11
|
/** 滑条朝向 */
|
|
14
12
|
orientation?: Required<SliderStyleProps>['orientation'];
|
|
15
13
|
|
package/src/ui/select/option.ts
CHANGED
|
@@ -52,7 +52,7 @@ export class Option extends Component<OptionStyleProps> {
|
|
|
52
52
|
fill: selected ? this.selectedColor : '#fff',
|
|
53
53
|
});
|
|
54
54
|
// place label
|
|
55
|
-
this.label.attr({
|
|
55
|
+
this.label.attr({ x: left, y: (backgroundHeight - labelHeight) / 2 });
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
constructor(options: OptionOptions) {
|
package/src/ui/select/select.ts
CHANGED
|
@@ -9,8 +9,6 @@ import type { SelectOptions, SelectStyleProps } from './types';
|
|
|
9
9
|
export class Select extends Component<SelectStyleProps> {
|
|
10
10
|
static defaultOptions: SelectOptions = {
|
|
11
11
|
style: {
|
|
12
|
-
x: 0,
|
|
13
|
-
y: 0,
|
|
14
12
|
width: 140,
|
|
15
13
|
height: 32,
|
|
16
14
|
options: [],
|
|
@@ -76,10 +74,10 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
76
74
|
);
|
|
77
75
|
|
|
78
76
|
private renderSelect() {
|
|
79
|
-
const {
|
|
77
|
+
const { width, height, bordered, showDropdownIcon } = this.style;
|
|
80
78
|
const selectStyle = subStyleProps(this.attributes, 'select');
|
|
81
79
|
const placeholderStyle = subStyleProps(this.attributes, 'placeholder');
|
|
82
|
-
this.select.attr({
|
|
80
|
+
this.select.attr({ width, height, ...selectStyle, fill: '#fff', strokeWidth: bordered ? 1 : 0 });
|
|
83
81
|
const padding = this.dropdownPadding;
|
|
84
82
|
// dropdown icon
|
|
85
83
|
const iconSize = 10;
|
|
@@ -87,7 +85,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
87
85
|
select(this.select)
|
|
88
86
|
.maybeAppend('.dropdown-icon', 'path')
|
|
89
87
|
.style('d', 'M-5,-3.5 L0,3.5 L5,-3.5')
|
|
90
|
-
.style('transform', `translate(${
|
|
88
|
+
.style('transform', `translate(${width - iconSize - padding[1] - padding[3]}, ${height / 2})`)
|
|
91
89
|
.style('lineWidth', 1)
|
|
92
90
|
.style('stroke', this.select.style.stroke);
|
|
93
91
|
}
|
|
@@ -95,7 +93,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
95
93
|
const currentOption = this.style.options?.find((option) => option.value === this.currentValue);
|
|
96
94
|
// placeholder
|
|
97
95
|
const finalPlaceholderStyle = {
|
|
98
|
-
x:
|
|
96
|
+
x: padding[3],
|
|
99
97
|
...placeholderStyle,
|
|
100
98
|
};
|
|
101
99
|
select(this.select)
|
|
@@ -109,7 +107,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
109
107
|
.styles(finalPlaceholderStyle)
|
|
110
108
|
.style('y', function () {
|
|
111
109
|
const bbox = this.getBBox();
|
|
112
|
-
return
|
|
110
|
+
return (height - bbox.height) / 2;
|
|
113
111
|
}),
|
|
114
112
|
(update) => update.styles(finalPlaceholderStyle),
|
|
115
113
|
(exit) => exit.remove()
|
|
@@ -118,7 +116,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
118
116
|
// value
|
|
119
117
|
const labelStyle = subStyleProps(this.attributes, 'optionLabel');
|
|
120
118
|
const finalValueStyle = {
|
|
121
|
-
x:
|
|
119
|
+
x: padding[3],
|
|
122
120
|
...labelStyle,
|
|
123
121
|
};
|
|
124
122
|
|
|
@@ -133,7 +131,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
133
131
|
.styles(finalValueStyle)
|
|
134
132
|
.style('y', function () {
|
|
135
133
|
const bbox = this.getBBox();
|
|
136
|
-
return
|
|
134
|
+
return (height - bbox.height) / 2;
|
|
137
135
|
}),
|
|
138
136
|
(update) => update.styles(finalValueStyle),
|
|
139
137
|
(exit) => exit.remove()
|
|
@@ -141,7 +139,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
private renderDropdown() {
|
|
144
|
-
const {
|
|
142
|
+
const { width, height, options, onSelect, open } = this.style;
|
|
145
143
|
const dropdownStyle = subStyleProps(this.attributes, 'dropdown');
|
|
146
144
|
const optionStyle = subStyleProps(this.attributes, 'option');
|
|
147
145
|
const padding = this.dropdownPadding;
|
|
@@ -195,7 +193,7 @@ export class Select extends Component<SelectStyleProps> {
|
|
|
195
193
|
const { spacing } = dropdownStyle;
|
|
196
194
|
|
|
197
195
|
this.dropdown.attr({
|
|
198
|
-
|
|
196
|
+
y: height + spacing,
|
|
199
197
|
width: bbox.width + padding[1] + padding[3],
|
|
200
198
|
height: bbox.height + padding[0] + padding[2],
|
|
201
199
|
...dropdownStyle,
|
package/src/ui/select/types.ts
CHANGED
|
@@ -28,10 +28,6 @@ export type SelectStyleProps = GroupStyleProps &
|
|
|
28
28
|
PrefixObject<Omit<RectStyleProps, 'width' | 'height'>, 'dropdown'> &
|
|
29
29
|
PrefixObject<TextStyleProps, 'option'> &
|
|
30
30
|
PrefixObject<Omit<OptionStyleProps, 'value' | 'label' | 'selected' | 'onClick'>, 'option'> & {
|
|
31
|
-
/** 左上角 X 坐标 */
|
|
32
|
-
x?: number;
|
|
33
|
-
/** 左上角 Y 坐标 */
|
|
34
|
-
y?: number;
|
|
35
31
|
/** 宽度 */
|
|
36
32
|
width?: number;
|
|
37
33
|
/** 高度 */
|
package/src/ui/slider/handle.ts
CHANGED
|
@@ -8,8 +8,6 @@ import { HANDLE_DEFAULT_CFG, HANDLE_ICON_DEFAULT_CFG, HANDLE_LABEL_DEFAULT_CFG }
|
|
|
8
8
|
export type HandleType = 'start' | 'end';
|
|
9
9
|
|
|
10
10
|
export type IconStyleProps = PathStyleProps & {
|
|
11
|
-
x?: number;
|
|
12
|
-
y?: number;
|
|
13
11
|
size?: number;
|
|
14
12
|
radius?: number;
|
|
15
13
|
shape?: string | ((type: HandleType) => DisplayObject);
|
|
@@ -21,8 +19,6 @@ export type LabelStyleProps = Partial<TextStyleProps>;
|
|
|
21
19
|
export type HandleStyleProps = GroupStyleProps &
|
|
22
20
|
PrefixStyleProps<LabelStyleProps, 'label'> &
|
|
23
21
|
PrefixStyleProps<IconStyleProps, 'icon'> & {
|
|
24
|
-
x?: number;
|
|
25
|
-
y?: number;
|
|
26
22
|
orientation?: IconStyleProps['orientation'];
|
|
27
23
|
showLabel?: boolean;
|
|
28
24
|
spacing?: number;
|
|
@@ -45,7 +41,7 @@ const CLASS_NAMES = classNames(
|
|
|
45
41
|
|
|
46
42
|
class HandleIcon extends Component<IconStyleProps> {
|
|
47
43
|
render(attributes: Required<IconStyleProps>, container: DisplayObject) {
|
|
48
|
-
const {
|
|
44
|
+
const { size = 10, radius = size / 4, orientation, ...iconStyle } = attributes;
|
|
49
45
|
// 默认手柄
|
|
50
46
|
const width = size!;
|
|
51
47
|
const height = width * 2.4;
|
|
@@ -57,20 +53,21 @@ class HandleIcon extends Component<IconStyleProps> {
|
|
|
57
53
|
width,
|
|
58
54
|
height,
|
|
59
55
|
radius,
|
|
60
|
-
x:
|
|
61
|
-
y:
|
|
62
|
-
transformOrigin: 'center',
|
|
56
|
+
x: -width / 2,
|
|
57
|
+
y: -height / 2,
|
|
63
58
|
});
|
|
64
59
|
|
|
65
|
-
const x1 =
|
|
66
|
-
const x2 =
|
|
67
|
-
const y1 =
|
|
68
|
-
const y2 =
|
|
60
|
+
const x1 = (1 / 3) * width;
|
|
61
|
+
const x2 = (2 / 3) * width;
|
|
62
|
+
const y1 = (1 / 4) * height;
|
|
63
|
+
const y2 = (3 / 4) * height;
|
|
69
64
|
|
|
70
65
|
rect.maybeAppendByClassName(`${CLASS_NAMES.iconLine}-1`, 'line').styles({ x1, x2: x1, y1, y2, ...iconStyle });
|
|
71
66
|
rect.maybeAppendByClassName(`${CLASS_NAMES.iconLine}-2`, 'line').styles({ x1: x2, x2, y1, y2, ...iconStyle });
|
|
72
67
|
|
|
73
|
-
|
|
68
|
+
rect.node().setOrigin(width / 2, height / 2);
|
|
69
|
+
if (orientation === 'vertical') container.setLocalEulerAngles(90);
|
|
70
|
+
else container.setLocalEulerAngles(0);
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
|
|
@@ -84,14 +81,8 @@ export class Handle extends Component<HandleStyleProps> {
|
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
private renderLabel(container: Group) {
|
|
87
|
-
const {
|
|
88
|
-
const {
|
|
89
|
-
x: labelX = 0,
|
|
90
|
-
y: labelY = 0,
|
|
91
|
-
transform,
|
|
92
|
-
transformOrigin,
|
|
93
|
-
...style
|
|
94
|
-
} = subStyleProps(this.attributes, 'label');
|
|
84
|
+
const { showLabel } = this.attributes;
|
|
85
|
+
const { transform, ...style } = subStyleProps(this.attributes, 'label');
|
|
95
86
|
const [labelStyle, groupStyle] = splitStyle(style, []);
|
|
96
87
|
|
|
97
88
|
const labelGroup = select(container).maybeAppendByClassName(CLASS_NAMES.labelGroup, 'g').styles(groupStyle);
|
|
@@ -101,10 +92,7 @@ export class Handle extends Component<HandleStyleProps> {
|
|
|
101
92
|
ifShow(!!showLabel, labelGroup, (group) => {
|
|
102
93
|
this.label = group.maybeAppendByClassName(CLASS_NAMES.label, 'text').styles({
|
|
103
94
|
...rest,
|
|
104
|
-
x: x + labelX,
|
|
105
|
-
y: y + labelY,
|
|
106
95
|
transform,
|
|
107
|
-
transformOrigin,
|
|
108
96
|
text: `${text}`,
|
|
109
97
|
});
|
|
110
98
|
|
|
@@ -119,8 +107,8 @@ export class Handle extends Component<HandleStyleProps> {
|
|
|
119
107
|
}
|
|
120
108
|
|
|
121
109
|
private renderIcon(container: Group) {
|
|
122
|
-
const {
|
|
123
|
-
const iconStyle = {
|
|
110
|
+
const { orientation, type } = this.attributes;
|
|
111
|
+
const iconStyle = { orientation, ...HANDLE_ICON_DEFAULT_CFG, ...subStyleProps(this.attributes, 'icon') };
|
|
124
112
|
const { iconShape = () => new HandleIcon({ style: iconStyle }) } = this.attributes;
|
|
125
113
|
const iconGroup = select(container).maybeAppendByClassName(CLASS_NAMES.iconGroup, 'g');
|
|
126
114
|
iconGroup
|
package/src/ui/slider/index.ts
CHANGED
|
@@ -83,7 +83,7 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
private get availableSpace() {
|
|
86
|
-
const {
|
|
86
|
+
const { padding } = this.attributes;
|
|
87
87
|
const [top, right, bottom, left] = parseSeriesAttr(padding!);
|
|
88
88
|
const { width, height } = this.shape;
|
|
89
89
|
return {
|
|
@@ -96,8 +96,6 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
96
96
|
|
|
97
97
|
constructor(options: SliderOptions) {
|
|
98
98
|
super(options, {
|
|
99
|
-
x: 0,
|
|
100
|
-
y: 0,
|
|
101
99
|
animate: { duration: 100, fill: 'both' },
|
|
102
100
|
brushable: true,
|
|
103
101
|
formatter: (val: any) => val.toString(),
|
|
@@ -169,21 +167,18 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
private renderTrack(container: Group) {
|
|
172
|
-
const { x, y } = this.attributes;
|
|
173
170
|
const style = subStyleProps(this.attributes, 'track');
|
|
174
171
|
|
|
175
172
|
this.trackShape = select(container)
|
|
176
173
|
.maybeAppendByClassName(CLASS_NAMES.track, 'rect')
|
|
177
|
-
.styles({
|
|
174
|
+
.styles({ ...this.shape, ...style });
|
|
178
175
|
}
|
|
179
176
|
|
|
180
177
|
private renderBrushArea(container: Group) {
|
|
181
|
-
const {
|
|
178
|
+
const { brushable } = this.attributes;
|
|
182
179
|
this.brushArea = select(container)
|
|
183
180
|
.maybeAppendByClassName(CLASS_NAMES.brushArea, 'rect')
|
|
184
181
|
.styles({
|
|
185
|
-
x,
|
|
186
|
-
y,
|
|
187
182
|
fill: 'transparent',
|
|
188
183
|
cursor: brushable ? 'crosshair' : 'default',
|
|
189
184
|
...this.shape,
|
|
@@ -191,11 +186,11 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
191
186
|
}
|
|
192
187
|
|
|
193
188
|
private renderSparkline(container: Group) {
|
|
194
|
-
const {
|
|
189
|
+
const { orientation } = this.attributes;
|
|
195
190
|
const sparklineGroup = select(container).maybeAppendByClassName(CLASS_NAMES.sparklineGroup, 'g');
|
|
196
191
|
|
|
197
192
|
ifShow(orientation === 'horizontal', sparklineGroup, (group) => {
|
|
198
|
-
const style =
|
|
193
|
+
const style = this.sparklineStyle!;
|
|
199
194
|
group.maybeAppendByClassName(CLASS_NAMES.sparkline, () => new Sparkline({ style })).update(style);
|
|
200
195
|
});
|
|
201
196
|
}
|
|
@@ -237,7 +232,7 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
237
232
|
}
|
|
238
233
|
|
|
239
234
|
private renderSelection(container: Group) {
|
|
240
|
-
const {
|
|
235
|
+
const { type, selectionType } = this.attributes;
|
|
241
236
|
this.foregroundGroup = select(container).maybeAppendByClassName(CLASS_NAMES.foreground, 'g');
|
|
242
237
|
|
|
243
238
|
// value 类型的 slider 不渲染选区
|
|
@@ -250,10 +245,7 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
250
245
|
if (selectionType === 'invert') return 'crosshair';
|
|
251
246
|
return 'default';
|
|
252
247
|
})
|
|
253
|
-
.styles(
|
|
254
|
-
...selectionStyle,
|
|
255
|
-
transform: `translate(${x}, ${y})`,
|
|
256
|
-
});
|
|
248
|
+
.styles(selectionStyle);
|
|
257
249
|
};
|
|
258
250
|
|
|
259
251
|
const that = this;
|
|
@@ -389,8 +381,8 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
389
381
|
private inferTextStyle(handleType: HandleType): Record<string, any> {
|
|
390
382
|
const { orientation } = this.attributes;
|
|
391
383
|
if (orientation === 'horizontal') return {};
|
|
392
|
-
if (handleType === 'start') return {
|
|
393
|
-
if (handleType === 'end') return {
|
|
384
|
+
if (handleType === 'start') return { transform: 'rotate(90)', textAlign: 'start' };
|
|
385
|
+
if (handleType === 'end') return { transform: 'rotate(90)', textAlign: 'end' };
|
|
394
386
|
return {};
|
|
395
387
|
}
|
|
396
388
|
|
|
@@ -478,8 +470,8 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
478
470
|
}
|
|
479
471
|
|
|
480
472
|
private getHandleStyle(handleType: HandleType): HandleStyleProps {
|
|
481
|
-
const {
|
|
482
|
-
const
|
|
473
|
+
const { showLabel, showLabelOnInteraction, orientation } = this.attributes;
|
|
474
|
+
const handlePosition = this.calcHandlePosition(handleType);
|
|
483
475
|
const textStyle = this.calcHandleText(handleType);
|
|
484
476
|
|
|
485
477
|
let internalShowLabel = showLabel;
|
|
@@ -491,7 +483,7 @@ export class Slider extends Component<SliderStyleProps> {
|
|
|
491
483
|
return {
|
|
492
484
|
...superStyleProps(this.getHandleIconStyle(), 'icon'),
|
|
493
485
|
...superStyleProps({ ...this.getHandleLabelStyle(handleType), ...textStyle }, 'label'),
|
|
494
|
-
|
|
486
|
+
...handlePosition,
|
|
495
487
|
orientation,
|
|
496
488
|
showLabel: internalShowLabel,
|
|
497
489
|
type: handleType,
|
package/src/ui/slider/types.ts
CHANGED
|
@@ -21,8 +21,6 @@ export type SliderStyleProps = GroupStyleProps &
|
|
|
21
21
|
PrefixObject<RectStyleProps, 'selection'> &
|
|
22
22
|
HandleStyleProps &
|
|
23
23
|
Partial<PrefixStyleProps<Omit<SparklineStyleProps, 'width' | 'height'>, 'sparkline'>> & {
|
|
24
|
-
x?: number;
|
|
25
|
-
y?: number;
|
|
26
24
|
/** 动画配置 */
|
|
27
25
|
animate?: GenericAnimation;
|
|
28
26
|
|
|
@@ -5,8 +5,6 @@ import { deepAssign, select } from '../../util';
|
|
|
5
5
|
export type ColumnStyleProps = GroupStyleProps;
|
|
6
6
|
|
|
7
7
|
export interface ColumnsStyleProps extends BaseStyleProps {
|
|
8
|
-
x?: number;
|
|
9
|
-
y?: number;
|
|
10
8
|
columns: ColumnStyleProps[][];
|
|
11
9
|
}
|
|
12
10
|
|
|
@@ -21,8 +19,7 @@ export class Columns extends DisplayObject<ColumnsStyleProps> {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
public render(): void {
|
|
24
|
-
const { columns
|
|
25
|
-
this.columnsGroup.style.transform = `translate(${x}, ${y})`;
|
|
22
|
+
const { columns } = this.attributes;
|
|
26
23
|
|
|
27
24
|
select(this.columnsGroup)
|
|
28
25
|
.selectAll('.column')
|
|
@@ -155,8 +155,6 @@ export class Sparkline extends Component<SparklineStyleProps> {
|
|
|
155
155
|
constructor(options: SparklineOptions) {
|
|
156
156
|
super(options, {
|
|
157
157
|
type: 'line',
|
|
158
|
-
x: 0,
|
|
159
|
-
y: 0,
|
|
160
158
|
width: 200,
|
|
161
159
|
height: 20,
|
|
162
160
|
isStack: false,
|
|
@@ -175,13 +173,9 @@ export class Sparkline extends Component<SparklineStyleProps> {
|
|
|
175
173
|
public render(attributes: Required<SparklineStyleProps>, container: Group) {
|
|
176
174
|
maybeAppend(container, '.container', 'rect').attr('className', 'container').node();
|
|
177
175
|
|
|
178
|
-
const { type
|
|
176
|
+
const { type } = attributes;
|
|
179
177
|
const className = `spark${type}`;
|
|
180
|
-
const style: any =
|
|
181
|
-
x,
|
|
182
|
-
y,
|
|
183
|
-
...(type === 'line' ? this.linesStyle : this.columnsStyle),
|
|
184
|
-
};
|
|
178
|
+
const style: any = type === 'line' ? this.linesStyle : this.columnsStyle;
|
|
185
179
|
|
|
186
180
|
select(container)
|
|
187
181
|
.selectAll('.spark')
|
|
@@ -4,8 +4,6 @@ import { DisplayObject, Group } from '../../shapes';
|
|
|
4
4
|
import { deepAssign, select } from '../../util';
|
|
5
5
|
|
|
6
6
|
export interface LinesStyleProps extends BaseStyleProps {
|
|
7
|
-
x?: number;
|
|
8
|
-
y?: number;
|
|
9
7
|
lines: PathStyleProps[];
|
|
10
8
|
areas: PathStyleProps[];
|
|
11
9
|
}
|
|
@@ -21,8 +19,7 @@ export class Lines extends DisplayObject<LinesStyleProps> {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
public render(): void {
|
|
24
|
-
const { lines, areas
|
|
25
|
-
this.style.transform = `translate(${x}, ${y})`;
|
|
22
|
+
const { lines, areas } = this.attributes;
|
|
26
23
|
if (lines) this.renderLines(lines);
|
|
27
24
|
if (areas) this.renderAreas(areas);
|
|
28
25
|
}
|
|
@@ -31,8 +31,6 @@ type ColumnStyleProps = CallableObject<PrefixObject<RectStyleProps, 'column'>, C
|
|
|
31
31
|
export type SparklineStyleProps = GroupStyleProps &
|
|
32
32
|
LineStyleProps &
|
|
33
33
|
ColumnStyleProps & {
|
|
34
|
-
x?: number;
|
|
35
|
-
y?: number;
|
|
36
34
|
color?: string | string[] | ((idx: number) => string);
|
|
37
35
|
data?: number[] | number[][];
|
|
38
36
|
isStack?: boolean;
|
package/src/ui/switch/index.ts
CHANGED
|
@@ -92,7 +92,6 @@ export class Switch extends Component<SwitchStyleProps> {
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// 增加 整体宽度 需要对 tag 提前渲染获得 width 然后通过 width 计算 x 的位置
|
|
95
|
-
// @ts-ignore
|
|
96
95
|
const { max, min } = tagShape?.getLocalBounds() || {};
|
|
97
96
|
const width = max[0] - min[0] + sizeStyle.radius;
|
|
98
97
|
const height = max[1] - min[1];
|
package/src/ui/switch/types.ts
CHANGED
|
@@ -3,8 +3,6 @@ import type { ComponentOptions } from '../../core';
|
|
|
3
3
|
import type { TagStyleProps } from '../tag';
|
|
4
4
|
|
|
5
5
|
export type SwitchStyleProps = GroupStyleProps & {
|
|
6
|
-
x?: number;
|
|
7
|
-
y?: number;
|
|
8
6
|
/**
|
|
9
7
|
* @title 大小
|
|
10
8
|
* @description switch 开关组件大小。默认为: default, 高度大小等于 22px,宽度默认等于高度的两倍,会随着内部的子元素大小自动调整。
|
package/src/ui/tag/index.ts
CHANGED
package/src/ui/tag/types.ts
CHANGED
|
@@ -6,8 +6,6 @@ import type { MarkerStyleProps } from '../marker';
|
|
|
6
6
|
export type TagStyleProps = GroupStyleProps &
|
|
7
7
|
PrefixStyleProps<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'label'> &
|
|
8
8
|
PrefixStyleProps<Partial<RectStyleProps>, 'background'> & {
|
|
9
|
-
x?: number;
|
|
10
|
-
y?: number;
|
|
11
9
|
text?: string;
|
|
12
10
|
/** 水平对齐方式 */
|
|
13
11
|
align?: 'start' | 'center' | 'end';
|
|
@@ -19,8 +19,6 @@ const componentsMap: Record<Functions | 'split', { new (...args: any): DisplayOb
|
|
|
19
19
|
export class Controller extends Component<ControllerStyleProps> {
|
|
20
20
|
static defaultOptions: ControllerOptions = {
|
|
21
21
|
style: {
|
|
22
|
-
x: 0,
|
|
23
|
-
y: 0,
|
|
24
22
|
width: 300,
|
|
25
23
|
height: 40,
|
|
26
24
|
padding: 0,
|
|
@@ -52,13 +50,13 @@ export class Controller extends Component<ControllerStyleProps> {
|
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
private renderBackground() {
|
|
55
|
-
const {
|
|
53
|
+
const { width, height } = this.style;
|
|
56
54
|
const backgroundStyle = subStyleProps(this.attributes, 'background');
|
|
57
|
-
this.background.attr({
|
|
55
|
+
this.background.attr({ width, height, ...backgroundStyle });
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
private renderFunctions() {
|
|
61
|
-
const { functions, iconSize, iconSpacing,
|
|
59
|
+
const { functions, iconSize, iconSpacing, width, height, align } = this.attributes;
|
|
62
60
|
|
|
63
61
|
const {
|
|
64
62
|
padding: [, right, , left],
|
|
@@ -87,8 +85,8 @@ export class Controller extends Component<ControllerStyleProps> {
|
|
|
87
85
|
components.forEach((name, index) => {
|
|
88
86
|
const Ctor = componentsMap[name];
|
|
89
87
|
const style: Record<string, any> = {
|
|
90
|
-
x:
|
|
91
|
-
y:
|
|
88
|
+
x: index * (iconSize + iconSpacing) + xOffset,
|
|
89
|
+
y: height / 2,
|
|
92
90
|
size: iconSize,
|
|
93
91
|
};
|
|
94
92
|
|
|
@@ -107,9 +105,11 @@ export class Controller extends Component<ControllerStyleProps> {
|
|
|
107
105
|
|
|
108
106
|
if (Ctor === SpeedSelect) {
|
|
109
107
|
// SpeedSelect 直接插入到 canvas
|
|
108
|
+
const { x: baseX, y: baseY } = this.getBBox();
|
|
109
|
+
const { x, y } = style;
|
|
110
110
|
const canvas = this.ownerDocument?.defaultView;
|
|
111
111
|
if (canvas) {
|
|
112
|
-
this.speedSelect = new Ctor({ style: { ...style, zIndex: 100 } }) as SpeedSelect;
|
|
112
|
+
this.speedSelect = new Ctor({ style: { ...style, zIndex: 100, x: baseX + x, y: baseY + y } }) as SpeedSelect;
|
|
113
113
|
(canvas as unknown as Canvas).appendChild(this.speedSelect);
|
|
114
114
|
}
|
|
115
115
|
} else {
|
package/src/ui/timebar/handle.ts
CHANGED
|
@@ -40,10 +40,6 @@ type ChartModeHandleStyleProps = GroupStyleProps &
|
|
|
40
40
|
PrefixObject<Omit<RectStyleProps, 'x' | 'y' | 'width' | 'height'>, 'background'> &
|
|
41
41
|
PrefixObject<Omit<LineStyleProps, 'x1' | 'y1' | 'x2' | 'y2'>, 'icon'> &
|
|
42
42
|
PrefixObject<Omit<LineStyleProps, 'x1' | 'y1' | 'x2' | 'y2'>, 'border'> & {
|
|
43
|
-
x?: number;
|
|
44
|
-
y?: number;
|
|
45
|
-
width?: number;
|
|
46
|
-
height?: number;
|
|
47
43
|
/** 图标尺寸 */
|
|
48
44
|
iconSize?: number;
|
|
49
45
|
type: HandleType;
|
|
@@ -52,8 +48,6 @@ type ChartModeHandleOptions = ComponentOptions<ChartModeHandleStyleProps>;
|
|
|
52
48
|
export class ChartModeHandle extends Component<ChartModeHandleStyleProps> {
|
|
53
49
|
static defaultOptions: ChartModeHandleOptions = {
|
|
54
50
|
style: {
|
|
55
|
-
x: 0,
|
|
56
|
-
y: 0,
|
|
57
51
|
width: 10,
|
|
58
52
|
height: 50,
|
|
59
53
|
iconSize: 10,
|
|
@@ -68,41 +62,41 @@ export class ChartModeHandle extends Component<ChartModeHandleStyleProps> {
|
|
|
68
62
|
};
|
|
69
63
|
|
|
70
64
|
private renderBackground() {
|
|
71
|
-
const {
|
|
65
|
+
const { width, height } = this.attributes;
|
|
72
66
|
const style = subStyleProps(this.attributes, 'background');
|
|
73
67
|
select(this)
|
|
74
68
|
.maybeAppend('background', 'rect')
|
|
75
69
|
.attr('className', 'background')
|
|
76
|
-
.styles({ x:
|
|
70
|
+
.styles({ x: -width / 2, y: -height / 2, width, height, ...style });
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
private renderIcon() {
|
|
80
|
-
const {
|
|
74
|
+
const { iconSize } = this.attributes;
|
|
81
75
|
const style = subStyleProps(this.attributes, 'icon');
|
|
82
76
|
const diffX = 1;
|
|
83
77
|
const diffY = iconSize / 2;
|
|
84
78
|
select(this)
|
|
85
79
|
.maybeAppend('icon-left-line', 'line')
|
|
86
80
|
.attr('className', 'icon-left-line')
|
|
87
|
-
.styles({ x1:
|
|
81
|
+
.styles({ x1: -diffX, y1: -diffY, x2: -diffX, y2: diffY, ...style });
|
|
88
82
|
select(this)
|
|
89
83
|
.maybeAppend('icon-right-line', 'line')
|
|
90
84
|
.attr('className', 'icon-right-line')
|
|
91
|
-
.styles({ x1:
|
|
85
|
+
.styles({ x1: diffX, y1: -diffY, x2: diffX, y2: diffY, ...style });
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
private renderBorder() {
|
|
95
|
-
const {
|
|
89
|
+
const { width, height, type } = this.attributes;
|
|
96
90
|
const style = subStyleProps(this.attributes, 'border');
|
|
97
91
|
const x = type === 'start' ? +width / 2 : -width / 2;
|
|
98
92
|
select(this)
|
|
99
93
|
.maybeAppend('border', 'line')
|
|
100
94
|
.attr('className', 'border')
|
|
101
95
|
.styles({
|
|
102
|
-
x1: x
|
|
103
|
-
y1:
|
|
104
|
-
x2: x
|
|
105
|
-
y2:
|
|
96
|
+
x1: x,
|
|
97
|
+
y1: -height / 2,
|
|
98
|
+
x2: x,
|
|
99
|
+
y2: +height / 2,
|
|
106
100
|
...style,
|
|
107
101
|
});
|
|
108
102
|
}
|