vislite 1.2.0-alpha.3 → 1.2.0-alpha.4
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/CHANGELOG +13 -4
- package/lib/Buffer/index.es.js +1 -1
- package/lib/Buffer/index.es.min.js +1 -1
- package/lib/Canvas/index.es.js +4 -2
- package/lib/Canvas/index.es.min.js +2 -2
- package/lib/Cardinal/index.es.js +1 -1
- package/lib/Cardinal/index.es.min.js +1 -1
- package/lib/Eoap/index.es.js +1 -1
- package/lib/Eoap/index.es.min.js +1 -1
- package/lib/Hermite/index.es.js +1 -1
- package/lib/Hermite/index.es.min.js +1 -1
- package/lib/Matrix4/index.es.js +1 -1
- package/lib/Matrix4/index.es.min.js +1 -1
- package/lib/Mercator/index.es.js +1 -1
- package/lib/Mercator/index.es.min.js +1 -1
- package/lib/RawCanvas/index.es.js +4 -2
- package/lib/RawCanvas/index.es.min.js +2 -2
- package/lib/SVG/index.es.js +12 -8
- package/lib/SVG/index.es.min.js +2 -2
- package/lib/Shader/index.es.js +1 -1
- package/lib/Shader/index.es.min.js +1 -1
- package/lib/Texture/index.es.js +1 -1
- package/lib/Texture/index.es.min.js +1 -1
- package/lib/TreeLayout/index.es.js +38 -8
- package/lib/TreeLayout/index.es.min.js +2 -2
- package/lib/animation/index.es.js +38 -8
- package/lib/animation/index.es.min.js +2 -2
- package/lib/assemble/index.es.js +1 -1
- package/lib/assemble/index.es.min.js +1 -1
- package/lib/getLoopColors/index.es.js +1 -1
- package/lib/getLoopColors/index.es.min.js +1 -1
- package/lib/getWebGLContext/index.es.js +1 -1
- package/lib/getWebGLContext/index.es.min.js +1 -1
- package/lib/index.umd.js +76 -33
- package/lib/index.umd.min.js +2 -2
- package/lib/initOption/index.es.js +1 -1
- package/lib/initOption/index.es.min.js +1 -1
- package/lib/mergeOption/index.es.js +1 -1
- package/lib/mergeOption/index.es.min.js +1 -1
- package/lib/move/index.es.js +1 -1
- package/lib/move/index.es.min.js +1 -1
- package/lib/rotate/index.es.js +1 -1
- package/lib/rotate/index.es.min.js +1 -1
- package/lib/ruler/index.es.js +1 -1
- package/lib/ruler/index.es.min.js +1 -1
- package/lib/scale/index.es.js +1 -1
- package/lib/scale/index.es.min.js +1 -1
- package/lib/throttle/index.es.js +25 -25
- package/lib/throttle/index.es.min.js +2 -2
- package/package/animation/index.ts +1 -1
- package/package/throttle/index.ts +1 -1
- package/package.json +7 -2
- package/src/common/canvas/painter.ts +9 -3
- package/src/common/svg/config.ts +194 -190
- package/src/common/svg/index.ts +350 -347
- package/src/common/svg/tool.ts +42 -44
- package/src/layout/TreeLayout.ts +1 -1
- package/types/CanvasConfig.d.ts +116 -106
- package/types/SVGConfig.d.ts +89 -79
- package/types/animation.d.ts +2 -6
- package/types/painterConfig.d.ts +5 -3
- package/types/throttle.d.ts +2 -4
- package/types/throttleOption.d.ts +1 -22
- package/src/animation.ts +0 -99
- package/src/throttle.ts +0 -53
package/src/common/svg/tool.ts
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import type SVGConfigType from '../../../types/SVGConfig'
|
|
2
|
-
|
|
3
|
-
import { XLINK_ATTRIBUTE } from "./dictionary"
|
|
4
|
-
|
|
5
|
-
// 新建节点
|
|
6
|
-
export function toNode(tagname: string) {
|
|
7
|
-
return document.createElementNS('http://www.w3.org/2000/svg', tagname)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// 设置属性
|
|
11
|
-
const _setAttribute = function (el: SVGElement, key: string, value: string | number) {
|
|
12
|
-
|
|
13
|
-
// 需要使用xlink命名空间的xml属性
|
|
14
|
-
if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
|
|
15
|
-
el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "")
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// 否则
|
|
19
|
-
else {
|
|
20
|
-
el.setAttribute(key, value + "")
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export const setAttribute = _setAttribute
|
|
24
|
-
|
|
25
|
-
// 获取属性
|
|
26
|
-
export function getAttribute(el: SVGElement, key: string) {
|
|
27
|
-
if (XLINK_ATTRIBUTE.indexOf(key) > -1) key = 'xlink:' + key
|
|
28
|
-
return el.getAttribute(key)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function full(el: SVGElement, config: SVGConfigType) {
|
|
32
|
-
_setAttribute(el, "stroke", config.strokeStyle as string)
|
|
33
|
-
_setAttribute(el, "fill", config.fillStyle as string)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
_setAttribute(el, "
|
|
43
|
-
_setAttribute(el, "fill", "none")
|
|
44
|
-
_setAttribute(el, "stroke-dasharray", (config.lineDash as Array<number>).join(','))
|
|
1
|
+
import type SVGConfigType from '../../../types/SVGConfig'
|
|
2
|
+
|
|
3
|
+
import { XLINK_ATTRIBUTE } from "./dictionary"
|
|
4
|
+
|
|
5
|
+
// 新建节点
|
|
6
|
+
export function toNode(tagname: string) {
|
|
7
|
+
return document.createElementNS('http://www.w3.org/2000/svg', tagname)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 设置属性
|
|
11
|
+
const _setAttribute = function (el: SVGElement, key: string, value: string | number) {
|
|
12
|
+
|
|
13
|
+
// 需要使用xlink命名空间的xml属性
|
|
14
|
+
if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
|
|
15
|
+
el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 否则
|
|
19
|
+
else {
|
|
20
|
+
el.setAttribute(key, value + "")
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const setAttribute = _setAttribute
|
|
24
|
+
|
|
25
|
+
// 获取属性
|
|
26
|
+
export function getAttribute(el: SVGElement, key: string) {
|
|
27
|
+
if (XLINK_ATTRIBUTE.indexOf(key) > -1) key = 'xlink:' + key
|
|
28
|
+
return el.getAttribute(key)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function full(el: SVGElement, config: SVGConfigType) {
|
|
32
|
+
_setAttribute(el, "stroke", config.strokeStyle as string)
|
|
33
|
+
_setAttribute(el, "fill", config.fillStyle as string)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function fill(el: SVGElement, config: SVGConfigType) {
|
|
37
|
+
_setAttribute(el, "fill", config.fillStyle as string)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function stroke(el: SVGElement, config: SVGConfigType) {
|
|
41
|
+
_setAttribute(el, "stroke", config.strokeStyle as string)
|
|
42
|
+
_setAttribute(el, "fill", "none")
|
|
45
43
|
}
|
package/src/layout/TreeLayout.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type TreeOptionType from '../../types/TreeOption'
|
|
|
4
4
|
|
|
5
5
|
import Tree from '../common/tree/index'
|
|
6
6
|
import { initOption } from '../common/option'
|
|
7
|
-
import animation from
|
|
7
|
+
import { animation } from "@oipage/core.js/src/animation/index"
|
|
8
8
|
import rotate from '../rotate'
|
|
9
9
|
|
|
10
10
|
class TreeLayout extends Tree implements TreeLayoutType {
|
package/types/CanvasConfig.d.ts
CHANGED
|
@@ -1,107 +1,117 @@
|
|
|
1
|
-
import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
|
|
2
|
-
|
|
3
|
-
export default interface CanvasConfigType {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 填充色或图案,默认"#000"
|
|
7
|
-
*/
|
|
8
|
-
fillStyle?: string | CanvasGradient
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 轮廓色或图案,默认"#000"
|
|
12
|
-
*/
|
|
13
|
-
strokeStyle?: string | CanvasGradient
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 线条宽度,默认1(单位px)
|
|
17
|
-
*/
|
|
18
|
-
lineWidth?: number
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
32
|
-
*
|
|
33
|
-
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
34
|
-
*/
|
|
35
|
-
lineDash?: Array<number>
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 已废弃,向下兼容,请用
|
|
64
|
-
*/
|
|
65
|
-
"font-
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 已废弃,向下兼容,请用
|
|
74
|
-
*/
|
|
75
|
-
"font-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 已废弃,向下兼容,请用
|
|
84
|
-
*/
|
|
85
|
-
"font-
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
*/
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 已废弃,向下兼容,请用
|
|
94
|
-
*/
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 已废弃,向下兼容,请用
|
|
104
|
-
*/
|
|
105
|
-
"arc-
|
|
106
|
-
|
|
1
|
+
import { arcCapType, textAlignType, textBaselineType, lineCapType, lineJoinType } from './painterConfig'
|
|
2
|
+
|
|
3
|
+
export default interface CanvasConfigType {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 填充色或图案,默认"#000"
|
|
7
|
+
*/
|
|
8
|
+
fillStyle?: string | CanvasGradient
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 轮廓色或图案,默认"#000"
|
|
12
|
+
*/
|
|
13
|
+
strokeStyle?: string | CanvasGradient
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 线条宽度,默认1(单位px)
|
|
17
|
+
*/
|
|
18
|
+
lineWidth?: number
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形)
|
|
22
|
+
*/
|
|
23
|
+
lineCap?: lineCapType
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆)
|
|
27
|
+
*/
|
|
28
|
+
lineJoin?: lineJoinType
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
32
|
+
*
|
|
33
|
+
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
34
|
+
*/
|
|
35
|
+
lineDash?: Array<number>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
|
|
39
|
+
*/
|
|
40
|
+
textAlign?: textAlignType
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
|
|
44
|
+
*/
|
|
45
|
+
textBaseline?: textBaselineType
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 阴影的模糊系数,默认0,也就是无阴影
|
|
49
|
+
*/
|
|
50
|
+
shadowBlur?: number
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 阴影的颜色
|
|
54
|
+
*/
|
|
55
|
+
shadowColor?: string | CanvasGradient
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 文字大小,默认16
|
|
59
|
+
*/
|
|
60
|
+
"fontSize"?: number
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 已废弃,向下兼容,请用 fontSize 代替
|
|
64
|
+
*/
|
|
65
|
+
"font-size"?: number // 向下兼容
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 字体,默认"sans-serif"
|
|
69
|
+
*/
|
|
70
|
+
"fontFamily"?: string
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 已废弃,向下兼容,请用 fontFamily 代替
|
|
74
|
+
*/
|
|
75
|
+
"font-family"?: string // 向下兼容
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 字重,默认400
|
|
79
|
+
*/
|
|
80
|
+
"fontWeight"?: number
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 已废弃,向下兼容,请用 fontWeight 代替
|
|
84
|
+
*/
|
|
85
|
+
"font-weight"?: number // 向下兼容
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 字类型,默认"normal"
|
|
89
|
+
*/
|
|
90
|
+
"fontStyle"?: string
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 已废弃,向下兼容,请用 fontStyle 代替
|
|
94
|
+
*/
|
|
95
|
+
"font-style"?: string // 向下兼容
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
99
|
+
*/
|
|
100
|
+
"arcStartCap"?: arcCapType
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 已废弃,向下兼容,请用 arcStartCap 代替
|
|
104
|
+
*/
|
|
105
|
+
"arc-start-cap"?: string // 向下兼容
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
109
|
+
*/
|
|
110
|
+
"arcEndCap"?: arcCapType
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 已废弃,向下兼容,请用 arcEndCap 代替
|
|
114
|
+
*/
|
|
115
|
+
"arc-end-cap"?: string // 向下兼容
|
|
116
|
+
|
|
107
117
|
}
|
package/types/SVGConfig.d.ts
CHANGED
|
@@ -1,80 +1,90 @@
|
|
|
1
|
-
import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
|
|
2
|
-
|
|
3
|
-
export type svgElType = SVGElement | "g" | "text" | "path" | "circle" | "rect" | "polygon" | "polyline"
|
|
4
|
-
export type svgBoardType = SVGElement | "text" | "path" | "arc" | "circle" | "rect"
|
|
5
|
-
|
|
6
|
-
export default interface SVGConfigType {
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 填充色或图案,默认"#000"
|
|
10
|
-
*/
|
|
11
|
-
fillStyle?: string
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* 轮廓色或图案,默认"#000"
|
|
15
|
-
*/
|
|
16
|
-
strokeStyle?: string
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 线条宽度,默认1(单位px)
|
|
20
|
-
*/
|
|
21
|
-
lineWidth?: number
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
35
|
-
*
|
|
36
|
-
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
37
|
-
*/
|
|
38
|
-
lineDash?: Array<number>
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 已废弃,向下兼容,请用
|
|
57
|
-
*/
|
|
58
|
-
"font-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 已废弃,向下兼容,请用
|
|
67
|
-
*/
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 已废弃,向下兼容,请用
|
|
77
|
-
*/
|
|
78
|
-
"arc-
|
|
79
|
-
|
|
1
|
+
import { arcCapType, textAlignType, textBaselineType, lineCapType, lineJoinType } from './painterConfig'
|
|
2
|
+
|
|
3
|
+
export type svgElType = SVGElement | "g" | "text" | "path" | "circle" | "rect" | "polygon" | "polyline"
|
|
4
|
+
export type svgBoardType = SVGElement | "text" | "path" | "arc" | "circle" | "rect"
|
|
5
|
+
|
|
6
|
+
export default interface SVGConfigType {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 填充色或图案,默认"#000"
|
|
10
|
+
*/
|
|
11
|
+
fillStyle?: string
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 轮廓色或图案,默认"#000"
|
|
15
|
+
*/
|
|
16
|
+
strokeStyle?: string
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 线条宽度,默认1(单位px)
|
|
20
|
+
*/
|
|
21
|
+
lineWidth?: number
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形)
|
|
25
|
+
*/
|
|
26
|
+
lineCap?: lineCapType
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆)
|
|
30
|
+
*/
|
|
31
|
+
lineJoin?: lineJoinType
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
35
|
+
*
|
|
36
|
+
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
37
|
+
*/
|
|
38
|
+
lineDash?: Array<number>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
|
|
42
|
+
*/
|
|
43
|
+
textAlign?: textAlignType
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
|
|
47
|
+
*/
|
|
48
|
+
textBaseline?: textBaselineType
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 文字大小,默认16
|
|
52
|
+
*/
|
|
53
|
+
"fontSize"?: number
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 已废弃,向下兼容,请用 fontSize 代替
|
|
57
|
+
*/
|
|
58
|
+
"font-size"?: number // 向下兼容
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 字体,默认"sans-serif"
|
|
62
|
+
*/
|
|
63
|
+
"fontFamily"?: string
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 已废弃,向下兼容,请用 fontFamily 代替
|
|
67
|
+
*/
|
|
68
|
+
"font-family"?: string // 向下兼容
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
72
|
+
*/
|
|
73
|
+
"arcStartCap"?: arcCapType
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 已废弃,向下兼容,请用 arcStartCap 代替
|
|
77
|
+
*/
|
|
78
|
+
"arc-start-cap"?: string // 向下兼容
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
82
|
+
*/
|
|
83
|
+
"arcEndCap"?: arcCapType
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 已废弃,向下兼容,请用 arcEndCap 代替
|
|
87
|
+
*/
|
|
88
|
+
"arc-end-cap"?: string // 向下兼容
|
|
89
|
+
|
|
80
90
|
}
|
package/types/animation.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
(deep: number): void
|
|
3
|
-
}
|
|
1
|
+
import { animationType } from "@oipage/core.js/src/animation"
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* 轮询动画,返回一个函数,调用该函数,可以提前结束动画
|
|
7
5
|
*/
|
|
8
|
-
export default
|
|
9
|
-
(doback: animationFun, duration?: number, callback?: animationFun): Function
|
|
10
|
-
}
|
|
6
|
+
export default animationType
|
package/types/painterConfig.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export type arcCapType = "butt" | "round" | "-round"
|
|
2
|
-
export type textAlignType = "left" | "center" | "right"
|
|
3
|
-
export type textBaselineType = "top" | "middle" | "bottom"
|
|
1
|
+
export type arcCapType = "butt" | "round" | "-round"
|
|
2
|
+
export type textAlignType = "left" | "center" | "right"
|
|
3
|
+
export type textBaselineType = "top" | "middle" | "bottom"
|
|
4
|
+
export type lineCapType = "butt" | "round" | "square"
|
|
5
|
+
export type lineJoinType = "miter" | "bevel" | "round"
|
package/types/throttle.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { throttleType } from "@oipage/core.js/src/throttle"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 节流函数
|
|
5
5
|
*/
|
|
6
|
-
export default
|
|
7
|
-
(callback: Function, option?: throttleOptionType): Function
|
|
8
|
-
}
|
|
6
|
+
export default throttleType
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
export default interface throttleOptionType {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 节流时长
|
|
7
|
-
*/
|
|
8
|
-
time?: number
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 是否持续节流
|
|
12
|
-
*/
|
|
13
|
-
keep?: boolean
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 执行时机
|
|
17
|
-
*
|
|
18
|
-
* begin(开始触发)、end(结束触发)、wide(第一次开始触发,其余结束触发)
|
|
19
|
-
*/
|
|
20
|
-
opportunity?: throttleOpportunityType
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
export * from "@oipage/core.js/src/throttle"
|
package/src/animation.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
//当前正在运动的动画的tick函数堆栈
|
|
2
|
-
let $timers: any[] = []
|
|
3
|
-
//唯一定时器的定时间隔
|
|
4
|
-
const $interval = 13
|
|
5
|
-
//定时器ID
|
|
6
|
-
let $timerId: any
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 动画轮播
|
|
10
|
-
* @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
|
|
11
|
-
* @param {number} duration 动画时长,可选
|
|
12
|
-
* @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
|
|
13
|
-
*
|
|
14
|
-
* @returns {function} 返回一个函数,调用该函数,可以提前结束动画
|
|
15
|
-
*/
|
|
16
|
-
export default function (doback: (deep: number) => void, duration: number = 400, callback: (deep: number) => void = () => { }): Function {
|
|
17
|
-
|
|
18
|
-
const clock = {
|
|
19
|
-
//把tick函数推入堆栈
|
|
20
|
-
"timer": function (tick: (deep: number) => void, duration: number, callback: (deep: number) => void) {
|
|
21
|
-
if (!tick) {
|
|
22
|
-
throw new Error('Tick is required!')
|
|
23
|
-
}
|
|
24
|
-
const id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0)
|
|
25
|
-
$timers.push({
|
|
26
|
-
"id": id,
|
|
27
|
-
"createTime": new Date(),
|
|
28
|
-
"tick": tick,
|
|
29
|
-
"duration": duration,
|
|
30
|
-
"callback": callback
|
|
31
|
-
})
|
|
32
|
-
clock.start()
|
|
33
|
-
return id
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
//开启唯一的定时器timerId
|
|
37
|
-
"start": function () {
|
|
38
|
-
if (!$timerId) {
|
|
39
|
-
$timerId = setInterval(clock.tick, $interval)
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
//被定时器调用,遍历timers堆栈
|
|
44
|
-
"tick": function () {
|
|
45
|
-
let createTime: Date, flag: number, tick: (deep: number) => void, callback: (deep: number) => void, timer: any, duration: number, passTime: number
|
|
46
|
-
const timers: any[] = $timers
|
|
47
|
-
$timers = []
|
|
48
|
-
$timers.length = 0
|
|
49
|
-
for (flag = 0; flag < timers.length; flag++) {
|
|
50
|
-
//初始化数据
|
|
51
|
-
timer = timers[flag]
|
|
52
|
-
createTime = timer.createTime
|
|
53
|
-
tick = timer.tick
|
|
54
|
-
duration = timer.duration
|
|
55
|
-
callback = timer.callback
|
|
56
|
-
|
|
57
|
-
//执行
|
|
58
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration
|
|
59
|
-
passTime = passTime > 1 ? 1 : passTime
|
|
60
|
-
tick(passTime)
|
|
61
|
-
if (passTime < 1 && timer.id) {
|
|
62
|
-
//动画没有结束再添加
|
|
63
|
-
$timers.push(timer)
|
|
64
|
-
} else {
|
|
65
|
-
callback(passTime)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if ($timers.length <= 0) {
|
|
69
|
-
clock.stop()
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
//停止定时器,重置timerId=null
|
|
74
|
-
"stop": function () {
|
|
75
|
-
if ($timerId) {
|
|
76
|
-
clearInterval($timerId)
|
|
77
|
-
$timerId = null
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const id = clock.timer(function (deep: number) {
|
|
83
|
-
//其中deep为0-1,表示改变的程度
|
|
84
|
-
doback(deep)
|
|
85
|
-
}, duration, callback)
|
|
86
|
-
|
|
87
|
-
// 返回一个函数
|
|
88
|
-
// 用于在动画结束前结束动画
|
|
89
|
-
return function () {
|
|
90
|
-
let i: string
|
|
91
|
-
for (i in $timers) {
|
|
92
|
-
if ($timers[i].id == id) {
|
|
93
|
-
$timers[i].id = void 0
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|