vislite 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG +6 -0
- package/README.md +53 -52
- package/lib/BarLayout/index.es.js +8 -8
- package/lib/BarLayout/index.es.min.js +1 -1
- package/lib/PieLayout/index.es.js +8 -8
- package/lib/PieLayout/index.es.min.js +1 -1
- package/lib/TreeLayout/index.es.js +8 -8
- package/lib/TreeLayout/index.es.min.js +1 -1
- package/lib/animation/index.es.js +8 -8
- package/lib/animation/index.es.min.js +1 -1
- package/lib/index.umd.js +13 -13
- package/lib/index.umd.min.js +2 -2
- package/lib/throttle/index.es.js +4 -4
- package/lib/throttle/index.es.min.js +1 -1
- package/package.json +3 -2
- package/types/Buffer.d.ts +15 -8
- package/types/Canvas.d.ts +4 -0
- package/types/CanvasConfig.d.ts +20 -47
- package/types/Cardinal.d.ts +9 -2
- package/types/Gradient.d.ts +10 -4
- package/types/Hermite.d.ts +15 -8
- package/types/Matrix4.d.ts +47 -15
- package/types/SVG.d.ts +4 -0
- package/types/SVGConfig.d.ts +18 -35
- package/types/Shader.d.ts +10 -4
- package/types/Texture.d.ts +12 -6
- package/types/TreeConfig.d.ts +32 -16
- package/types/TreeLayout.d.ts +25 -13
- package/types/animation.d.ts +15 -0
- package/types/assemble.d.ts +10 -1
- package/types/getLoopColors.d.ts +9 -1
- package/types/index.d.ts +52 -27
- package/types/move.d.ts +11 -1
- package/types/painterConfig.d.ts +10 -0
- package/types/rotate.d.ts +11 -1
- package/types/ruler.d.ts +15 -1
- package/types/scale.d.ts +11 -1
- package/types/throttle.d.ts +2 -1
package/types/Matrix4.d.ts
CHANGED
|
@@ -1,47 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4x4矩阵类型定义
|
|
3
|
+
* 用于实现3D变换矩阵的各种操作,包括平移、旋转、缩放等
|
|
4
|
+
*/
|
|
1
5
|
export default interface Matrix4Type {
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
8
|
+
* 获取当前矩阵的内部数值表示
|
|
9
|
+
* @returns 返回4x4矩阵的16个元素,按列优先顺序排列
|
|
5
10
|
*/
|
|
6
11
|
value(): number[]
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param newMatrix4
|
|
11
|
-
* @param flag
|
|
14
|
+
* 矩阵乘法运算
|
|
15
|
+
* @param newMatrix4 要相乘的矩阵
|
|
16
|
+
* @param flag 可选参数,表示相乘位置。默认为false,表示左乘(newMatrix4 * this);为true时表示右乘(this * newMatrix4)
|
|
17
|
+
* @returns 返回当前实例,支持链式调用
|
|
12
18
|
*/
|
|
13
19
|
multiply(newMatrix4: number[], flag?: boolean): this
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
|
-
*
|
|
22
|
+
* 将变换矩阵应用于指定坐标点
|
|
23
|
+
* @param x x坐标
|
|
24
|
+
* @param y y坐标
|
|
25
|
+
* @param z z坐标,可选,默认为0
|
|
26
|
+
* @param w w坐标,可选,默认为1
|
|
27
|
+
* @returns 变换后的四维坐标 [x', y', z', w']
|
|
17
28
|
*/
|
|
18
29
|
use(x: number, y: number, z?: number, w?: number): [number, number, number, number]
|
|
19
30
|
|
|
20
31
|
/**
|
|
21
|
-
*
|
|
32
|
+
* 设置矩阵的初始值
|
|
33
|
+
* @param initMatrix4 可选的初始矩阵值,如果不提供则使用单位矩阵
|
|
34
|
+
* @returns 返回当前实例,支持链式调用
|
|
22
35
|
*/
|
|
23
36
|
setValue(initMatrix4?: number[]): this
|
|
24
37
|
|
|
25
38
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
39
|
+
* 沿指定向量方向平移
|
|
40
|
+
* @param dis 平移距离
|
|
41
|
+
* @param a 向量x分量
|
|
42
|
+
* @param b 向量y分量
|
|
43
|
+
* @param c 向量z分量,可选,默认为0
|
|
44
|
+
* @returns 返回当前实例,支持链式调用
|
|
28
45
|
*/
|
|
29
46
|
move(dis: number, a: number, b: number, c?: number): this
|
|
30
47
|
|
|
31
48
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
49
|
+
* 以指定点为中心进行缩放
|
|
50
|
+
* @param xTimes x方向缩放倍数
|
|
51
|
+
* @param yTimes y方向缩放倍数
|
|
52
|
+
* @param zTimes z方向缩放倍数
|
|
53
|
+
* @param cx 中心点x坐标,可选,默认为0
|
|
54
|
+
* @param cy 中心点y坐标,可选,默认为0
|
|
55
|
+
* @param cz 中心点z坐标,可选,默认为0
|
|
56
|
+
* @returns 返回当前实例,支持链式调用
|
|
34
57
|
*/
|
|
35
58
|
scale(xTimes: number, yTimes: number, zTimes: number, cx?: number, cy?: number, cz?: number): this
|
|
36
59
|
|
|
37
60
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
61
|
+
* 围绕指定射线旋转
|
|
62
|
+
* @param deg 旋转角度(度)
|
|
63
|
+
* @param a1 射线起点x坐标
|
|
64
|
+
* @param b1 射线起点y坐标
|
|
65
|
+
* @param c1 射线起点z坐标,可选
|
|
66
|
+
* @param a2 射线终点x坐标,可选
|
|
67
|
+
* @param b2 射线终点y坐标,可选
|
|
68
|
+
* @param c2 射线终点z坐标,可选
|
|
40
69
|
*
|
|
41
|
-
*
|
|
70
|
+
* 参数说明:
|
|
71
|
+
* 1)只设置a1和b1:表示在xoy平面围绕点(a1, b1)旋转
|
|
72
|
+
* 2)设置三个点(不足六个点):表示围绕从原点出发的射线旋转
|
|
73
|
+
* 3)设置六个点:表示围绕指定射线旋转
|
|
42
74
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
75
|
+
* 旋转方向由右手法则确定
|
|
76
|
+
* @returns 返回当前实例,支持链式调用
|
|
45
77
|
*/
|
|
46
78
|
rotate(deg: number, a1: number, b1: number, c1?: number, a2?: number, b2?: number, c2?: number): this
|
|
47
79
|
|
package/types/SVG.d.ts
CHANGED
package/types/SVGConfig.d.ts
CHANGED
|
@@ -1,72 +1,55 @@
|
|
|
1
1
|
import { arcCapType, textAlignType, textBaselineType, lineCapType, lineJoinType } from './painterConfig'
|
|
2
2
|
|
|
3
|
+
/** SVG元素类型定义 */
|
|
3
4
|
export type svgElType = SVGElement | "g" | "text" | "path" | "circle" | "rect" | "polygon" | "polyline"
|
|
5
|
+
/** SVG绘图板类型定义 */
|
|
4
6
|
export type svgBoardType = SVGElement | "text" | "path" | "arc" | "circle" | "rect"
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* SVG配置类型定义
|
|
10
|
+
* 用于配置SVG绘图的各种样式和属性
|
|
11
|
+
*/
|
|
6
12
|
export default interface SVGConfigType {
|
|
7
13
|
|
|
8
|
-
/**
|
|
9
|
-
* 填充色或图案,默认"#000"
|
|
10
|
-
*/
|
|
14
|
+
/** 填充色或图案,默认"#000" */
|
|
11
15
|
fillStyle?: string
|
|
12
16
|
|
|
13
|
-
/**
|
|
14
|
-
* 轮廓色或图案,默认"#000"
|
|
15
|
-
*/
|
|
17
|
+
/** 轮廓色或图案,默认"#000" */
|
|
16
18
|
strokeStyle?: string
|
|
17
19
|
|
|
18
|
-
/**
|
|
19
|
-
* 线条宽度,默认1(单位px)
|
|
20
|
-
*/
|
|
20
|
+
/** 线条宽度,默认1(单位px) */
|
|
21
21
|
lineWidth?: number
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形)
|
|
25
|
-
*/
|
|
23
|
+
/** 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形) */
|
|
26
24
|
lineCap?: lineCapType
|
|
27
25
|
|
|
28
|
-
/**
|
|
29
|
-
* 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆)
|
|
30
|
-
*/
|
|
26
|
+
/** 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆) */
|
|
31
27
|
lineJoin?: lineJoinType
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
35
|
-
*
|
|
36
31
|
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
37
32
|
*/
|
|
38
33
|
lineDash?: Array<number>
|
|
39
34
|
|
|
40
|
-
/**
|
|
41
|
-
* 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
|
|
42
|
-
*/
|
|
35
|
+
/** 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐) */
|
|
43
36
|
textAlign?: textAlignType
|
|
44
37
|
|
|
45
|
-
/**
|
|
46
|
-
* 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
|
|
47
|
-
*/
|
|
38
|
+
/** 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐) */
|
|
48
39
|
textBaseline?: textBaselineType
|
|
49
40
|
|
|
50
|
-
/**
|
|
51
|
-
* 文字大小,默认16
|
|
52
|
-
*/
|
|
41
|
+
/** 文字大小,默认16 */
|
|
53
42
|
fontSize?: number
|
|
54
43
|
|
|
55
|
-
/**
|
|
56
|
-
* 字体,默认"sans-serif"
|
|
57
|
-
*/
|
|
44
|
+
/** 字体,默认"sans-serif" */
|
|
58
45
|
fontFamily?: string
|
|
59
46
|
|
|
60
|
-
/**
|
|
61
|
-
* 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
62
|
-
*/
|
|
47
|
+
/** 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合) */
|
|
63
48
|
arcStartCap?: arcCapType
|
|
64
49
|
|
|
65
|
-
/**
|
|
66
|
-
* 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
67
|
-
*/
|
|
50
|
+
/** 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合) */
|
|
68
51
|
arcEndCap?: arcCapType
|
|
69
52
|
|
|
70
|
-
|
|
53
|
+
/** 矩形圆角半径 */
|
|
71
54
|
rectRadius?: Array<number>
|
|
72
55
|
}
|
package/types/Shader.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 着色器类型定义
|
|
3
|
+
* 用于WebGL着色器的编译和使用
|
|
4
|
+
*/
|
|
1
5
|
export default interface ShaderType {
|
|
2
6
|
|
|
7
|
+
/** 着色器程序对象 */
|
|
3
8
|
program: WebGLProgram
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
11
|
+
* 使用这个着色器程序
|
|
12
|
+
* @returns 返回当前实例,支持链式调用
|
|
8
13
|
*/
|
|
9
14
|
use(): this
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* 编译着色器程序
|
|
13
|
-
* @param vshaderSource
|
|
14
|
-
* @param fshaderSource
|
|
18
|
+
* @param vshaderSource 顶点着色器源码
|
|
19
|
+
* @param fshaderSource 片段着色器源码
|
|
20
|
+
* @returns 返回当前实例,支持链式调用
|
|
15
21
|
*/
|
|
16
22
|
compile(vshaderSource: string, fshaderSource: string): this
|
|
17
23
|
}
|
package/types/Texture.d.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGL纹理类型定义
|
|
3
|
+
* 用于管理WebGL中的纹理资源
|
|
4
|
+
*/
|
|
1
5
|
export default interface TextureType {
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param image
|
|
8
|
+
* 绑定单一图片作为纹理
|
|
9
|
+
* @param image 纹理图片资源
|
|
10
|
+
* @returns 返回当前实例,支持链式调用
|
|
6
11
|
*/
|
|
7
12
|
useImage(image: TexImageSource): this
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param images
|
|
12
|
-
* @param width
|
|
13
|
-
* @param height
|
|
15
|
+
* 绑定立方体贴图纹理
|
|
16
|
+
* @param images 纹理图片数组(6张图片)
|
|
17
|
+
* @param width 图片宽度
|
|
18
|
+
* @param height 图片高度
|
|
19
|
+
* @returns 返回当前实例,支持链式调用
|
|
14
20
|
*/
|
|
15
21
|
useCube(images: TexImageSource[], width: number, height: number): this
|
|
16
22
|
|
package/types/TreeConfig.d.ts
CHANGED
|
@@ -1,37 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取根节点函数类型定义
|
|
3
|
+
*/
|
|
1
4
|
export interface rootType {
|
|
5
|
+
/**
|
|
6
|
+
* 获取根节点
|
|
7
|
+
* @param initTree 原始树数据
|
|
8
|
+
* @returns 返回根节点
|
|
9
|
+
*/
|
|
2
10
|
(initTree: any): any
|
|
3
11
|
}
|
|
4
12
|
|
|
13
|
+
/**
|
|
14
|
+
* 获取子节点函数类型定义
|
|
15
|
+
*/
|
|
5
16
|
export interface childrenType {
|
|
17
|
+
/**
|
|
18
|
+
* 获取子节点数组
|
|
19
|
+
* @param parentTree 父节点
|
|
20
|
+
* @param initTree 原始树数据
|
|
21
|
+
* @returns 返回子节点数组
|
|
22
|
+
*/
|
|
6
23
|
(parentTree: any, initTree: any): any[]
|
|
7
24
|
}
|
|
8
25
|
|
|
26
|
+
/**
|
|
27
|
+
* 获取节点ID函数类型定义
|
|
28
|
+
*/
|
|
9
29
|
export interface idType {
|
|
30
|
+
/**
|
|
31
|
+
* 获取节点唯一标识
|
|
32
|
+
* @param treedata 节点数据
|
|
33
|
+
* @returns 返回节点唯一ID
|
|
34
|
+
*/
|
|
10
35
|
(treedata: any): string
|
|
11
36
|
}
|
|
12
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 树布局配置类型定义
|
|
40
|
+
* 用于配置树形布局的各种参数和方法
|
|
41
|
+
*/
|
|
13
42
|
export default interface TreeConfigType {
|
|
14
43
|
|
|
15
|
-
/**
|
|
16
|
-
* 获取根结点的方法
|
|
17
|
-
* @param initTree 原始数据
|
|
18
|
-
* @returns 返回根结点
|
|
19
|
-
*/
|
|
44
|
+
/** 获取根节点的方法 */
|
|
20
45
|
root?: rootType
|
|
21
46
|
|
|
22
|
-
/**
|
|
23
|
-
* 获取子结点的方法
|
|
24
|
-
* @param parentTree 父结点
|
|
25
|
-
* @param initTree 原始数据
|
|
26
|
-
* @returns 返回当前父结点的所有子结点数组
|
|
27
|
-
*/
|
|
47
|
+
/** 获取子节点的方法 */
|
|
28
48
|
children?: childrenType
|
|
29
49
|
|
|
30
|
-
/**
|
|
31
|
-
* 获取结点ID方法
|
|
32
|
-
* @param treedata 当前结点
|
|
33
|
-
* @returns 返回可以唯一标识当前结点的id
|
|
34
|
-
*/
|
|
50
|
+
/** 获取节点ID方法 */
|
|
35
51
|
id?: idType
|
|
36
52
|
|
|
37
53
|
}
|
package/types/TreeLayout.d.ts
CHANGED
|
@@ -2,58 +2,70 @@ import TreeType from "./Tree"
|
|
|
2
2
|
import { TreeResultType } from "./Tree"
|
|
3
3
|
import TreeOptionType from './TreeOption'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 树布局类型定义
|
|
7
|
+
* 继承自TreeType,提供树形布局的计算和操作功能
|
|
8
|
+
*/
|
|
5
9
|
export default interface TreeLayoutType extends TreeType {
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* 设置布局的行为
|
|
9
|
-
* @param option
|
|
13
|
+
* @param option 布局选项
|
|
14
|
+
* @returns 返回当前实例,支持链式调用
|
|
10
15
|
*/
|
|
11
16
|
setOption(option: TreeOptionType): this
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param initTree
|
|
16
|
-
* @param noOpens
|
|
19
|
+
* 计算树图坐标
|
|
20
|
+
* @param initTree 原始树数据
|
|
21
|
+
* @param noOpens 可选,节点初始是否闭合控制
|
|
22
|
+
* @returns 返回计算后的树结构数据
|
|
17
23
|
*/
|
|
18
24
|
use(initTree: any, noOpens?: {
|
|
19
25
|
[id: string]: boolean
|
|
20
26
|
}): TreeResultType
|
|
21
27
|
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param initTree
|
|
25
|
-
* @param renderBack
|
|
26
|
-
* @param noOpens
|
|
29
|
+
* 绑定数据和渲染方法
|
|
30
|
+
* @param initTree 原始树数据
|
|
31
|
+
* @param renderBack 渲染回调函数
|
|
32
|
+
* @param noOpens 可选,节点初始是否闭合控制
|
|
33
|
+
* @returns 返回当前实例,支持链式调用
|
|
27
34
|
*/
|
|
28
35
|
bind(initTree: any, renderBack: (tree: TreeResultType) => void, noOpens?: {
|
|
29
36
|
[id: string]: boolean
|
|
30
37
|
}): this
|
|
31
38
|
|
|
32
39
|
/**
|
|
33
|
-
*
|
|
40
|
+
* 解除数据绑定
|
|
41
|
+
* @returns 返回当前实例,支持链式调用
|
|
34
42
|
*/
|
|
35
43
|
unbind(): this
|
|
36
44
|
|
|
37
45
|
/**
|
|
38
46
|
* 闭合指定节点
|
|
39
|
-
* @param id
|
|
47
|
+
* @param id 节点ID
|
|
48
|
+
* @returns 返回当前实例,支持链式调用
|
|
40
49
|
*/
|
|
41
50
|
closeNode(id: string): this
|
|
42
51
|
|
|
43
52
|
/**
|
|
44
53
|
* 展开指定节点
|
|
45
|
-
* @param id
|
|
54
|
+
* @param id 节点ID
|
|
55
|
+
* @returns 返回当前实例,支持链式调用
|
|
46
56
|
*/
|
|
47
57
|
openNode(id: string): this
|
|
48
58
|
|
|
49
59
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param id
|
|
60
|
+
* 切换指定节点的展开/闭合状态
|
|
61
|
+
* @param id 节点ID
|
|
62
|
+
* @returns 返回当前实例,支持链式调用
|
|
52
63
|
*/
|
|
53
64
|
toggleNode(id: string): this
|
|
54
65
|
|
|
55
66
|
/**
|
|
56
67
|
* 主动触发绘制更新
|
|
68
|
+
* @returns 返回当前实例,支持链式调用
|
|
57
69
|
*/
|
|
58
70
|
doUpdate(): this
|
|
59
71
|
|
package/types/animation.d.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动画回调函数类型定义
|
|
3
|
+
* @param deep 动画进度值,范围0-1
|
|
4
|
+
*/
|
|
1
5
|
interface animationFun {
|
|
2
6
|
(deep: number): void
|
|
3
7
|
}
|
|
4
8
|
|
|
9
|
+
/**
|
|
10
|
+
* 动画函数类型定义
|
|
11
|
+
* 用于创建平滑的动画效果
|
|
12
|
+
*/
|
|
5
13
|
interface animationType {
|
|
14
|
+
/**
|
|
15
|
+
* 执行动画
|
|
16
|
+
* @param doback 动画执行函数,接收一个0-1之间的进度值
|
|
17
|
+
* @param duration 动画持续时间(毫秒),可选,默认为500ms
|
|
18
|
+
* @param callback 动画完成后的回调函数,可选
|
|
19
|
+
* @returns 返回一个函数,调用该函数可提前结束动画
|
|
20
|
+
*/
|
|
6
21
|
(doback: animationFun, duration?: number, callback?: animationFun): Function
|
|
7
22
|
}
|
|
8
23
|
|
package/types/assemble.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 步进生成器函数类型定义
|
|
3
|
+
* 用于生成步进序列数据
|
|
3
4
|
*/
|
|
4
5
|
export default interface assembleType {
|
|
6
|
+
/**
|
|
7
|
+
* 创建步进序列生成器
|
|
8
|
+
* @param begin 起始值
|
|
9
|
+
* @param end 结束值
|
|
10
|
+
* @param step 步长
|
|
11
|
+
* @param count 元素个数
|
|
12
|
+
* @returns 返回一个生成器函数,调用后返回数组
|
|
13
|
+
*/
|
|
5
14
|
(begin: number, end: number, step: number, count: number): () => Array<number>
|
|
6
15
|
}
|
package/types/getLoopColors.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 循环颜色获取函数类型定义
|
|
3
|
+
* 用于生成指定数量的循环色彩数组
|
|
3
4
|
*/
|
|
4
5
|
export default interface getLoopColorsType {
|
|
6
|
+
/**
|
|
7
|
+
* 生成循环色彩数组
|
|
8
|
+
* @param num 需要生成的颜色数量
|
|
9
|
+
* @param alpha 颜色透明度,可选,默认为1
|
|
10
|
+
* @param colorsFactory 自定义颜色工厂函数,可选
|
|
11
|
+
* @returns 返回生成的颜色数组
|
|
12
|
+
*/
|
|
5
13
|
(num: number, alpha?: number, colorsFactory?: (alpha: number) => Array<string>): string[]
|
|
6
14
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VISLite 主类型定义文件
|
|
3
|
+
* 包含所有核心组件的类型定义
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/// <reference path="./uni-canvas.d.ts" />
|
|
2
7
|
/// <reference path="./module.d.ts" />
|
|
3
8
|
|
|
@@ -42,7 +47,7 @@ import BarLayoutType from './BarLayout'
|
|
|
42
47
|
|
|
43
48
|
import { initOptionType, mergeOptionType } from './option'
|
|
44
49
|
|
|
45
|
-
//
|
|
50
|
+
// 插值构造函数类型
|
|
46
51
|
interface NewCardinalType extends CardinalType {
|
|
47
52
|
new(t?: number): CardinalType
|
|
48
53
|
}
|
|
@@ -50,12 +55,12 @@ interface NewHermiteType extends HermiteType {
|
|
|
50
55
|
new(u?: number): HermiteType
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
//
|
|
58
|
+
// 变换构造函数类型
|
|
54
59
|
interface NewMatrix4Type extends Matrix4Type {
|
|
55
60
|
new(initMatrix4?: number[]): Matrix4Type
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
//
|
|
63
|
+
// 画笔构造函数类型
|
|
59
64
|
interface NewSVGType extends SVGType {
|
|
60
65
|
new(el: HTMLElement | null): SVGType
|
|
61
66
|
}
|
|
@@ -66,7 +71,7 @@ interface NewRawCanvasType extends CanvasType {
|
|
|
66
71
|
new(canvas: any, region?: any, scaleSize?: number): CanvasType
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
// WebGL
|
|
74
|
+
// WebGL构造函数类型
|
|
70
75
|
interface NewShaderType extends ShaderType {
|
|
71
76
|
new(painter: WebGLRenderingContext): ShaderType
|
|
72
77
|
}
|
|
@@ -77,7 +82,7 @@ interface NewTextureType extends TextureType {
|
|
|
77
82
|
new(painter: WebGLRenderingContext, type: string, unit?: number): TextureType
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
//
|
|
85
|
+
// 投影构造函数类型
|
|
81
86
|
interface NewEoapType extends MapType {
|
|
82
87
|
new(scale?: number, center?: number[]): MapType
|
|
83
88
|
}
|
|
@@ -85,12 +90,12 @@ interface NewMercatorType extends MapType {
|
|
|
85
90
|
new(scale?: number, center?: number[]): MapType
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
//
|
|
93
|
+
// 坐标系构造函数类型
|
|
89
94
|
interface NewMapCoordinateType extends MapCoordinateType {
|
|
90
95
|
new(config?: MapConfigType): MapCoordinateType
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
//
|
|
98
|
+
// 布局构造函数类型
|
|
94
99
|
interface NewTreeLayoutType extends TreeLayoutType {
|
|
95
100
|
new(config?: TreeConfigType): TreeLayoutType
|
|
96
101
|
}
|
|
@@ -101,97 +106,117 @@ interface NewBarLayoutType extends BarLayoutType {
|
|
|
101
106
|
new(config?: BarConfigType): BarLayoutType
|
|
102
107
|
}
|
|
103
108
|
|
|
109
|
+
/**
|
|
110
|
+
* VISLite 主类
|
|
111
|
+
* 提供所有核心功能的静态访问入口
|
|
112
|
+
*/
|
|
104
113
|
export default class VISLite {
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
/** Cardinal插值函数 */
|
|
107
116
|
static Cardinal: NewCardinalType
|
|
117
|
+
/** Hermite插值函数 */
|
|
108
118
|
static Hermite: NewHermiteType
|
|
109
119
|
|
|
110
|
-
|
|
120
|
+
/** 4x4矩阵变换 */
|
|
111
121
|
static Matrix4: NewMatrix4Type
|
|
122
|
+
/** 旋转变换函数 */
|
|
112
123
|
static rotate: rotateType
|
|
124
|
+
/** 平移变换函数 */
|
|
113
125
|
static move: moveType
|
|
126
|
+
/** 缩放变换函数 */
|
|
114
127
|
static scale: scaleType
|
|
115
128
|
|
|
116
|
-
|
|
129
|
+
/** 循环颜色获取函数 */
|
|
117
130
|
static getLoopColors: getLoopColorsType
|
|
131
|
+
/** 动画函数 */
|
|
118
132
|
static animation: animationType
|
|
133
|
+
/** 刻度尺计算函数 */
|
|
119
134
|
static ruler: rulerType
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
/** SVG绘图类 */
|
|
122
137
|
static SVG: NewSVGType
|
|
138
|
+
/** Canvas绘图类 */
|
|
123
139
|
static Canvas: NewCanvasType
|
|
140
|
+
/** 原始Canvas绘图类 */
|
|
124
141
|
static RawCanvas: NewRawCanvasType
|
|
125
142
|
|
|
126
|
-
|
|
143
|
+
/** WebGL上下文获取函数 */
|
|
127
144
|
static getWebGLContext: getWebGLContextType
|
|
145
|
+
/** WebGL着色器类 */
|
|
128
146
|
static Shader: NewShaderType
|
|
147
|
+
/** WebGL缓冲区类 */
|
|
129
148
|
static Buffer: NewBufferType
|
|
149
|
+
/** WebGL纹理类 */
|
|
130
150
|
static Texture: NewTextureType
|
|
131
151
|
|
|
132
|
-
|
|
152
|
+
/** Eoap投影类 */
|
|
133
153
|
static Eoap: NewEoapType
|
|
154
|
+
/** Mercator投影类 */
|
|
134
155
|
static Mercator: NewMercatorType
|
|
135
156
|
|
|
136
|
-
|
|
157
|
+
/** 节流函数 */
|
|
137
158
|
static throttle: throttleType
|
|
159
|
+
/** 数据组装函数 */
|
|
138
160
|
static assemble: assembleType
|
|
139
161
|
|
|
140
|
-
|
|
162
|
+
/** 地图坐标系类 */
|
|
141
163
|
static MapCoordinate: NewMapCoordinateType
|
|
142
164
|
|
|
143
|
-
|
|
165
|
+
/** 树形布局类 */
|
|
144
166
|
static TreeLayout: NewTreeLayoutType
|
|
167
|
+
/** 饼图布局类 */
|
|
145
168
|
static PieLayout: NewPieLayoutType
|
|
169
|
+
/** 柱状图布局类 */
|
|
146
170
|
static BarLayout: NewBarLayoutType
|
|
147
171
|
|
|
148
|
-
|
|
172
|
+
/** 配置项初始化函数 */
|
|
149
173
|
static initOption: initOptionType
|
|
174
|
+
/** 配置项合并函数 */
|
|
150
175
|
static mergeOption: mergeOptionType
|
|
151
176
|
}
|
|
152
177
|
|
|
153
|
-
//
|
|
178
|
+
// 插值函数导出
|
|
154
179
|
export let Cardinal: NewCardinalType
|
|
155
180
|
export let Hermite: NewHermiteType
|
|
156
181
|
|
|
157
|
-
//
|
|
182
|
+
// 变换函数导出
|
|
158
183
|
export let Matrix4: NewMatrix4Type
|
|
159
184
|
export let rotate: rotateType
|
|
160
185
|
export let move: moveType
|
|
161
186
|
export let scale: scaleType
|
|
162
187
|
|
|
163
|
-
//
|
|
188
|
+
// 工具函数导出
|
|
164
189
|
export let getLoopColors: getLoopColorsType
|
|
165
190
|
export let animation: animationType
|
|
166
191
|
export let ruler: rulerType
|
|
167
192
|
|
|
168
|
-
//
|
|
193
|
+
// 画笔类导出
|
|
169
194
|
export let SVG: NewSVGType
|
|
170
195
|
export let Canvas: NewCanvasType
|
|
171
196
|
export let RawCanvas: NewRawCanvasType
|
|
172
197
|
|
|
173
|
-
// WebGL
|
|
198
|
+
// WebGL相关导出
|
|
174
199
|
export let getWebGLContext: getWebGLContextType
|
|
175
200
|
export let Shader: NewShaderType
|
|
176
201
|
export let Buffer: NewBufferType
|
|
177
202
|
export let Texture: NewTextureType
|
|
178
203
|
|
|
179
|
-
//
|
|
204
|
+
// 投影类导出
|
|
180
205
|
export let Eoap: NewEoapType
|
|
181
206
|
export let Mercator: NewMercatorType
|
|
182
207
|
|
|
183
|
-
//
|
|
208
|
+
// 辅助函数导出
|
|
184
209
|
export let throttle: throttleType
|
|
185
210
|
export let assemble: assembleType
|
|
186
211
|
|
|
187
|
-
//
|
|
212
|
+
// 坐标系类导出
|
|
188
213
|
export let MapCoordinate: NewMapCoordinateType
|
|
189
214
|
|
|
190
|
-
//
|
|
215
|
+
// 布局类导出
|
|
191
216
|
export let TreeLayout: NewTreeLayoutType
|
|
192
217
|
export let PieLayout: NewPieLayoutType
|
|
193
218
|
export let BarLayout: NewBarLayoutType
|
|
194
219
|
|
|
195
|
-
//
|
|
220
|
+
// 配置项函数导出
|
|
196
221
|
export let initOption: initOptionType
|
|
197
222
|
export let mergeOption: mergeOptionType
|
package/types/move.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 平移变换函数类型定义
|
|
3
|
+
* 用于计算二维坐标系中的平移变换
|
|
3
4
|
*/
|
|
4
5
|
export default interface moveType {
|
|
6
|
+
/**
|
|
7
|
+
* 计算平移后的坐标
|
|
8
|
+
* @param ax 平移向量的x分量
|
|
9
|
+
* @param ay 平移向量的y分量
|
|
10
|
+
* @param d 平移距离
|
|
11
|
+
* @param x 原始点的x坐标
|
|
12
|
+
* @param y 原始点的y坐标
|
|
13
|
+
* @returns 返回平移后的坐标 [newX, newY]
|
|
14
|
+
*/
|
|
5
15
|
(ax: number, ay: number, d: number, x: number, y: number): [number, number]
|
|
6
16
|
}
|