vislite 0.8.0 → 1.0.0-next.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/AUTHORS.txt +6 -6
- package/CHANGELOG +17 -2
- package/LICENSE +20 -20
- package/README.md +2 -36
- package/lib/Buffer/index.umd.js +2 -2
- package/lib/Buffer/index.umd.min.js +2 -2
- package/lib/Canvas/index.umd.js +9 -24
- 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/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/SVG/index.umd.js +19 -35
- package/lib/SVG/index.umd.min.js +3 -3
- package/lib/Shader/index.umd.js +3 -82
- 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 +2 -2
- package/lib/TreeLayout/index.umd.min.js +2 -2
- package/lib/animation/index.umd.js +2 -2
- package/lib/animation/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 +2 -2
- package/lib/getWebGLContext/index.umd.min.js +2 -2
- package/lib/index.umd.js +104 -944
- 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 +2 -2
- package/lib/ruler/index.umd.min.js +2 -2
- 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/miniprogram/ui-canvas/index.js +100 -107
- package/miniprogram/ui-canvas/index.json +4 -4
- package/miniprogram/ui-canvas/index.wxml +4 -4
- package/miniprogram/ui-canvas/index.wxss +5 -5
- package/package/Buffer/index.ts +2 -2
- package/package/Canvas/index.ts +2 -2
- package/package/Cardinal/index.ts +2 -2
- package/package/Eoap/index.ts +2 -2
- package/package/Hermite/index.ts +2 -2
- package/package/Matrix4/index.ts +2 -2
- package/package/Mercator/index.ts +2 -2
- package/package/SVG/index.ts +2 -2
- package/package/Shader/index.ts +2 -39
- package/package/Texture/index.ts +2 -2
- package/package/TreeLayout/index.ts +2 -2
- package/package/animation/index.ts +2 -2
- package/package/getLoopColors/index.ts +2 -2
- package/package/index.ts +67 -76
- package/package/move/index.ts +2 -2
- package/package/resizeObserver/index.ts +2 -2
- package/package/rotate/index.ts +2 -2
- package/package/ruler/index.ts +2 -2
- package/package/scale/index.ts +2 -2
- package/package/throttle/index.ts +2 -2
- package/package.json +1 -1
- package/src/Eoap.ts +66 -66
- package/src/Matrix4/index.ts +84 -84
- package/src/Matrix4/move.ts +12 -12
- package/src/Matrix4/rotate.ts +15 -15
- package/src/Matrix4/scale.ts +11 -11
- package/src/Matrix4/transform.ts +64 -64
- package/src/Mercator.ts +27 -27
- package/src/SVG.ts +24 -24
- package/src/animation.ts +98 -98
- package/src/common/assemble.ts +22 -22
- package/src/common/canvas/arc.ts +51 -51
- package/src/common/canvas/config.ts +158 -158
- package/src/common/canvas/gradient.ts +24 -29
- package/src/common/canvas/index.ts +1 -12
- package/src/common/canvas/texts.ts +18 -18
- package/src/common/mergeOption.ts +6 -6
- package/src/common/setStyle.ts +5 -5
- package/src/common/svg/config.ts +190 -190
- package/src/common/svg/gradient.ts +53 -63
- package/src/common/svg/index.ts +347 -356
- package/src/common/svg/tool.ts +44 -44
- package/src/common/tree/index.ts +25 -25
- package/src/common/tree/toInnerTree.ts +59 -59
- package/src/common/tree/toPlainTree.ts +132 -132
- package/src/common/webgl/buffer.ts +79 -79
- package/src/common/webgl/getWebGLContext.ts +1 -1
- package/src/common/webgl/shader.ts +75 -75
- package/src/common/webgl/texture.ts +97 -97
- 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 +188 -188
- package/src/move.ts +7 -7
- package/src/resizeObserver.ts +37 -37
- package/src/rotate.ts +7 -7
- package/src/ruler.ts +209 -209
- package/src/scale.ts +6 -6
- package/src/throttle.ts +52 -52
- package/types/Buffer.d.ts +23 -23
- package/types/CanvasConfig.d.ts +106 -106
- package/types/CanvasOption.d.ts +8 -8
- package/types/CanvasOpts.d.ts +9 -9
- package/types/Cardinal.d.ts +13 -13
- package/types/Gradient.d.ts +14 -14
- package/types/Hermite.d.ts +18 -18
- package/types/Map.d.ts +9 -9
- package/types/Matrix4.d.ts +47 -47
- package/types/SVG.d.ts +238 -238
- package/types/SVGConfig.d.ts +79 -79
- package/types/Shader.d.ts +16 -23
- package/types/Texture.d.ts +16 -16
- package/types/Tree.d.ts +69 -69
- package/types/TreeConfig.d.ts +36 -36
- package/types/TreeLayout.d.ts +54 -54
- package/types/TreeOption.d.ts +48 -48
- package/types/animation.d.ts +9 -6
- package/types/getLoopColors.d.ts +5 -2
- package/types/getWebGLContext.d.ts +3 -0
- package/types/index.d.ts +149 -176
- package/types/move.d.ts +5 -2
- package/types/painterConfig.d.ts +2 -2
- package/types/resizeObserver.d.ts +5 -2
- package/types/rotate.d.ts +5 -2
- package/types/ruler.d.ts +10 -7
- package/types/scale.d.ts +5 -2
- package/types/throttle.d.ts +7 -4
- package/types/throttleOption.d.ts +21 -21
- package/uni-app/ui-canvas.vue +4 -11
- package/lib/Geometry/index.umd.d.ts +0 -3
- package/lib/Geometry/index.umd.js +0 -353
- package/lib/Geometry/index.umd.min.d.ts +0 -3
- package/lib/Geometry/index.umd.min.js +0 -11
- package/lib/OralCanvas/index.es.d.ts +0 -3
- package/lib/OralCanvas/index.es.js +0 -693
- package/lib/OralCanvas/index.es.min.d.ts +0 -3
- package/lib/OralCanvas/index.es.min.js +0 -11
- package/lib/OralWebGL/index.es.d.ts +0 -3
- package/lib/OralWebGL/index.es.js +0 -639
- package/lib/OralWebGL/index.es.min.d.ts +0 -3
- package/lib/OralWebGL/index.es.min.js +0 -11
- package/lib/WebGL/index.umd.d.ts +0 -3
- package/lib/WebGL/index.umd.js +0 -712
- package/lib/WebGL/index.umd.min.d.ts +0 -3
- package/lib/WebGL/index.umd.min.js +0 -11
- package/lib/formatColor/index.umd.d.ts +0 -3
- package/lib/formatColor/index.umd.js +0 -59
- package/lib/formatColor/index.umd.min.d.ts +0 -3
- package/lib/formatColor/index.umd.min.js +0 -11
- package/lib/viewHandler/index.umd.d.ts +0 -3
- package/lib/viewHandler/index.umd.js +0 -139
- package/lib/viewHandler/index.umd.min.d.ts +0 -3
- package/lib/viewHandler/index.umd.min.js +0 -11
- package/package/Geometry/index.ts +0 -3
- package/package/OralCanvas/index.ts +0 -3
- package/package/OralWebGL/index.ts +0 -3
- package/package/WebGL/index.ts +0 -3
- package/package/formatColor/index.ts +0 -3
- package/package/viewHandler/index.ts +0 -3
- package/src/Geometry.ts +0 -211
- package/src/WebGL.ts +0 -67
- package/src/common/geometry/prism-horizontal.ts +0 -50
- package/src/common/geometry/prism-vertical.ts +0 -55
- package/src/common/geometry/sphere-fragment.ts +0 -40
- package/src/common/geometry/tool/circle.ts +0 -18
- package/src/common/geometry/tool/rotateLine.ts +0 -49
- package/src/common/geometry/tool/triangles.ts +0 -24
- package/src/common/webgl/doDraw.ts +0 -109
- package/src/common/webgl/getColorFactory.ts +0 -27
- package/src/common/webgl/getShader.ts +0 -49
- package/src/common/webgl/getTexture.ts +0 -12
- package/src/common/webgl/index.ts +0 -228
- package/src/shader/fsColor.c +0 -8
- package/src/shader/fsColors.c +0 -8
- package/src/shader/fsCube.c +0 -9
- package/src/shader/fsImage.c +0 -9
- package/src/shader/vsColor.c +0 -18
- package/src/shader/vsColors.c +0 -14
- package/src/shader/vsCube.c +0 -14
- package/src/shader/vsImage.c +0 -14
- package/src/viewHandler.ts +0 -161
- package/types/Geometry.d.ts +0 -133
- package/types/GeometryOption.d.ts +0 -12
- package/types/GeometryResult.d.ts +0 -19
- package/types/Object3D.d.ts +0 -115
- package/types/Scene3D.d.ts +0 -7
- package/types/WebGL.d.ts +0 -39
- package/types/WebGLOption.d.ts +0 -15
- package/types/formatColor.d.ts +0 -3
- package/types/viewHandler.d.ts +0 -14
package/types/index.d.ts
CHANGED
|
@@ -1,176 +1,149 @@
|
|
|
1
|
-
import CardinalType from './Cardinal'
|
|
2
|
-
import HermiteType from './Hermite'
|
|
3
|
-
|
|
4
|
-
import Matrix4Type from './Matrix4'
|
|
5
|
-
import rotateType from './rotate'
|
|
6
|
-
import moveType from './move'
|
|
7
|
-
import scaleType from './scale'
|
|
8
|
-
|
|
9
|
-
import getLoopColorsType from './getLoopColors'
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
import
|
|
29
|
-
import
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
//
|
|
94
|
-
static
|
|
95
|
-
static
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
static
|
|
99
|
-
static
|
|
100
|
-
static
|
|
101
|
-
static
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
static
|
|
105
|
-
static
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
static
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
export let
|
|
138
|
-
export let
|
|
139
|
-
|
|
140
|
-
//
|
|
141
|
-
export let
|
|
142
|
-
export let
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
export let
|
|
150
|
-
export let ruler: rulerType
|
|
151
|
-
|
|
152
|
-
// 画笔
|
|
153
|
-
export let SVG: NewSVGType
|
|
154
|
-
export let Canvas: NewCanvasType
|
|
155
|
-
export let WebGL: NewWebGLType
|
|
156
|
-
|
|
157
|
-
// WebGL
|
|
158
|
-
export let getWebGLContext: getWebGLContextType
|
|
159
|
-
export let Shader: NewShaderType
|
|
160
|
-
export let Buffer: NewBufferType
|
|
161
|
-
export let Texture: NewTextureType
|
|
162
|
-
|
|
163
|
-
// 投影
|
|
164
|
-
export let Eoap: NewEoapType
|
|
165
|
-
export let Mercator: NewMercatorType
|
|
166
|
-
|
|
167
|
-
// 辅助
|
|
168
|
-
export let viewHandler: viewHandlerType
|
|
169
|
-
export let throttle: throttleType
|
|
170
|
-
export let resizeObserver: resizeObserverType
|
|
171
|
-
|
|
172
|
-
// 布局
|
|
173
|
-
export let TreeLayout: NewTreeLayoutType
|
|
174
|
-
|
|
175
|
-
// 几何&模型数据
|
|
176
|
-
export let Geometry: NewGeometryType
|
|
1
|
+
import CardinalType from './Cardinal'
|
|
2
|
+
import HermiteType from './Hermite'
|
|
3
|
+
|
|
4
|
+
import Matrix4Type from './Matrix4'
|
|
5
|
+
import rotateType from './rotate'
|
|
6
|
+
import moveType from './move'
|
|
7
|
+
import scaleType from './scale'
|
|
8
|
+
|
|
9
|
+
import getLoopColorsType from './getLoopColors'
|
|
10
|
+
import animationType from './animation'
|
|
11
|
+
import rulerType from './ruler'
|
|
12
|
+
|
|
13
|
+
import SVGType from './SVG'
|
|
14
|
+
import CanvasType from './Canvas'
|
|
15
|
+
|
|
16
|
+
import CanvasOptionType from './CanvasOption'
|
|
17
|
+
|
|
18
|
+
import getWebGLContextType from './getWebGLContext'
|
|
19
|
+
import ShaderType from './Shader'
|
|
20
|
+
import BufferType from './Buffer'
|
|
21
|
+
import TextureType from './Texture'
|
|
22
|
+
|
|
23
|
+
import MapType from './Map'
|
|
24
|
+
|
|
25
|
+
import throttleType from './throttle'
|
|
26
|
+
import resizeObserverType from './resizeObserver'
|
|
27
|
+
|
|
28
|
+
import TreeLayoutType from './TreeLayout'
|
|
29
|
+
import TreeConfigType from './TreeConfig'
|
|
30
|
+
|
|
31
|
+
// 插值
|
|
32
|
+
interface NewCardinalType extends CardinalType {
|
|
33
|
+
new(t?: number): this
|
|
34
|
+
}
|
|
35
|
+
interface NewHermiteType extends HermiteType {
|
|
36
|
+
new(u?: number): this
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 变换
|
|
40
|
+
interface NewMatrix4Type extends Matrix4Type {
|
|
41
|
+
new(initMatrix4?: number[]): this
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 画笔
|
|
45
|
+
interface NewSVGType extends SVGType {
|
|
46
|
+
new(el: HTMLElement | null): this
|
|
47
|
+
}
|
|
48
|
+
interface NewCanvasType extends CanvasType {
|
|
49
|
+
new(el: HTMLElement | null, option?: CanvasOptionType): this
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// WebGL
|
|
53
|
+
interface NewShaderType extends ShaderType {
|
|
54
|
+
new(painter: WebGLRenderingContext): this
|
|
55
|
+
}
|
|
56
|
+
interface NewBufferType extends BufferType {
|
|
57
|
+
new(painter: WebGLRenderingContext, isElement?: boolean): this
|
|
58
|
+
}
|
|
59
|
+
interface NewTextureType extends TextureType {
|
|
60
|
+
new(painter: WebGLRenderingContext, type: string, unit?: number): this
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 投影
|
|
64
|
+
interface NewEoapType extends MapType {
|
|
65
|
+
new(scale?: number, center?: number[]): this
|
|
66
|
+
}
|
|
67
|
+
interface NewMercatorType extends MapType {
|
|
68
|
+
new(scale?: number, center?: number[]): this
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 布局
|
|
72
|
+
interface NewTreeLayoutType extends TreeLayoutType {
|
|
73
|
+
new(config?: TreeConfigType): this
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default class VISLite {
|
|
77
|
+
|
|
78
|
+
// 插值
|
|
79
|
+
static Cardinal: NewCardinalType
|
|
80
|
+
static Hermite: NewHermiteType
|
|
81
|
+
|
|
82
|
+
// 变换
|
|
83
|
+
static Matrix4: NewMatrix4Type
|
|
84
|
+
static rotate: rotateType
|
|
85
|
+
static move: moveType
|
|
86
|
+
static scale: scaleType
|
|
87
|
+
|
|
88
|
+
// 工具
|
|
89
|
+
static getLoopColors: getLoopColorsType
|
|
90
|
+
static animation: animationType
|
|
91
|
+
static ruler: rulerType
|
|
92
|
+
|
|
93
|
+
// 画笔
|
|
94
|
+
static SVG: NewSVGType
|
|
95
|
+
static Canvas: NewCanvasType
|
|
96
|
+
|
|
97
|
+
// WebGL
|
|
98
|
+
static getWebGLContext: getWebGLContextType
|
|
99
|
+
static Shader: NewShaderType
|
|
100
|
+
static Buffer: NewBufferType
|
|
101
|
+
static Texture: NewTextureType
|
|
102
|
+
|
|
103
|
+
// 投影
|
|
104
|
+
static Eoap: NewEoapType
|
|
105
|
+
static Mercator: NewMercatorType
|
|
106
|
+
|
|
107
|
+
// 辅助
|
|
108
|
+
static throttle: throttleType
|
|
109
|
+
static resizeObserver: resizeObserverType
|
|
110
|
+
|
|
111
|
+
// 布局
|
|
112
|
+
static TreeLayout: NewTreeLayoutType
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 插值
|
|
116
|
+
export let Cardinal: NewCardinalType
|
|
117
|
+
export let Hermite: NewHermiteType
|
|
118
|
+
|
|
119
|
+
// 变换
|
|
120
|
+
export let Matrix4: NewMatrix4Type
|
|
121
|
+
export let rotate: rotateType
|
|
122
|
+
export let move: moveType
|
|
123
|
+
export let scale: scaleType
|
|
124
|
+
|
|
125
|
+
// 工具
|
|
126
|
+
export let getLoopColors: getLoopColorsType
|
|
127
|
+
export let animation: animationType
|
|
128
|
+
export let ruler: rulerType
|
|
129
|
+
|
|
130
|
+
// 画笔
|
|
131
|
+
export let SVG: NewSVGType
|
|
132
|
+
export let Canvas: NewCanvasType
|
|
133
|
+
|
|
134
|
+
// WebGL
|
|
135
|
+
export let getWebGLContext: getWebGLContextType
|
|
136
|
+
export let Shader: NewShaderType
|
|
137
|
+
export let Buffer: NewBufferType
|
|
138
|
+
export let Texture: NewTextureType
|
|
139
|
+
|
|
140
|
+
// 投影
|
|
141
|
+
export let Eoap: NewEoapType
|
|
142
|
+
export let Mercator: NewMercatorType
|
|
143
|
+
|
|
144
|
+
// 辅助
|
|
145
|
+
export let throttle: throttleType
|
|
146
|
+
export let resizeObserver: resizeObserverType
|
|
147
|
+
|
|
148
|
+
// 布局
|
|
149
|
+
export let TreeLayout: NewTreeLayoutType
|
package/types/move.d.ts
CHANGED
package/types/painterConfig.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type arcCapType = "butt" | "round" | "-round"
|
|
2
|
-
export type textAlignType = "left" | "center" | "right"
|
|
1
|
+
export type arcCapType = "butt" | "round" | "-round"
|
|
2
|
+
export type textAlignType = "left" | "center" | "right"
|
|
3
3
|
export type textBaselineType = "top" | "middle" | "bottom"
|
package/types/rotate.d.ts
CHANGED
package/types/ruler.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export interface rulerOptionType {
|
|
2
|
-
max?: number
|
|
3
|
-
min?: number
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export interface rulerOptionType {
|
|
2
|
+
max?: number
|
|
3
|
+
min?: number
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 刻度尺刻度运算,返回一个数组,表示刻度尺上应该显示的刻度
|
|
8
|
+
*/
|
|
9
|
+
export default interface rulerType {
|
|
10
|
+
(maxValue: number, minValue: number, num: number, option?: rulerOptionType): number[]
|
|
8
11
|
}
|
package/types/scale.d.ts
CHANGED
package/types/throttle.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import throttleOptionType from './throttleOption'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import throttleOptionType from './throttleOption'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 节流函数
|
|
5
|
+
*/
|
|
6
|
+
export default interface throttle {
|
|
7
|
+
(callback: Function, option?: throttleOptionType): Function
|
|
5
8
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export type throttleOpportunityType = "begin" | "end" | "wide"
|
|
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
|
-
|
|
1
|
+
export type throttleOpportunityType = "begin" | "end" | "wide"
|
|
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
22
|
}
|
package/uni-app/ui-canvas.vue
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
</view>
|
|
86
86
|
</template>
|
|
87
87
|
<script>
|
|
88
|
-
import
|
|
88
|
+
import { _Canvas as RawCanvas } from "../lib/index.umd.min.js";
|
|
89
89
|
import drawImage from "./drawImage.js";
|
|
90
90
|
export default {
|
|
91
91
|
data() {
|
|
@@ -111,10 +111,6 @@ export default {
|
|
|
111
111
|
type: Number,
|
|
112
112
|
default: 150,
|
|
113
113
|
},
|
|
114
|
-
touchstart: {
|
|
115
|
-
type: Function,
|
|
116
|
-
default: () => {},
|
|
117
|
-
},
|
|
118
114
|
cover: {
|
|
119
115
|
type: Boolean,
|
|
120
116
|
default: true,
|
|
@@ -152,7 +148,7 @@ export default {
|
|
|
152
148
|
// #endif
|
|
153
149
|
|
|
154
150
|
let _this = this;
|
|
155
|
-
this.help.instance = new
|
|
151
|
+
this.help.instance = new RawCanvas(
|
|
156
152
|
{
|
|
157
153
|
getContext() {
|
|
158
154
|
return painter;
|
|
@@ -244,12 +240,9 @@ export default {
|
|
|
244
240
|
resolve(this.help.instance);
|
|
245
241
|
});
|
|
246
242
|
},
|
|
247
|
-
doit(event
|
|
243
|
+
doit(event) {
|
|
248
244
|
let doRun = (x, y) => {
|
|
249
245
|
this.help.instance.getRegion(x, y).then((regionName) => {
|
|
250
|
-
// 兼容旧语法
|
|
251
|
-
if (typeof doback == "function") doback(regionName);
|
|
252
|
-
|
|
253
246
|
this.$emit("dotouchstart", {
|
|
254
247
|
name: regionName,
|
|
255
248
|
x: x,
|
|
@@ -283,7 +276,7 @@ export default {
|
|
|
283
276
|
}
|
|
284
277
|
},
|
|
285
278
|
doitstart(event) {
|
|
286
|
-
this.doit(event
|
|
279
|
+
this.doit(event);
|
|
287
280
|
},
|
|
288
281
|
},
|
|
289
282
|
};
|