@antv/component 1.0.1-beta.5 → 1.0.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/axis.d.ts +1 -1
- package/esm/ui/axis/constant.js +2 -1
- package/esm/ui/axis/constant.js.map +1 -1
- package/esm/ui/axis/guides/grid.d.ts +1 -1
- package/esm/ui/axis/guides/labels.d.ts +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/line.js +2 -2
- 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 +1 -1
- 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 +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 +4 -4
- package/esm/ui/checkbox/constant.js +1 -1
- package/esm/ui/checkbox/constant.js.map +1 -1
- package/esm/ui/checkbox/index.js +1 -1
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/crosshair/base.js +1 -1
- package/esm/ui/crosshair/base.js.map +1 -1
- package/esm/ui/crosshair/circle.js +1 -1
- package/esm/ui/crosshair/circle.js.map +1 -1
- package/esm/ui/crosshair/polygon.js +1 -1
- package/esm/ui/crosshair/polygon.js.map +1 -1
- package/esm/ui/grid/index.d.ts +1 -1
- package/esm/ui/grid/index.js +4 -4
- package/esm/ui/grid/index.js.map +1 -1
- package/esm/ui/indicator/indicator.js +2 -3
- 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/base.d.ts +1 -1
- 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 +3 -4
- package/esm/ui/legend/category.js.map +1 -1
- package/esm/ui/legend/continuous/ribbon.js +4 -4
- package/esm/ui/legend/continuous/ribbon.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 +1 -6
- 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 -18
- 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 +4 -6
- 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.d.ts +2 -2
- package/esm/ui/timebar/icons.js +91 -104
- 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/number.d.ts +2 -2
- package/esm/util/offscreen.js +0 -1
- package/esm/util/offscreen.js.map +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/esm/util/text.d.ts +1 -6
- 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/axis.d.ts +1 -1
- package/lib/ui/axis/constant.js +2 -1
- package/lib/ui/axis/constant.js.map +1 -1
- package/lib/ui/axis/guides/grid.d.ts +1 -1
- package/lib/ui/axis/guides/labels.d.ts +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/line.js +2 -2
- 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 +1 -1
- 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 +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 +4 -4
- package/lib/ui/checkbox/constant.js +1 -1
- package/lib/ui/checkbox/constant.js.map +1 -1
- package/lib/ui/checkbox/index.js +1 -1
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/crosshair/base.js +1 -1
- package/lib/ui/crosshair/base.js.map +1 -1
- package/lib/ui/crosshair/circle.js +1 -1
- package/lib/ui/crosshair/circle.js.map +1 -1
- package/lib/ui/crosshair/polygon.js +1 -1
- package/lib/ui/crosshair/polygon.js.map +1 -1
- package/lib/ui/grid/index.d.ts +1 -1
- package/lib/ui/grid/index.js +4 -4
- package/lib/ui/grid/index.js.map +1 -1
- package/lib/ui/indicator/indicator.js +2 -3
- 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/base.d.ts +1 -1
- 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 +3 -4
- package/lib/ui/legend/category.js.map +1 -1
- package/lib/ui/legend/continuous/ribbon.js +4 -4
- package/lib/ui/legend/continuous/ribbon.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 +1 -6
- 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 -18
- 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 +4 -6
- 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.d.ts +2 -2
- package/lib/ui/timebar/icons.js +91 -104
- 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/number.d.ts +2 -2
- package/lib/util/offscreen.js +0 -1
- package/lib/util/offscreen.js.map +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/lib/util/text.d.ts +1 -6
- package/package.json +6 -6
- package/src/animation/utils.ts +15 -16
- package/src/ui/axis/constant.ts +2 -1
- package/src/ui/axis/guides/labels.ts +10 -18
- package/src/ui/axis/guides/line.ts +2 -2
- 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/constant.ts +1 -1
- package/src/ui/checkbox/index.ts +2 -0
- package/src/ui/crosshair/base.ts +1 -1
- package/src/ui/crosshair/circle.ts +1 -1
- package/src/ui/crosshair/polygon.ts +1 -1
- package/src/ui/grid/index.ts +4 -4
- package/src/ui/indicator/indicator.ts +2 -3
- 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 +3 -4
- package/src/ui/legend/continuous/ribbon.ts +4 -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 +1 -8
- 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 +13 -23
- package/src/ui/slider/types.ts +0 -2
- package/src/ui/sparkline/columns.ts +1 -4
- package/src/ui/sparkline/index.ts +4 -10
- 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 +87 -94
- 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/offscreen.ts +0 -1
- package/src/util/primitive.ts +3 -0
- package/src/util/scale-to-pixel.ts +1 -3
|
@@ -90,13 +90,13 @@ export class Sparkline extends Component<SparklineStyleProps> {
|
|
|
90
90
|
lines: lines.map((line, idx) => {
|
|
91
91
|
return {
|
|
92
92
|
stroke: this.getColor(idx),
|
|
93
|
-
|
|
93
|
+
path: smooth ? lineToCurvePath(line) : lineToLinePath(line),
|
|
94
94
|
...lineStyle,
|
|
95
95
|
};
|
|
96
96
|
}) as any,
|
|
97
97
|
areas: areas.map((path, idx) => {
|
|
98
98
|
return {
|
|
99
|
-
|
|
99
|
+
path,
|
|
100
100
|
fill: this.getColor(idx),
|
|
101
101
|
...areaStyle,
|
|
102
102
|
};
|
|
@@ -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
|
}
|
package/src/ui/timebar/icons.ts
CHANGED
|
@@ -66,10 +66,10 @@ export abstract class IconBase<T extends Record<string, any> = {}> extends Compo
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
protected renderBackground() {
|
|
69
|
-
const {
|
|
69
|
+
const { size } = this.attributes;
|
|
70
70
|
const halfSize = size / 2;
|
|
71
71
|
const backgroundStyle = subStyleProps(this.attributes, 'background');
|
|
72
|
-
this.background.attr({ x:
|
|
72
|
+
this.background.attr({ x: -halfSize, y: -halfSize, width: size, height: size, ...backgroundStyle });
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
protected showIndicator() {
|
|
@@ -161,7 +161,8 @@ const arrow = (size: number, color: string = '#565758') => {
|
|
|
161
161
|
return new Path({
|
|
162
162
|
style: {
|
|
163
163
|
fill: color,
|
|
164
|
-
|
|
164
|
+
anchor: '0.5 0.5',
|
|
165
|
+
path: `M ${size},${size} L -${size},0 L ${size},-${size} Z`,
|
|
165
166
|
transformOrigin: 'center',
|
|
166
167
|
},
|
|
167
168
|
});
|
|
@@ -182,7 +183,7 @@ export class Reset extends IconBase {
|
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
renderIcon() {
|
|
185
|
-
const {
|
|
186
|
+
const { color } = this.attributes;
|
|
186
187
|
const size = this.iconSize;
|
|
187
188
|
const { lineWidth } = this;
|
|
188
189
|
const arrowSize = lineWidth + 0.5;
|
|
@@ -192,7 +193,7 @@ export class Reset extends IconBase {
|
|
|
192
193
|
.styles({
|
|
193
194
|
stroke: color,
|
|
194
195
|
lineWidth,
|
|
195
|
-
|
|
196
|
+
path: this.arcPath(0, 0, size / 2 - lineWidth),
|
|
196
197
|
markerStart: arrow(arrowSize, color),
|
|
197
198
|
});
|
|
198
199
|
}
|
|
@@ -205,19 +206,19 @@ export class Backward extends IconBase {
|
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
renderIcon() {
|
|
208
|
-
const {
|
|
209
|
+
const { color } = this.attributes;
|
|
209
210
|
const size = this.iconSize;
|
|
210
211
|
const deltaX = size / 2;
|
|
211
212
|
const deltaY = size / 2 / 3 ** 0.5;
|
|
212
213
|
const points: PolygonStyleProps['points'] = [
|
|
213
|
-
[
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
-
[
|
|
217
|
-
[
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
214
|
+
[0, 0],
|
|
215
|
+
[0, -deltaY],
|
|
216
|
+
[-deltaX, 0],
|
|
217
|
+
[0, deltaY],
|
|
218
|
+
[0, 0],
|
|
219
|
+
[deltaX, -deltaY],
|
|
220
|
+
[deltaX, deltaY],
|
|
221
|
+
[0, 0],
|
|
221
222
|
];
|
|
222
223
|
select(this.icon).maybeAppend('.backward', 'polygon').styles({
|
|
223
224
|
points,
|
|
@@ -233,19 +234,19 @@ export class Forward extends IconBase {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
renderIcon() {
|
|
236
|
-
const {
|
|
237
|
+
const { color } = this.attributes;
|
|
237
238
|
const size = this.iconSize;
|
|
238
239
|
const deltaX = size / 2;
|
|
239
240
|
const deltaY = size / 2 / 3 ** 0.5;
|
|
240
241
|
const points: PolygonStyleProps['points'] = [
|
|
241
|
-
[
|
|
242
|
-
[
|
|
243
|
-
[
|
|
244
|
-
[
|
|
245
|
-
[
|
|
246
|
-
[
|
|
247
|
-
[
|
|
248
|
-
[
|
|
242
|
+
[0, 0],
|
|
243
|
+
[0, -deltaY],
|
|
244
|
+
[deltaX, 0],
|
|
245
|
+
[0, deltaY],
|
|
246
|
+
[0, 0],
|
|
247
|
+
[-deltaX, -deltaY],
|
|
248
|
+
[-deltaX, deltaY],
|
|
249
|
+
[0, 0],
|
|
249
250
|
];
|
|
250
251
|
select(this.icon).maybeAppend('.forward', 'polygon').styles({
|
|
251
252
|
points,
|
|
@@ -260,14 +261,14 @@ export class Play extends IconBase {
|
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
renderIcon() {
|
|
263
|
-
const {
|
|
264
|
+
const { color } = this.attributes;
|
|
264
265
|
const size = this.iconSize;
|
|
265
266
|
const deltaX = (size / 3) * 3 ** 0.5 * 0.8;
|
|
266
267
|
const points: PolygonStyleProps['points'] = [
|
|
267
|
-
[
|
|
268
|
-
[
|
|
269
|
-
[
|
|
270
|
-
[
|
|
268
|
+
[deltaX, 0],
|
|
269
|
+
[-deltaX / 2, -(size / 2) * 0.8],
|
|
270
|
+
[-deltaX / 2, (size / 2) * 0.8],
|
|
271
|
+
[deltaX, 0],
|
|
271
272
|
];
|
|
272
273
|
select(this.icon).maybeAppend('.play', 'polygon').styles({
|
|
273
274
|
points,
|
|
@@ -282,19 +283,19 @@ export class Pause extends IconBase {
|
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
renderIcon() {
|
|
285
|
-
const {
|
|
286
|
+
const { color } = this.attributes;
|
|
286
287
|
const size = this.iconSize;
|
|
287
288
|
const deltaX = size / 3;
|
|
288
289
|
const points: PolygonStyleProps['points'] = [
|
|
289
|
-
[
|
|
290
|
-
[
|
|
291
|
-
[
|
|
292
|
-
[
|
|
293
|
-
[
|
|
294
|
-
[
|
|
295
|
-
[
|
|
296
|
-
[
|
|
297
|
-
[
|
|
290
|
+
[-deltaX, -size / 2],
|
|
291
|
+
[-deltaX, size / 2],
|
|
292
|
+
[-deltaX / 2, size / 2],
|
|
293
|
+
[-deltaX / 2, -size / 2],
|
|
294
|
+
[-deltaX, -size / 2],
|
|
295
|
+
[deltaX / 2, -size / 2],
|
|
296
|
+
[deltaX / 2, size / 2],
|
|
297
|
+
[deltaX, size / 2],
|
|
298
|
+
[deltaX, -size / 2],
|
|
298
299
|
];
|
|
299
300
|
select(this.icon).maybeAppend('.pause', 'polygon').styles({
|
|
300
301
|
points,
|
|
@@ -310,17 +311,17 @@ export class Range extends IconBase {
|
|
|
310
311
|
}
|
|
311
312
|
|
|
312
313
|
renderIcon() {
|
|
313
|
-
const {
|
|
314
|
+
const { color } = this.attributes;
|
|
314
315
|
const { iconSize: size, lineWidth } = this;
|
|
315
316
|
const gap = lineWidth;
|
|
316
317
|
|
|
317
318
|
select(this.icon)
|
|
318
319
|
.maybeAppend('.left-line', 'line')
|
|
319
320
|
.styles({
|
|
320
|
-
x1:
|
|
321
|
-
y1:
|
|
322
|
-
x2:
|
|
323
|
-
y2:
|
|
321
|
+
x1: -size / 2,
|
|
322
|
+
y1: -size / 2,
|
|
323
|
+
x2: -size / 2,
|
|
324
|
+
y2: size / 2,
|
|
324
325
|
stroke: color,
|
|
325
326
|
lineWidth,
|
|
326
327
|
});
|
|
@@ -328,10 +329,10 @@ export class Range extends IconBase {
|
|
|
328
329
|
select(this.icon)
|
|
329
330
|
.maybeAppend('.right-line', 'line')
|
|
330
331
|
.styles({
|
|
331
|
-
x1:
|
|
332
|
-
y1:
|
|
333
|
-
x2:
|
|
334
|
-
y2:
|
|
332
|
+
x1: size / 2,
|
|
333
|
+
y1: -size / 2,
|
|
334
|
+
x2: size / 2,
|
|
335
|
+
y2: size / 2,
|
|
335
336
|
stroke: color,
|
|
336
337
|
lineWidth,
|
|
337
338
|
});
|
|
@@ -339,10 +340,10 @@ export class Range extends IconBase {
|
|
|
339
340
|
select(this.icon)
|
|
340
341
|
.maybeAppend('.left-arrow', 'line')
|
|
341
342
|
.styles({
|
|
342
|
-
x1:
|
|
343
|
-
y1:
|
|
344
|
-
x2:
|
|
345
|
-
y2:
|
|
343
|
+
x1: 0,
|
|
344
|
+
y1: 0,
|
|
345
|
+
x2: -size / 2 + gap * 2,
|
|
346
|
+
y2: 0,
|
|
346
347
|
stroke: color,
|
|
347
348
|
lineWidth,
|
|
348
349
|
markerEnd: arrow(lineWidth * 2, color),
|
|
@@ -351,10 +352,10 @@ export class Range extends IconBase {
|
|
|
351
352
|
select(this.icon)
|
|
352
353
|
.maybeAppend('.right-arrow', 'line')
|
|
353
354
|
.styles({
|
|
354
|
-
x1:
|
|
355
|
-
y1:
|
|
356
|
-
x2:
|
|
357
|
-
y2:
|
|
355
|
+
x1: 0,
|
|
356
|
+
y1: 0,
|
|
357
|
+
x2: size / 2 - gap * 2,
|
|
358
|
+
y2: 0,
|
|
358
359
|
stroke: color,
|
|
359
360
|
lineWidth,
|
|
360
361
|
markerEnd: arrow(lineWidth * 2, color),
|
|
@@ -369,16 +370,16 @@ export class Value extends IconBase {
|
|
|
369
370
|
}
|
|
370
371
|
|
|
371
372
|
renderIcon() {
|
|
372
|
-
const {
|
|
373
|
+
const { color } = this.attributes;
|
|
373
374
|
const { iconSize: size, lineWidth } = this;
|
|
374
375
|
|
|
375
376
|
select(this.icon)
|
|
376
377
|
.maybeAppend('.line', 'line')
|
|
377
378
|
.styles({
|
|
378
|
-
x1:
|
|
379
|
-
y1:
|
|
380
|
-
x2:
|
|
381
|
-
y2:
|
|
379
|
+
x1: 0,
|
|
380
|
+
y1: -size / 2,
|
|
381
|
+
x2: 0,
|
|
382
|
+
y2: size / 2,
|
|
382
383
|
stroke: color,
|
|
383
384
|
lineWidth,
|
|
384
385
|
});
|
|
@@ -388,10 +389,10 @@ export class Value extends IconBase {
|
|
|
388
389
|
select(this.icon)
|
|
389
390
|
.maybeAppend('.left-arrow', 'line')
|
|
390
391
|
.styles({
|
|
391
|
-
x1:
|
|
392
|
-
y1:
|
|
393
|
-
x2:
|
|
394
|
-
y2:
|
|
392
|
+
x1: -size / 2 - gap * 2,
|
|
393
|
+
y1: 0,
|
|
394
|
+
x2: -gap * 2,
|
|
395
|
+
y2: 0,
|
|
395
396
|
stroke: color,
|
|
396
397
|
lineWidth,
|
|
397
398
|
markerEnd: arrow(lineWidth * 2, color),
|
|
@@ -400,10 +401,10 @@ export class Value extends IconBase {
|
|
|
400
401
|
select(this.icon)
|
|
401
402
|
.maybeAppend('.right-arrow', 'line')
|
|
402
403
|
.styles({
|
|
403
|
-
x1:
|
|
404
|
-
y1:
|
|
405
|
-
x2:
|
|
406
|
-
y2:
|
|
404
|
+
x1: size / 2 + gap * 2,
|
|
405
|
+
y1: 0,
|
|
406
|
+
x2: gap * 2,
|
|
407
|
+
y2: 0,
|
|
407
408
|
stroke: color,
|
|
408
409
|
lineWidth,
|
|
409
410
|
markerEnd: arrow(lineWidth * 2, color),
|
|
@@ -425,18 +426,18 @@ export class LineChart extends IconBase {
|
|
|
425
426
|
}
|
|
426
427
|
|
|
427
428
|
renderIcon() {
|
|
428
|
-
const {
|
|
429
|
+
const { color } = this.attributes;
|
|
429
430
|
const { iconSize: size, lineWidth } = this;
|
|
430
431
|
|
|
431
432
|
const gap = lineWidth;
|
|
432
433
|
const deltaX = (size - gap * 2 - lineWidth) / 4;
|
|
433
434
|
const deltaY = (size - gap * 2 - lineWidth) / 2;
|
|
434
|
-
const [ox, oy] = [
|
|
435
|
+
const [ox, oy] = [-size / 2 + gap, size / 2 - gap * 2];
|
|
435
436
|
|
|
436
437
|
select(this.icon)
|
|
437
438
|
.maybeAppend('.coordinate', 'polyline')
|
|
438
439
|
.styles({
|
|
439
|
-
points: getCoordinatePoints(size)
|
|
440
|
+
points: getCoordinatePoints(size),
|
|
440
441
|
stroke: color,
|
|
441
442
|
lineWidth,
|
|
442
443
|
});
|
|
@@ -467,18 +468,18 @@ export class BarChart extends IconBase {
|
|
|
467
468
|
|
|
468
469
|
renderIcon() {
|
|
469
470
|
const { data } = this;
|
|
470
|
-
const {
|
|
471
|
+
const { color } = this.attributes;
|
|
471
472
|
const { iconSize: size, lineWidth } = this;
|
|
472
473
|
|
|
473
474
|
const gap = lineWidth;
|
|
474
475
|
const deltaX = (size - gap) / data.length;
|
|
475
476
|
const deltaY = (size - gap * 2) / 4;
|
|
476
|
-
const [ox, oy] = [
|
|
477
|
+
const [ox, oy] = [-size / 2 + gap * 2, size / 2 - gap];
|
|
477
478
|
|
|
478
479
|
select(this.icon)
|
|
479
480
|
.maybeAppend('.coordinate', 'polyline')
|
|
480
481
|
.styles({
|
|
481
|
-
points: getCoordinatePoints(size)
|
|
482
|
+
points: getCoordinatePoints(size),
|
|
482
483
|
stroke: color,
|
|
483
484
|
lineWidth,
|
|
484
485
|
});
|
|
@@ -513,15 +514,15 @@ export class Split extends IconBase {
|
|
|
513
514
|
}
|
|
514
515
|
|
|
515
516
|
renderIcon() {
|
|
516
|
-
const {
|
|
517
|
+
const { color } = this.attributes;
|
|
517
518
|
const { iconSize: size, lineWidth } = this;
|
|
518
519
|
select(this.icon)
|
|
519
520
|
.maybeAppend('.split', 'line')
|
|
520
521
|
.styles({
|
|
521
|
-
x1:
|
|
522
|
-
y1:
|
|
523
|
-
x2:
|
|
524
|
-
y2:
|
|
522
|
+
x1: 0,
|
|
523
|
+
y1: -size / 2,
|
|
524
|
+
x2: 0,
|
|
525
|
+
y2: size / 2,
|
|
525
526
|
stroke: color,
|
|
526
527
|
lineWidth,
|
|
527
528
|
});
|
|
@@ -539,24 +540,16 @@ export class SpeedSelect extends IconBase<{ speed?: number; onSelect: SelectStyl
|
|
|
539
540
|
|
|
540
541
|
renderIcon() {
|
|
541
542
|
const { iconSize } = this;
|
|
542
|
-
const {
|
|
543
|
-
const inheritStyle = omit(this.attributes as any, [
|
|
544
|
-
'x',
|
|
545
|
-
'y',
|
|
546
|
-
'transform',
|
|
547
|
-
'transformOrigin',
|
|
548
|
-
'width',
|
|
549
|
-
'height',
|
|
550
|
-
'size',
|
|
551
|
-
'color',
|
|
552
|
-
'speed',
|
|
553
|
-
]);
|
|
543
|
+
const { speed = 1 } = this.attributes;
|
|
544
|
+
const inheritStyle = omit(this.attributes as any, ['x', 'y', 'width', 'height', 'size', 'color', 'speed']);
|
|
554
545
|
const width = clamp(iconSize, 20, Infinity);
|
|
555
546
|
const height = 20;
|
|
547
|
+
const x = -width / 2;
|
|
548
|
+
const y = -height / 2;
|
|
556
549
|
const style: SelectStyleProps = {
|
|
557
550
|
...inheritStyle,
|
|
558
|
-
x
|
|
559
|
-
y
|
|
551
|
+
x,
|
|
552
|
+
y,
|
|
560
553
|
width,
|
|
561
554
|
height,
|
|
562
555
|
defaultValue: speed,
|
|
@@ -612,7 +605,7 @@ export abstract class ToggleIcon<T extends string> extends Component<ToggleIconS
|
|
|
612
605
|
}
|
|
613
606
|
|
|
614
607
|
render() {
|
|
615
|
-
const { onChange, ...restStyles } = this.attributes;
|
|
608
|
+
const { x, y, onChange, ...restStyles } = this.attributes;
|
|
616
609
|
select(this.icon)
|
|
617
610
|
.selectAll('.icon')
|
|
618
611
|
.data([this.currentType])
|
|
@@ -18,8 +18,6 @@ type States = Pick<TimebarStyleProps, 'speed' | 'selectionType' | 'chartType' |
|
|
|
18
18
|
export class Timebar extends Component<TimebarStyleProps> {
|
|
19
19
|
static defaultOptions: TimebarOptions = {
|
|
20
20
|
style: {
|
|
21
|
-
x: 0,
|
|
22
|
-
y: 0,
|
|
23
21
|
axisLabelFill: '#6e6e6e',
|
|
24
22
|
axisLabelTextAlign: 'left',
|
|
25
23
|
axisLabelTextBaseline: 'top',
|
|
@@ -77,10 +75,10 @@ export class Timebar extends Component<TimebarStyleProps> {
|
|
|
77
75
|
|
|
78
76
|
/** 计算空间分配 */
|
|
79
77
|
private get space() {
|
|
80
|
-
const {
|
|
78
|
+
const { width, height, type, controllerHeight } = this.attributes;
|
|
81
79
|
|
|
82
80
|
const availableTimelineHeight = clamp(+height - controllerHeight, 0, +height);
|
|
83
|
-
const controllerBBox = new BBox(
|
|
81
|
+
const controllerBBox = new BBox(0, +height - controllerHeight, +width, controllerHeight);
|
|
84
82
|
|
|
85
83
|
// chart 模式下可用
|
|
86
84
|
let axisBBox: BBox;
|
|
@@ -88,13 +86,13 @@ export class Timebar extends Component<TimebarStyleProps> {
|
|
|
88
86
|
if (type === 'chart') {
|
|
89
87
|
// axis 默认分配高度为 35
|
|
90
88
|
axisHeight = 35;
|
|
91
|
-
axisBBox = new BBox(
|
|
89
|
+
axisBBox = new BBox(0, availableTimelineHeight - axisHeight, +width, axisHeight);
|
|
92
90
|
} else axisBBox = new BBox();
|
|
93
91
|
|
|
94
92
|
const timelineHeight = type === 'time' ? 10 : availableTimelineHeight;
|
|
95
93
|
const timelineBBox = new BBox(
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
0,
|
|
95
|
+
type === 'time' ? availableTimelineHeight : availableTimelineHeight - timelineHeight,
|
|
98
96
|
+width,
|
|
99
97
|
timelineHeight - axisHeight
|
|
100
98
|
);
|
|
@@ -212,9 +210,8 @@ export class Timebar extends Component<TimebarStyleProps> {
|
|
|
212
210
|
if (typeof time === 'number') return parseBySeries(time);
|
|
213
211
|
return formatTime(time, 'YYYY-MM-DD HH:mm:ss');
|
|
214
212
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// y,
|
|
213
|
+
x,
|
|
214
|
+
y,
|
|
218
215
|
zIndex: 1,
|
|
219
216
|
...userDefinedChartStyle,
|
|
220
217
|
};
|
|
@@ -240,9 +237,8 @@ export class Timebar extends Component<TimebarStyleProps> {
|
|
|
240
237
|
trackSize: height,
|
|
241
238
|
type: selectionType,
|
|
242
239
|
values: this.sliderValues,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
transform: `translate(${x}, ${y})`,
|
|
240
|
+
x,
|
|
241
|
+
y,
|
|
246
242
|
zIndex: 1,
|
|
247
243
|
...userDefinedChartStyle,
|
|
248
244
|
};
|
package/src/ui/timebar/types.ts
CHANGED
|
@@ -8,8 +8,6 @@ import type { LinearAxisStyleProps } from '../axis/types';
|
|
|
8
8
|
export type Functions = 'reset' | 'speed' | 'backward' | 'playPause' | 'forward' | 'selectionType' | 'chartType';
|
|
9
9
|
export type ControllerStyleProps = GroupStyleProps &
|
|
10
10
|
PrefixObject<BaseStyleProps, 'background'> & {
|
|
11
|
-
x?: number;
|
|
12
|
-
y?: number;
|
|
13
11
|
width: number;
|
|
14
12
|
height: number;
|
|
15
13
|
padding?: SeriesAttr;
|
|
@@ -74,8 +72,6 @@ export type TimebarStyleProps = GroupStyleProps &
|
|
|
74
72
|
PrefixObject<Omit<LinearAxisStyleProps, 'type' | 'startPos' | 'endPos' | 'data'>, 'axis'> &
|
|
75
73
|
Pick<ControllerStyleProps, UnvarnishedControllerProps> &
|
|
76
74
|
PrefixObject<Omit<ControllerStyleProps, 'width' | 'onChange' | UnvarnishedControllerProps>, 'controller'> & {
|
|
77
|
-
x?: number;
|
|
78
|
-
y?: number;
|
|
79
75
|
/**
|
|
80
76
|
* 类型
|
|
81
77
|
* @description time 时间轴
|