vislite 1.9.0 → 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 +15 -0
- package/README.md +53 -52
- package/lib/BarLayout/index.es.js +8 -17
- package/lib/BarLayout/index.es.min.js +1 -10
- package/lib/Buffer/index.es.js +0 -4
- package/lib/Buffer/index.es.min.js +0 -4
- package/lib/Canvas/index.es.js +0 -4
- package/lib/Canvas/index.es.min.js +0 -4
- package/lib/Cardinal/index.es.js +0 -4
- package/lib/Cardinal/index.es.min.js +0 -4
- package/lib/Eoap/index.es.js +0 -4
- package/lib/Eoap/index.es.min.js +0 -4
- package/lib/Hermite/index.es.js +0 -4
- package/lib/Hermite/index.es.min.js +0 -4
- package/lib/MapCoordinate/index.es.js +0 -4
- package/lib/MapCoordinate/index.es.min.js +0 -4
- package/lib/Matrix4/index.es.js +0 -4
- package/lib/Matrix4/index.es.min.js +0 -4
- package/lib/Mercator/index.es.js +0 -4
- package/lib/Mercator/index.es.min.js +0 -4
- package/lib/PieLayout/index.es.js +8 -17
- package/lib/PieLayout/index.es.min.js +1 -9
- package/lib/RawCanvas/index.es.js +0 -4
- package/lib/RawCanvas/index.es.min.js +0 -4
- package/lib/SVG/index.es.js +14 -9
- package/lib/SVG/index.es.min.js +1 -5
- package/lib/Shader/index.es.js +0 -4
- package/lib/Shader/index.es.min.js +0 -4
- package/lib/Texture/index.es.js +0 -4
- package/lib/Texture/index.es.min.js +0 -4
- package/lib/TreeLayout/index.es.js +8 -17
- package/lib/TreeLayout/index.es.min.js +1 -9
- package/lib/animation/index.es.js +8 -17
- package/lib/animation/index.es.min.js +1 -9
- package/lib/assemble/index.es.js +0 -4
- package/lib/assemble/index.es.min.js +0 -4
- package/lib/getLoopColors/index.es.js +0 -4
- package/lib/getLoopColors/index.es.min.js +0 -4
- package/lib/getWebGLContext/index.es.js +0 -4
- package/lib/getWebGLContext/index.es.min.js +0 -4
- package/lib/index.umd.js +27 -28
- package/lib/index.umd.min.js +2 -12
- package/lib/initOption/index.es.js +0 -4
- package/lib/initOption/index.es.min.js +0 -4
- package/lib/mergeOption/index.es.js +0 -4
- package/lib/mergeOption/index.es.min.js +0 -4
- package/lib/move/index.es.js +0 -4
- package/lib/move/index.es.min.js +0 -4
- package/lib/rotate/index.es.js +0 -4
- package/lib/rotate/index.es.min.js +0 -4
- package/lib/ruler/index.es.js +0 -4
- package/lib/ruler/index.es.min.js +0 -4
- package/lib/scale/index.es.js +0 -4
- package/lib/scale/index.es.min.js +0 -4
- package/lib/throttle/index.es.js +4 -13
- package/lib/throttle/index.es.min.js +1 -9
- package/package.json +3 -2
- package/src/SVG.ts +19 -5
- 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/uni-app/ui-canvas.vue +2 -2
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
|
}
|
package/types/painterConfig.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 绘图配置相关类型定义
|
|
3
|
+
* 定义了绘图相关的枚举类型
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** 圆弧端点类型 */
|
|
1
7
|
export type arcCapType = "butt" | "round" | "-round"
|
|
8
|
+
/** 文字水平对齐方式 */
|
|
2
9
|
export type textAlignType = "left" | "center" | "right"
|
|
10
|
+
/** 文字垂直对齐方式 */
|
|
3
11
|
export type textBaselineType = "top" | "middle" | "bottom"
|
|
12
|
+
/** 线条端点类型 */
|
|
4
13
|
export type lineCapType = "butt" | "round" | "square"
|
|
14
|
+
/** 线条连接方式 */
|
|
5
15
|
export type lineJoinType = "miter" | "bevel" | "round"
|
package/types/rotate.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 旋转变换函数类型定义
|
|
3
|
+
* 用于计算二维坐标系中的旋转变换
|
|
3
4
|
*/
|
|
4
5
|
export default interface rotateType {
|
|
6
|
+
/**
|
|
7
|
+
* 计算旋转后的坐标
|
|
8
|
+
* @param cx 旋转中心的x坐标
|
|
9
|
+
* @param cy 旋转中心的y坐标
|
|
10
|
+
* @param deg 旋转角度(度)
|
|
11
|
+
* @param x 原始点的x坐标
|
|
12
|
+
* @param y 原始点的y坐标
|
|
13
|
+
* @returns 返回旋转后的坐标 [newX, newY]
|
|
14
|
+
*/
|
|
5
15
|
(cx: number, cy: number, deg: number, x: number, y: number): [number, number]
|
|
6
16
|
}
|
package/types/ruler.d.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 刻度尺配置选项类型定义
|
|
3
|
+
*/
|
|
1
4
|
export interface rulerOptionType {
|
|
5
|
+
/** 最大值限制 */
|
|
2
6
|
max?: number
|
|
7
|
+
/** 最小值限制 */
|
|
3
8
|
min?: number
|
|
4
9
|
}
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
12
|
+
* 刻度尺计算函数类型定义
|
|
13
|
+
* 用于在给定范围内生成均匀的刻度值
|
|
8
14
|
*/
|
|
9
15
|
export default interface rulerType {
|
|
16
|
+
/**
|
|
17
|
+
* 生成刻度值数组
|
|
18
|
+
* @param maxValue 数据最大值
|
|
19
|
+
* @param minValue 数据最小值
|
|
20
|
+
* @param num 期望的刻度数量
|
|
21
|
+
* @param option 可选的配置选项
|
|
22
|
+
* @returns 返回计算得到的刻度值数组
|
|
23
|
+
*/
|
|
10
24
|
(maxValue: number, minValue: number, num: number, option?: rulerOptionType): number[]
|
|
11
25
|
}
|
package/types/scale.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 缩放变换函数类型定义
|
|
3
|
+
* 用于计算二维坐标系中的缩放变换
|
|
3
4
|
*/
|
|
4
5
|
export default interface scaleType {
|
|
6
|
+
/**
|
|
7
|
+
* 计算缩放后的坐标
|
|
8
|
+
* @param cx 缩放中心的x坐标
|
|
9
|
+
* @param cy 缩放中心的y坐标
|
|
10
|
+
* @param times 缩放倍数
|
|
11
|
+
* @param x 原始点的x坐标
|
|
12
|
+
* @param y 原始点的y坐标
|
|
13
|
+
* @returns 返回缩放后的坐标 [newX, newY]
|
|
14
|
+
*/
|
|
5
15
|
(cx: number, cy: number, times: number, x: number, y: number): [number, number]
|
|
6
16
|
}
|
package/types/throttle.d.ts
CHANGED
package/uni-app/ui-canvas.vue
CHANGED
|
@@ -131,9 +131,9 @@ export default {
|
|
|
131
131
|
regionid = "region";
|
|
132
132
|
// #endif
|
|
133
133
|
// #ifndef MP-WEIXIN
|
|
134
|
-
painter = uni.createCanvasContext("painter-" + this.uniqueid
|
|
134
|
+
painter = uni.createCanvasContext("painter-" + this.uniqueid);
|
|
135
135
|
if (this.region)
|
|
136
|
-
region = uni.createCanvasContext("region-" + this.uniqueid
|
|
136
|
+
region = uni.createCanvasContext("region-" + this.uniqueid);
|
|
137
137
|
painterid = "painter-" + this.uniqueid;
|
|
138
138
|
regionid = "region-" + this.uniqueid;
|
|
139
139
|
// #endif
|