vislite 0.6.0 → 0.7.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 -1
- package/README.md +24 -5
- package/lib/Buffer/index.umd.js +2 -2
- package/lib/Buffer/index.umd.min.js +2 -2
- package/lib/Canvas/index.umd.js +4 -4
- package/lib/Canvas/index.umd.min.js +3 -3
- package/lib/Cardinal/index.umd.js +2 -2
- package/lib/Cardinal/index.umd.min.js +2 -2
- package/lib/Eoap/index.umd.js +2 -2
- package/lib/Eoap/index.umd.min.js +2 -2
- package/lib/Geometry/index.umd.js +69 -8
- package/lib/Geometry/index.umd.min.js +3 -3
- package/lib/Hermite/index.umd.js +2 -2
- package/lib/Hermite/index.umd.min.js +2 -2
- package/lib/Matrix4/index.umd.js +2 -2
- package/lib/Matrix4/index.umd.min.js +2 -2
- package/lib/Mercator/index.umd.js +2 -2
- package/lib/Mercator/index.umd.min.js +2 -2
- package/lib/OralCanvas/index.es.js +3 -3
- package/lib/OralCanvas/index.es.min.js +3 -3
- package/lib/OralWebGL/index.es.js +21 -18
- package/lib/OralWebGL/index.es.min.js +3 -3
- package/lib/SVG/index.umd.js +2 -2
- package/lib/SVG/index.umd.min.js +2 -2
- package/lib/Shader/index.umd.js +3 -2
- package/lib/Shader/index.umd.min.js +3 -3
- package/lib/Texture/index.umd.js +2 -2
- package/lib/Texture/index.umd.min.js +2 -2
- package/lib/TreeLayout/index.umd.js +13 -11
- package/lib/TreeLayout/index.umd.min.js +3 -3
- package/lib/WebGL/index.umd.js +22 -19
- package/lib/WebGL/index.umd.min.js +3 -3
- package/lib/animation/index.umd.js +2 -2
- package/lib/animation/index.umd.min.js +2 -2
- package/lib/formatColor/index.umd.js +2 -2
- package/lib/formatColor/index.umd.min.js +2 -2
- package/lib/getLoopColors/index.umd.js +2 -2
- package/lib/getLoopColors/index.umd.min.js +2 -2
- package/lib/getWebGLContext/index.umd.js +4 -4
- package/lib/getWebGLContext/index.umd.min.js +3 -3
- package/lib/index.umd.js +104 -38
- package/lib/index.umd.min.js +3 -3
- package/lib/move/index.umd.js +2 -2
- package/lib/move/index.umd.min.js +2 -2
- package/lib/resizeObserver/index.umd.js +2 -2
- package/lib/resizeObserver/index.umd.min.js +2 -2
- package/lib/rotate/index.umd.js +2 -2
- package/lib/rotate/index.umd.min.js +2 -2
- package/lib/ruler/index.umd.js +4 -4
- package/lib/ruler/index.umd.min.js +3 -3
- package/lib/scale/index.umd.js +2 -2
- package/lib/scale/index.umd.min.js +2 -2
- package/lib/throttle/index.umd.js +2 -2
- package/lib/throttle/index.umd.min.js +2 -2
- package/lib/viewHandler/index.umd.js +2 -2
- package/lib/viewHandler/index.umd.min.js +2 -2
- package/package/TreeLayout/index.ts +2 -2
- package/package.json +1 -1
- package/src/Canvas.ts +1 -1
- package/src/Eoap.ts +66 -66
- package/src/Geometry.ts +57 -13
- package/src/Matrix4/index.ts +84 -84
- package/src/Matrix4/move.ts +12 -12
- package/src/Matrix4/rotate.ts +1 -1
- package/src/Matrix4/transform.ts +1 -1
- package/src/Mercator.ts +27 -27
- package/src/SVG.ts +24 -24
- package/src/WebGL.ts +1 -1
- package/src/animation.ts +98 -98
- package/src/common/assemble.ts +1 -1
- package/src/common/canvas/arc.ts +51 -51
- package/src/common/canvas/config.ts +158 -158
- package/src/common/canvas/gradient.ts +29 -29
- package/src/common/canvas/index.ts +2 -2
- package/src/common/canvas/painter.ts +2 -0
- package/src/common/geometry/prism-horizontal.ts +35 -35
- package/src/common/geometry/prism-vertical.ts +1 -1
- package/src/common/geometry/sphere-fragment.ts +40 -40
- package/src/common/geometry/tool/circle.ts +11 -11
- package/src/common/geometry/tool/rotateLine.ts +36 -0
- package/src/common/mergeOption.ts +6 -6
- package/src/common/setStyle.ts +1 -1
- package/src/common/svg/config.ts +10 -6
- package/src/common/svg/gradient.ts +63 -63
- package/src/common/svg/index.ts +5 -5
- package/src/common/svg/tool.ts +6 -6
- package/src/common/tree/toInnerTree.ts +8 -6
- package/src/common/tree/toPlainTree.ts +1 -1
- package/src/common/webgl/buffer.ts +1 -1
- package/src/common/webgl/doDraw.ts +16 -16
- package/src/common/webgl/getColorFactory.ts +26 -26
- package/src/common/webgl/getShader.ts +48 -48
- package/src/common/webgl/getTexture.ts +11 -11
- package/src/common/webgl/getWebGLContext.ts +3 -3
- package/src/common/webgl/index.ts +6 -4
- package/src/common/webgl/shader.ts +3 -3
- package/src/common/webgl/texture.ts +2 -2
- package/src/formatColor.ts +44 -44
- package/src/getLoopColors.ts +42 -42
- package/src/interpolation/Cardinal.ts +110 -110
- package/src/interpolation/Hermite.ts +65 -65
- package/src/layout/TreeLayout.ts +13 -11
- package/src/move.ts +7 -7
- package/src/resizeObserver.ts +2 -2
- package/src/rotate.ts +7 -7
- package/src/ruler.ts +10 -10
- package/src/throttle.ts +52 -52
- package/src/viewHandler.ts +4 -2
- package/types/Canvas.d.ts +1 -1
- package/types/CanvasOption.d.ts +8 -8
- package/types/CanvasOpts.d.ts +9 -9
- package/types/Geometry.d.ts +65 -40
- package/types/Matrix4.d.ts +47 -47
- package/types/SVGConfig.d.ts +79 -76
- package/types/TreeConfig.d.ts +36 -24
- package/uni-app/ui-canvas.vue +9 -31
- package/.editorconfig +0 -19
- package/.eslintrc.js +0 -26
package/src/ruler.ts
CHANGED
|
@@ -106,7 +106,7 @@ export default function (maxValue: number, minValue: number, num: number, option
|
|
|
106
106
|
const balanceMax = () => {
|
|
107
107
|
const rulerArray_temp = []
|
|
108
108
|
|
|
109
|
-
const changeDist = rulerArray[rulerArray.length - 1] - option
|
|
109
|
+
const changeDist = rulerArray[rulerArray.length - 1] - (option?.max as number)
|
|
110
110
|
for (let index = 0; index < rulerArray.length; index++) {
|
|
111
111
|
if (index + 1 < rulerArray.length && rulerArray[index + 1] - changeDist < minValue) {
|
|
112
112
|
// 多余的
|
|
@@ -121,7 +121,7 @@ export default function (maxValue: number, minValue: number, num: number, option
|
|
|
121
121
|
const balanceMin = () => {
|
|
122
122
|
const rulerArray_temp = []
|
|
123
123
|
|
|
124
|
-
const changeDist = rulerArray[0] - option
|
|
124
|
+
const changeDist = rulerArray[0] - (option?.min as number)
|
|
125
125
|
for (let index = 0; index < rulerArray.length; index++) {
|
|
126
126
|
rulerArray_temp[index] = rulerArray[index] - changeDist
|
|
127
127
|
if (maxValue <= rulerArray_temp[index]) break
|
|
@@ -133,23 +133,23 @@ export default function (maxValue: number, minValue: number, num: number, option
|
|
|
133
133
|
if (option) {
|
|
134
134
|
|
|
135
135
|
// 上下界限制
|
|
136
|
-
if ('max' in option && 'min' in option && option.max >= maxValue && option.min <= minValue) {
|
|
136
|
+
if ('max' in option && 'min' in option && (option.max as number) >= maxValue && (option.min as number) <= minValue) {
|
|
137
137
|
|
|
138
138
|
const isAnswer = () => {
|
|
139
139
|
|
|
140
140
|
// 先判断原始的是否可行
|
|
141
|
-
if (rulerArray[0] >= option.min && rulerArray[rulerArray.length - 1] <= option.max) return true
|
|
141
|
+
if (rulerArray[0] >= (option.min as number) && rulerArray[rulerArray.length - 1] <= (option.max as number)) return true
|
|
142
142
|
|
|
143
143
|
// 再判断max调整是否可行
|
|
144
144
|
const rulerArray_max = balanceMax()
|
|
145
|
-
if (rulerArray_max[0] >= option.min && rulerArray_max[rulerArray_max.length - 1] <= option.max) {
|
|
145
|
+
if (rulerArray_max[0] >= (option.min as number) && rulerArray_max[rulerArray_max.length - 1] <= (option.max as number)) {
|
|
146
146
|
rulerArray = rulerArray_max
|
|
147
147
|
return true
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// 再判断max调整是否可行
|
|
151
151
|
const rulerArray_min = balanceMin()
|
|
152
|
-
if (rulerArray_min[0] >= option.min && rulerArray_min[rulerArray_max.length - 1] <= option.max) {
|
|
152
|
+
if (rulerArray_min[0] >= (option.min as number) && rulerArray_min[rulerArray_max.length - 1] <= (option.max as number)) {
|
|
153
153
|
rulerArray = rulerArray_min
|
|
154
154
|
return true
|
|
155
155
|
}
|
|
@@ -170,16 +170,16 @@ export default function (maxValue: number, minValue: number, num: number, option
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// 单界限制
|
|
173
|
-
if ('max' in option && option.max >= maxValue) {
|
|
173
|
+
if ('max' in option && (option.max as number) >= maxValue) {
|
|
174
174
|
|
|
175
175
|
// 上越界了
|
|
176
|
-
if (option.max < rulerArray[rulerArray.length - 1]) {
|
|
176
|
+
if ((option.max as number) < rulerArray[rulerArray.length - 1]) {
|
|
177
177
|
rulerArray = balanceMax()
|
|
178
178
|
}
|
|
179
|
-
} else if ('min' in option && option.min <= minValue) {
|
|
179
|
+
} else if ('min' in option && (option.min as number) <= minValue) {
|
|
180
180
|
|
|
181
181
|
// 下越界了
|
|
182
|
-
if (option.min > rulerArray[0]) {
|
|
182
|
+
if ((option.min as number) > rulerArray[0]) {
|
|
183
183
|
rulerArray = balanceMin()
|
|
184
184
|
}
|
|
185
185
|
}
|
package/src/throttle.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import type throttleOptionType from '../types/throttleOption'
|
|
2
|
-
|
|
3
|
-
import mergeOption from './common/mergeOption'
|
|
4
|
-
|
|
5
|
-
export default function (callback: Function, option: throttleOptionType = {}) {
|
|
6
|
-
|
|
7
|
-
// 校对缺省值
|
|
8
|
-
option = mergeOption(option, <throttleOptionType>{
|
|
9
|
-
time: 200,
|
|
10
|
-
keep: false,
|
|
11
|
-
opportunity: "end"
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
let hadInterval = false
|
|
15
|
-
let hadClick = false
|
|
16
|
-
let oneClick = false
|
|
17
|
-
|
|
18
|
-
let arg: any
|
|
19
|
-
return function () {
|
|
20
|
-
const _this = this
|
|
21
|
-
// eslint-disable-next-line prefer-rest-params
|
|
22
|
-
arg = arguments
|
|
23
|
-
|
|
24
|
-
// 如果前置任务都完成了
|
|
25
|
-
if (!hadInterval) {
|
|
26
|
-
if (option.opportunity != 'end') {
|
|
27
|
-
callback.apply(_this, arg)
|
|
28
|
-
}
|
|
29
|
-
hadInterval = true
|
|
30
|
-
|
|
31
|
-
const interval = setInterval(() => {
|
|
32
|
-
if (hadClick) {
|
|
33
|
-
if (!option.keep) {
|
|
34
|
-
callback.apply(_this, arg)
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
if (option.opportunity != 'begin') {
|
|
38
|
-
if (oneClick || option.opportunity == 'end') callback.apply(_this, arg)
|
|
39
|
-
}
|
|
40
|
-
hadInterval = false
|
|
41
|
-
oneClick = false
|
|
42
|
-
clearInterval(interval)
|
|
43
|
-
}
|
|
44
|
-
hadClick = false
|
|
45
|
-
}, option.time)
|
|
46
|
-
} else {
|
|
47
|
-
hadClick = true
|
|
48
|
-
oneClick = true
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
1
|
+
import type throttleOptionType from '../types/throttleOption'
|
|
2
|
+
|
|
3
|
+
import mergeOption from './common/mergeOption'
|
|
4
|
+
|
|
5
|
+
export default function (callback: Function, option: throttleOptionType = {}) {
|
|
6
|
+
|
|
7
|
+
// 校对缺省值
|
|
8
|
+
option = mergeOption(option, <throttleOptionType>{
|
|
9
|
+
time: 200,
|
|
10
|
+
keep: false,
|
|
11
|
+
opportunity: "end"
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
let hadInterval = false
|
|
15
|
+
let hadClick = false
|
|
16
|
+
let oneClick = false
|
|
17
|
+
|
|
18
|
+
let arg: any
|
|
19
|
+
return function () {
|
|
20
|
+
const _this = this
|
|
21
|
+
// eslint-disable-next-line prefer-rest-params
|
|
22
|
+
arg = arguments
|
|
23
|
+
|
|
24
|
+
// 如果前置任务都完成了
|
|
25
|
+
if (!hadInterval) {
|
|
26
|
+
if (option.opportunity != 'end') {
|
|
27
|
+
callback.apply(_this, arg)
|
|
28
|
+
}
|
|
29
|
+
hadInterval = true
|
|
30
|
+
|
|
31
|
+
const interval = setInterval(() => {
|
|
32
|
+
if (hadClick) {
|
|
33
|
+
if (!option.keep) {
|
|
34
|
+
callback.apply(_this, arg)
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (option.opportunity != 'begin') {
|
|
38
|
+
if (oneClick || option.opportunity == 'end') callback.apply(_this, arg)
|
|
39
|
+
}
|
|
40
|
+
hadInterval = false
|
|
41
|
+
oneClick = false
|
|
42
|
+
clearInterval(interval)
|
|
43
|
+
}
|
|
44
|
+
hadClick = false
|
|
45
|
+
}, option.time)
|
|
46
|
+
} else {
|
|
47
|
+
hadClick = true
|
|
48
|
+
oneClick = true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
53
|
}
|
package/src/viewHandler.ts
CHANGED
|
@@ -68,8 +68,10 @@ export default function (callback: callbackFun) {
|
|
|
68
68
|
})
|
|
69
69
|
|
|
70
70
|
// 鼠标控制
|
|
71
|
-
let mouseP
|
|
72
|
-
|
|
71
|
+
let mouseP: {
|
|
72
|
+
[key: string]: number
|
|
73
|
+
} | null = null;
|
|
74
|
+
const doMove = function (event: any) {
|
|
73
75
|
|
|
74
76
|
// 单纯移动
|
|
75
77
|
if (mouseP == null) {
|
package/types/Canvas.d.ts
CHANGED
package/types/CanvasOption.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import CanvasOptsType from "./CanvasOpts"
|
|
2
|
-
|
|
3
|
-
export default interface CanvasOptionType extends CanvasOptsType {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 是否支持区域管理,默认true
|
|
7
|
-
*/
|
|
8
|
-
region?: boolean
|
|
1
|
+
import CanvasOptsType from "./CanvasOpts"
|
|
2
|
+
|
|
3
|
+
export default interface CanvasOptionType extends CanvasOptsType {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 是否支持区域管理,默认true
|
|
7
|
+
*/
|
|
8
|
+
region?: boolean
|
|
9
9
|
}
|
package/types/CanvasOpts.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export default interface CanvasOptsType {
|
|
2
|
-
|
|
3
|
-
// https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
|
|
4
|
-
willReadFrequently?: boolean
|
|
5
|
-
|
|
6
|
-
alpha?: boolean
|
|
7
|
-
|
|
8
|
-
storage?: string
|
|
9
|
-
|
|
1
|
+
export default interface CanvasOptsType {
|
|
2
|
+
|
|
3
|
+
// https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
|
|
4
|
+
willReadFrequently?: boolean
|
|
5
|
+
|
|
6
|
+
alpha?: boolean
|
|
7
|
+
|
|
8
|
+
storage?: string
|
|
9
|
+
|
|
10
10
|
}
|
package/types/Geometry.d.ts
CHANGED
|
@@ -1,41 +1,66 @@
|
|
|
1
|
-
import GeometryResultType from './GeometryResult'
|
|
2
|
-
import GeometryOptionType from './GeometryOption'
|
|
3
|
-
|
|
4
|
-
export default interface GeometryType {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 配置对象
|
|
8
|
-
*/
|
|
9
|
-
config(option: GeometryOptionType): this
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 圆柱体
|
|
13
|
-
* @param x
|
|
14
|
-
* @param y
|
|
15
|
-
* @param z
|
|
16
|
-
* @param radius
|
|
17
|
-
* @param height
|
|
18
|
-
*/
|
|
19
|
-
cylinder(x: number, y: number, z: number, radius: number, height: number): Array<GeometryResultType>
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param x
|
|
24
|
-
* @param y
|
|
25
|
-
* @param z
|
|
26
|
-
* @param radius
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import GeometryResultType from './GeometryResult'
|
|
2
|
+
import GeometryOptionType from './GeometryOption'
|
|
3
|
+
|
|
4
|
+
export default interface GeometryType {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 配置对象
|
|
8
|
+
*/
|
|
9
|
+
config(option: GeometryOptionType): this
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 圆柱体
|
|
13
|
+
* @param x
|
|
14
|
+
* @param y
|
|
15
|
+
* @param z
|
|
16
|
+
* @param radius
|
|
17
|
+
* @param height
|
|
18
|
+
*/
|
|
19
|
+
cylinder(x: number, y: number, z: number, radius: number, height: number): Array<GeometryResultType>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 圆柱体
|
|
23
|
+
* @param x
|
|
24
|
+
* @param y
|
|
25
|
+
* @param z
|
|
26
|
+
* @param radius
|
|
27
|
+
* @param x2
|
|
28
|
+
* @param y2
|
|
29
|
+
* @param z2
|
|
30
|
+
*/
|
|
31
|
+
cylinder(x: number, y: number, z: number, radius: number, x2: number, y2: number, z2: number): Array<GeometryResultType>
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 棱柱体
|
|
35
|
+
* @param x
|
|
36
|
+
* @param y
|
|
37
|
+
* @param z
|
|
38
|
+
* @param radius
|
|
39
|
+
* @param height
|
|
40
|
+
* @param num
|
|
41
|
+
*/
|
|
42
|
+
prism(x: number, y: number, z: number, radius: number, height: number, num: number): Array<GeometryResultType>
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 棱柱体
|
|
46
|
+
* @param x
|
|
47
|
+
* @param y
|
|
48
|
+
* @param z
|
|
49
|
+
* @param radius
|
|
50
|
+
* @param x2
|
|
51
|
+
* @param y2
|
|
52
|
+
* @param z2
|
|
53
|
+
* @param num
|
|
54
|
+
*/
|
|
55
|
+
prism(x: number, y: number, z: number, radius: number, x2: number, y2: number, z2: number, num: number): Array<GeometryResultType>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 球体
|
|
59
|
+
* @param cx
|
|
60
|
+
* @param cy
|
|
61
|
+
* @param cz
|
|
62
|
+
* @param radius
|
|
63
|
+
*/
|
|
64
|
+
sphere(cx: number, cy: number, cz: number, radius: number): Array<GeometryResultType>
|
|
65
|
+
|
|
41
66
|
}
|
package/types/Matrix4.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export default interface Matrix4Type {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 返回matrix4当前记录的内部矩阵
|
|
5
|
-
*/
|
|
6
|
-
value(): number[]
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 两个矩阵相乘
|
|
10
|
-
* @param newMatrix4
|
|
11
|
-
* @param flag 可选,表示相乘位置,默认false,表示左乘
|
|
12
|
-
*/
|
|
13
|
-
multiply(newMatrix4: number[], flag?: boolean): this
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 把变换矩阵作用在具体的点上
|
|
17
|
-
*/
|
|
18
|
-
use(x: number, y: number, z?: number, w?: number): [number, number, number, number]
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 设置内置矩阵
|
|
22
|
-
*/
|
|
23
|
-
setValue(initMatrix4?: number[]): this
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 沿着向量(a, b, c)方向移动距离dis
|
|
27
|
-
* (其中c可以不传,默认0)
|
|
28
|
-
*/
|
|
29
|
-
move(dis: number, a: number, b: number, c?: number): this
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 以点(cx, cy, cz)为中心,分别在x、y和z方向上缩放xTimes、yTimes和zTimes倍
|
|
33
|
-
* (其中cx、cy和cz都可以不传递,默认0)
|
|
34
|
-
*/
|
|
35
|
-
scale(xTimes: number, yTimes: number, zTimes: number, cx?: number, cy?: number, cz?: number): this
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 围绕射线(a1, b1, c1) -> (a2, b2, c2)旋转deg度
|
|
39
|
-
* (方向由右手法则确定)
|
|
40
|
-
*
|
|
41
|
-
* a1、b1、c1、a2、b2和c2这6个值在设置的时候,不是一定需要全部设置,还有以下可选:
|
|
42
|
-
*
|
|
43
|
-
* 1)只设置了a1和b1,表示在xoy平面围绕(a1, b1)旋转
|
|
44
|
-
* 2)设置三个点(设置不足六个点都认为只设置了三个点),表示围绕从原点出发的射线旋转
|
|
45
|
-
*/
|
|
46
|
-
rotate(deg: number, a1: number, b1: number, c1?: number, a2?: number, b2?: number, c2?: number): this
|
|
47
|
-
|
|
1
|
+
export default interface Matrix4Type {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 返回matrix4当前记录的内部矩阵
|
|
5
|
+
*/
|
|
6
|
+
value(): number[]
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 两个矩阵相乘
|
|
10
|
+
* @param newMatrix4
|
|
11
|
+
* @param flag 可选,表示相乘位置,默认false,表示左乘
|
|
12
|
+
*/
|
|
13
|
+
multiply(newMatrix4: number[], flag?: boolean): this
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 把变换矩阵作用在具体的点上
|
|
17
|
+
*/
|
|
18
|
+
use(x: number, y: number, z?: number, w?: number): [number, number, number, number]
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 设置内置矩阵
|
|
22
|
+
*/
|
|
23
|
+
setValue(initMatrix4?: number[]): this
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 沿着向量(a, b, c)方向移动距离dis
|
|
27
|
+
* (其中c可以不传,默认0)
|
|
28
|
+
*/
|
|
29
|
+
move(dis: number, a: number, b: number, c?: number): this
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 以点(cx, cy, cz)为中心,分别在x、y和z方向上缩放xTimes、yTimes和zTimes倍
|
|
33
|
+
* (其中cx、cy和cz都可以不传递,默认0)
|
|
34
|
+
*/
|
|
35
|
+
scale(xTimes: number, yTimes: number, zTimes: number, cx?: number, cy?: number, cz?: number): this
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 围绕射线(a1, b1, c1) -> (a2, b2, c2)旋转deg度
|
|
39
|
+
* (方向由右手法则确定)
|
|
40
|
+
*
|
|
41
|
+
* a1、b1、c1、a2、b2和c2这6个值在设置的时候,不是一定需要全部设置,还有以下可选:
|
|
42
|
+
*
|
|
43
|
+
* 1)只设置了a1和b1,表示在xoy平面围绕(a1, b1)旋转
|
|
44
|
+
* 2)设置三个点(设置不足六个点都认为只设置了三个点),表示围绕从原点出发的射线旋转
|
|
45
|
+
*/
|
|
46
|
+
rotate(deg: number, a1: number, b1: number, c1?: number, a2?: number, b2?: number, c2?: number): this
|
|
47
|
+
|
|
48
48
|
}
|
package/types/SVGConfig.d.ts
CHANGED
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
* 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
|
|
25
|
+
*/
|
|
26
|
+
textAlign?: textAlignType
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
|
|
30
|
+
*/
|
|
31
|
+
textBaseline?: textBaselineType
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 设置线条虚线,默认为[]表示使用实线绘制
|
|
35
|
+
*
|
|
36
|
+
* 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
|
|
37
|
+
*/
|
|
38
|
+
lineDash?: Array<number>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 文字大小,默认16
|
|
42
|
+
*/
|
|
43
|
+
"fontSize"?: number
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 已废弃,向下兼容,请用 fontSize 代替
|
|
47
|
+
*/
|
|
48
|
+
"font-size"?: number // 向下兼容
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 字体,默认"sans-serif"
|
|
52
|
+
*/
|
|
53
|
+
"fontFamily"?: string
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 已废弃,向下兼容,请用 fontFamily 代替
|
|
57
|
+
*/
|
|
58
|
+
"font-family"?: string // 向下兼容
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
62
|
+
*/
|
|
63
|
+
"arcStartCap"?: arcCapType
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 已废弃,向下兼容,请用 arcStartCap 代替
|
|
67
|
+
*/
|
|
68
|
+
"arc-start-cap"?: string // 向下兼容
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
|
|
72
|
+
*/
|
|
73
|
+
"arcEndCap"?: arcCapType
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 已废弃,向下兼容,请用 arcEndCap 代替
|
|
77
|
+
*/
|
|
78
|
+
"arc-end-cap"?: string // 向下兼容
|
|
79
|
+
|
|
77
80
|
}
|
package/types/TreeConfig.d.ts
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
export interface rootType {
|
|
2
|
+
(initTree: any): any
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface childrenType {
|
|
6
|
+
(parentTree: any, initTree: any): any[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface idType {
|
|
10
|
+
(treedata: any): string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default interface TreeConfigType {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取根结点的方法
|
|
17
|
+
* @param initTree 原始数据
|
|
18
|
+
* @returns 返回根结点
|
|
19
|
+
*/
|
|
20
|
+
root?: rootType
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 获取子结点的方法
|
|
24
|
+
* @param parentTree 父结点
|
|
25
|
+
* @param initTree 原始数据
|
|
26
|
+
* @returns 返回当前父结点的所有子结点数组
|
|
27
|
+
*/
|
|
28
|
+
children?: childrenType
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 获取结点ID方法
|
|
32
|
+
* @param treedata 当前结点
|
|
33
|
+
* @returns 返回可以唯一标识当前结点的id
|
|
34
|
+
*/
|
|
35
|
+
id?: idType
|
|
36
|
+
|
|
25
37
|
}
|