vislite 0.4.1-beta.1 → 0.4.1

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.
Files changed (61) hide show
  1. package/CHANGELOG +4 -1
  2. package/lib/Buffer/index.umd.js +2 -2
  3. package/lib/Buffer/index.umd.min.js +2 -2
  4. package/lib/Canvas/index.umd.js +2 -2
  5. package/lib/Canvas/index.umd.min.js +2 -2
  6. package/lib/Cardinal/index.umd.js +2 -2
  7. package/lib/Cardinal/index.umd.min.js +2 -2
  8. package/lib/Eoap/index.umd.js +2 -2
  9. package/lib/Eoap/index.umd.min.js +2 -2
  10. package/lib/Hermite/index.umd.js +2 -2
  11. package/lib/Hermite/index.umd.min.js +2 -2
  12. package/lib/Matrix4/index.umd.js +2 -2
  13. package/lib/Matrix4/index.umd.min.js +2 -2
  14. package/lib/Mercator/index.umd.js +2 -2
  15. package/lib/Mercator/index.umd.min.js +2 -2
  16. package/lib/OralCanvas/index.es.js +2 -2
  17. package/lib/OralCanvas/index.es.min.js +2 -2
  18. package/lib/OralWebGL/index.es.js +2 -2
  19. package/lib/OralWebGL/index.es.min.js +2 -2
  20. package/lib/SVG/index.umd.js +6 -6
  21. package/lib/SVG/index.umd.min.js +3 -3
  22. package/lib/Shader/index.umd.js +2 -2
  23. package/lib/Shader/index.umd.min.js +2 -2
  24. package/lib/Texture/index.umd.js +2 -2
  25. package/lib/Texture/index.umd.min.js +2 -2
  26. package/lib/TreeLayout/index.umd.js +2 -2
  27. package/lib/TreeLayout/index.umd.min.js +2 -2
  28. package/lib/WebGL/index.umd.js +2 -2
  29. package/lib/WebGL/index.umd.min.js +2 -2
  30. package/lib/animation/index.umd.js +2 -2
  31. package/lib/animation/index.umd.min.js +2 -2
  32. package/lib/formatColor/index.umd.js +2 -2
  33. package/lib/formatColor/index.umd.min.js +2 -2
  34. package/lib/getLoopColors/index.umd.js +2 -2
  35. package/lib/getLoopColors/index.umd.min.js +2 -2
  36. package/lib/getWebGLContext/index.umd.js +2 -2
  37. package/lib/getWebGLContext/index.umd.min.js +2 -2
  38. package/lib/index.umd.js +6 -6
  39. package/lib/index.umd.min.js +3 -3
  40. package/lib/resizeObserver/index.umd.js +2 -2
  41. package/lib/resizeObserver/index.umd.min.js +2 -2
  42. package/lib/rotate/index.umd.js +2 -2
  43. package/lib/rotate/index.umd.min.js +2 -2
  44. package/lib/ruler/index.umd.js +2 -2
  45. package/lib/ruler/index.umd.min.js +2 -2
  46. package/lib/throttle/index.umd.js +2 -2
  47. package/lib/throttle/index.umd.min.js +2 -2
  48. package/lib/viewHandler/index.umd.js +2 -2
  49. package/lib/viewHandler/index.umd.min.js +2 -2
  50. package/package.json +1 -2
  51. package/src/common/canvas/painter.ts +4 -2
  52. package/src/common/svg/index.ts +316 -315
  53. package/src/throttle.ts +1 -1
  54. package/types/CanvasConfig.d.ts +6 -4
  55. package/types/Object3D.d.ts +4 -3
  56. package/types/SVGConfig.d.ts +6 -4
  57. package/types/Tree.d.ts +32 -0
  58. package/types/TreeOption.d.ts +5 -2
  59. package/types/painterConfig.d.ts +3 -0
  60. package/types/ruler.d.ts +1 -1
  61. package/types/throttleOption.d.ts +4 -2
@@ -1,4 +1,5 @@
1
1
  import type SVGConfigType from "../../../types/SVGConfig"
2
+ import type { arcCapType, textAlignType, textBaselineType } from "../../../types/painterConfig"
2
3
 
3
4
  import { initText, initCircle, initPath, initRect, initArc } from "./config"
4
5
  import { toNode, setAttribute, getAttribute, full, fill, stroke } from "./tool"
@@ -6,330 +7,330 @@ import rotate from "../../rotate"
6
7
 
7
8
  // 属性名向下兼容
8
9
  let oldAttrName = {
9
- "font-size": "fontSize",
10
- "font-family": "fontFamily",
11
- "arc-start-cap": "arcStartCap",
12
- "arc-end-cap": "arcEndCap",
10
+ "font-size": "fontSize",
11
+ "font-family": "fontFamily",
12
+ "arc-start-cap": "arcStartCap",
13
+ "arc-end-cap": "arcEndCap",
13
14
  }
14
15
 
15
16
  class SVG {
16
- readonly name: string = "SVG"
17
-
18
- // 用于记录配置
19
- private __config = {
20
- // 基本设置
21
- fillStyle: "#000",
22
- strokeStyle: "#000",
23
- lineWidth: 1,
24
-
25
- // 文字对齐方式
26
- textAlign: "left",
27
- textBaseline: "middle",
28
-
29
- // 文字设置
30
- "font-size": 16,
31
- "font-family": "sans-serif",
32
-
33
- // arc二端闭合方式['butt':直线闭合,'round':圆帽闭合]
34
- "arc-start-cap": "butt",
35
- "arc-end-cap": "butt",
36
-
37
- // 虚线设置
38
- lineDash: [],
39
- }
40
-
41
- // 作用的节点
42
- private __useEl: SVGElement
43
-
44
- // 路径(和canvas2D的类似)
45
- private __path: string = ""
46
- private __currentPosition: number[] = []
47
-
48
- private __svg: SVGElement
49
- constructor(svg: SVGElement) {
50
- this.__svg = svg
51
- }
52
-
53
- // 属性设置或获取
54
- config(params: SVGConfigType) {
55
- if (typeof params !== "object") {
56
- return this.__config[oldAttrName[params] || params]
57
- } else {
58
- for (let key in params) {
59
- let _key = oldAttrName[key] || key
60
- this.__config[_key] = params[key]
61
- }
17
+ readonly name: string = "SVG"
18
+
19
+ // 用于记录配置
20
+ private __config = {
21
+ // 基本设置
22
+ fillStyle: "#000",
23
+ strokeStyle: "#000",
24
+ lineWidth: 1,
25
+
26
+ // 文字对齐方式
27
+ textAlign: <textAlignType>"left",
28
+ textBaseline: <textBaselineType>"middle",
29
+
30
+ // 文字设置
31
+ "fontSize": 50,
32
+ "fontFamily": "sans-serif",
33
+
34
+ // arc二端闭合方式['butt':直线闭合,'round':圆帽闭合]
35
+ "arcStartCap": <arcCapType>"butt",
36
+ "arcEndCap": <arcCapType>"butt",
37
+
38
+ // 虚线设置
39
+ lineDash: [],
40
+ }
41
+
42
+ // 作用的节点
43
+ private __useEl: SVGElement
44
+
45
+ // 路径(和canvas2D的类似)
46
+ private __path: string = ""
47
+ private __currentPosition: number[] = []
48
+
49
+ private __svg: SVGElement
50
+ constructor(svg: SVGElement) {
51
+ this.__svg = svg
52
+ }
53
+
54
+ // 属性设置或获取
55
+ config(params: SVGConfigType) {
56
+ if (typeof params !== "object") {
57
+ return this.__config[oldAttrName[params] || params]
58
+ } else {
59
+ for (let key in params) {
60
+ let _key = oldAttrName[key] || key
61
+ this.__config[_key] = params[key]
62
+ }
63
+ }
64
+ return this
65
+ }
66
+
67
+ /**
68
+ * 基础方法
69
+ * ---------------------------------
70
+ */
71
+
72
+ // 标记应用节点
73
+ // 也就是后续操作都会作用在此节点
74
+ useEl(el: SVGElement) {
75
+ this.__useEl = el
76
+ return this
77
+ }
78
+
79
+ // 获取当前应用的节点
80
+ getEl() {
81
+ return this.__useEl
82
+ }
83
+
84
+ // 追加节点
85
+ // el可以是结点或字符串,字符串的话表示节点名称
86
+ // context可选,表示追加位置,可选,默认根svg
87
+ // 此外,和appendBoard等操作一样,执行后新加入的结点会自动变成应用节点
88
+ appendEl(el: string | SVGElement, context?: SVGElement) {
89
+ context = context || this.__svg
90
+
91
+ if (typeof el == "string") el = toNode(el)
92
+ context.appendChild(el as SVGElement)
93
+
94
+ this.__useEl = el as SVGElement
95
+ return this
96
+ }
97
+
98
+ // 追加绘制板
99
+ // 参数和appendEl类似,只是el如果是字符串的话,表示需要绘制对应什么内容,
100
+ // 比如el = “arc”,表示画弧(不是路径arc),那么我们会创建path节点,因为我们是使用path实现的
101
+ appendBoard(el: string | SVGElement, context?: SVGElement) {
102
+ let _el = el
103
+
104
+ if (typeof el == "string")
105
+ _el =
106
+ {
107
+ text: "text",
108
+ path: "path",
109
+ arc: "path",
110
+ circle: "circle",
111
+ rect: "rect",
112
+ }[el] || ""
113
+
114
+ if (_el == "") throw new Error("Unsupported drawing method:" + el)
115
+ return this.appendEl(_el, context)
116
+ }
117
+
118
+ // 删除当前维护的节点
119
+ remove() {
120
+ if (!this.__useEl) {
121
+ throw new Error("Currently, no node can be deleted.")
122
+ } else {
123
+ ((this.__useEl as SVGElement).parentNode as SVGElement).removeChild(
124
+ this.__useEl
125
+ )
126
+ }
127
+ return this
128
+ }
129
+
130
+ // 设置或获取节点属性
131
+ attr(params: any) {
132
+ if (!this.__useEl)
133
+ throw new Error("Currently, no node can be modified or viewed.")
134
+
135
+ if (typeof params !== "object") {
136
+ return getAttribute(this.__useEl, params)
137
+ } else {
138
+ for (let key in params) {
139
+ setAttribute(this.__useEl, key, params[key])
140
+ }
141
+ return this
142
+ }
143
+ }
144
+
145
+ /**
146
+ * 绘制方法
147
+ * ---------------------------------
148
+ */
149
+
150
+ // 文字
151
+ // deg表示文字旋转角度,是角度值,不是弧度
152
+ fillText(text: string, x: number, y: number, deg: number = 0) {
153
+ initText(this.__useEl, this.__config, x, y, deg)
154
+ this.__useEl.textContent = text
155
+ fill(this.__useEl, this.__config)
156
+ return this
62
157
  }
63
- return this
64
- }
65
-
66
- /**
67
- * 基础方法
68
- * ---------------------------------
69
- */
70
-
71
- // 标记应用节点
72
- // 也就是后续操作都会作用在此节点
73
- useEl(el: SVGElement) {
74
- this.__useEl = el
75
- return this
76
- }
77
-
78
- // 获取当前应用的节点
79
- getEl() {
80
- return this.__useEl
81
- }
82
-
83
- // 追加节点
84
- // el可以是结点或字符串,字符串的话表示节点名称
85
- // context可选,表示追加位置,可选,默认根svg
86
- // 此外,和appendBoard等操作一样,执行后新加入的结点会自动变成应用节点
87
- appendEl(el: string | SVGElement, context?: SVGElement) {
88
- context = context || this.__svg
89
-
90
- if (typeof el == "string") el = toNode(el)
91
- context.appendChild(el as SVGElement)
92
-
93
- this.__useEl = el as SVGElement
94
- return this
95
- }
96
-
97
- // 追加绘制板
98
- // 参数和appendEl类似,只是el如果是字符串的话,表示需要绘制对应什么内容,
99
- // 比如el = “arc”,表示画弧(不是路径arc),那么我们会创建path节点,因为我们是使用path实现的
100
- appendBoard(el: string | SVGElement, context?: SVGElement) {
101
- let _el = el
102
-
103
- if (typeof el == "string")
104
- _el =
105
- {
106
- text: "text",
107
- path: "path",
108
- arc: "path",
109
- circle: "circle",
110
- rect: "rect",
111
- }[el] || ""
112
-
113
- if (_el == "") throw new Error("Unsupported drawing method:" + el)
114
- return this.appendEl(_el, context)
115
- }
116
-
117
- // 删除当前维护的节点
118
- remove() {
119
- if (!this.__useEl) {
120
- throw new Error("Currently, no node can be deleted.")
121
- } else {
122
- ((this.__useEl as SVGElement).parentNode as SVGElement).removeChild(
123
- this.__useEl
124
- )
158
+ strokeText(text: string, x: number, y: number, deg: number = 0) {
159
+ initText(this.__useEl, this.__config, x, y, deg)
160
+ this.__useEl.textContent = text
161
+ stroke(this.__useEl, this.__config)
162
+ return this
125
163
  }
126
- return this
127
- }
128
-
129
- // 设置或获取节点属性
130
- attr(params: any) {
131
- if (!this.__useEl)
132
- throw new Error("Currently, no node can be modified or viewed.")
133
-
134
- if (typeof params !== "object") {
135
- return getAttribute(this.__useEl, params)
136
- } else {
137
- for (let key in params) {
138
- setAttribute(this.__useEl, key, params[key])
139
- }
140
- return this
164
+ fullText(text: string, x: number, y: number, deg: number = 0) {
165
+ initText(this.__useEl, this.__config, x, y, deg)
166
+ this.__useEl.textContent = text
167
+ full(this.__useEl, this.__config)
168
+ return this
141
169
  }
142
- }
143
-
144
- /**
145
- * 绘制方法
146
- * ---------------------------------
147
- */
148
-
149
- // 文字
150
- // deg表示文字旋转角度,是角度值,不是弧度
151
- fillText(text: string, x: number, y: number, deg: number = 0) {
152
- initText(this.__useEl, this.__config, x, y, deg)
153
- this.__useEl.textContent = text
154
- fill(this.__useEl, this.__config)
155
- return this
156
- }
157
- strokeText(text: string, x: number, y: number, deg: number = 0) {
158
- initText(this.__useEl, this.__config, x, y, deg)
159
- this.__useEl.textContent = text
160
- stroke(this.__useEl, this.__config)
161
- return this
162
- }
163
- fullText(text: string, x: number, y: number, deg: number = 0) {
164
- initText(this.__useEl, this.__config, x, y, deg)
165
- this.__useEl.textContent = text
166
- full(this.__useEl, this.__config)
167
- return this
168
- }
169
-
170
- // 弧
171
- fillArc(
172
- cx: number,
173
- cy: number,
174
- r1: number,
175
- r2: number,
176
- beginDeg: number,
177
- deg: number
178
- ) {
179
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
180
- fill(this.__useEl, this.__config)
181
- return this
182
- }
183
- strokeArc(
184
- cx: number,
185
- cy: number,
186
- r1: number,
187
- r2: number,
188
- beginDeg: number,
189
- deg: number
190
- ) {
191
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
192
- stroke(this.__useEl, this.__config)
193
- return this
194
- }
195
- fullArc(
196
- cx: number,
197
- cy: number,
198
- r1: number,
199
- r2: number,
200
- beginDeg: number,
201
- deg: number
202
- ) {
203
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
204
- full(this.__useEl, this.__config)
205
- return this
206
- }
207
-
208
- // 圆形
209
- fillCircle(cx: number, cy: number, r: number) {
210
- initCircle(this.__useEl, cx, cy, r)
211
- fill(this.__useEl, this.__config)
212
- return this
213
- }
214
- strokeCircle(cx: number, cy: number, r: number) {
215
- initCircle(this.__useEl, cx, cy, r)
216
- stroke(this.__useEl, this.__config)
217
- return this
218
- }
219
- fullCircle(cx: number, cy: number, r: number) {
220
- initCircle(this.__useEl, cx, cy, r)
221
- full(this.__useEl, this.__config)
222
- return this
223
- }
224
-
225
- // 矩形
226
- fillRect(x: number, y: number, width: number, height: number) {
227
- initRect(this.__useEl, x, y, width, height)
228
- fill(this.__useEl, this.__config)
229
- return this
230
- }
231
- strokeRect(x: number, y: number, width: number, height: number) {
232
- initRect(this.__useEl, x, y, width, height)
233
- stroke(this.__useEl, this.__config)
234
- return this
235
- }
236
- fullRect(x: number, y: number, width: number, height: number) {
237
- initRect(this.__useEl, x, y, width, height)
238
- full(this.__useEl, this.__config)
239
- return this
240
- }
241
-
242
- // 路径
243
- beginPath() {
244
- this.__currentPosition = []
245
- this.__path = ""
246
- return this
247
- }
248
- closePath() {
249
- this.__path += "Z"
250
- return this
251
- }
252
- moveTo(x: number, y: number) {
253
- this.__currentPosition = [x, y]
254
-
255
- this.__path += "M" + x + " " + y
256
- return this
257
- }
258
- lineTo(x: number, y: number) {
259
- this.__currentPosition = [x, y]
260
-
261
- this.__path += (this.__path == "" ? "M" : "L") + x + " " + y
262
- return this
263
- }
264
- fill() {
265
- initPath(this.__useEl, this.__path)
266
- fill(this.__useEl, this.__config)
267
- return this
268
- }
269
- stroke() {
270
- initPath(this.__useEl, this.__path)
271
- stroke(this.__useEl, this.__config)
272
- return this
273
- }
274
- full() {
275
- initPath(this.__useEl, this.__path);
276
- full(this.__useEl, this.__config)
277
- return this
278
- }
279
-
280
- arc(x: number, y: number, r: number, beginDeg: number, deg: number) {
281
- let begPosition = rotate(x, y, (beginDeg / 180) * Math.PI, x + r, y)
282
- let endPosition = rotate(
283
- x,
284
- y,
285
- ((beginDeg + deg) / 180) * Math.PI,
286
- x + r,
287
- y
288
- )
289
- // 如果当前没有路径,说明是开始的,就移动到正确位置
290
- if (this.__path == "") {
291
- this.__path += "M" + begPosition[0] + "," + begPosition[1]
170
+
171
+ // 弧
172
+ fillArc(
173
+ cx: number,
174
+ cy: number,
175
+ r1: number,
176
+ r2: number,
177
+ beginDeg: number,
178
+ deg: number
179
+ ) {
180
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
181
+ fill(this.__useEl, this.__config)
182
+ return this
183
+ }
184
+ strokeArc(
185
+ cx: number,
186
+ cy: number,
187
+ r1: number,
188
+ r2: number,
189
+ beginDeg: number,
190
+ deg: number
191
+ ) {
192
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
193
+ stroke(this.__useEl, this.__config)
194
+ return this
195
+ }
196
+ fullArc(
197
+ cx: number,
198
+ cy: number,
199
+ r1: number,
200
+ r2: number,
201
+ beginDeg: number,
202
+ deg: number
203
+ ) {
204
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg)
205
+ full(this.__useEl, this.__config)
206
+ return this
207
+ }
208
+
209
+ // 圆形
210
+ fillCircle(cx: number, cy: number, r: number) {
211
+ initCircle(this.__useEl, cx, cy, r)
212
+ fill(this.__useEl, this.__config)
213
+ return this
214
+ }
215
+ strokeCircle(cx: number, cy: number, r: number) {
216
+ initCircle(this.__useEl, cx, cy, r)
217
+ stroke(this.__useEl, this.__config)
218
+ return this
219
+ }
220
+ fullCircle(cx: number, cy: number, r: number) {
221
+ initCircle(this.__useEl, cx, cy, r)
222
+ full(this.__useEl, this.__config)
223
+ return this
224
+ }
225
+
226
+ // 矩形
227
+ fillRect(x: number, y: number, width: number, height: number) {
228
+ initRect(this.__useEl, x, y, width, height)
229
+ fill(this.__useEl, this.__config)
230
+ return this
231
+ }
232
+ strokeRect(x: number, y: number, width: number, height: number) {
233
+ initRect(this.__useEl, x, y, width, height)
234
+ stroke(this.__useEl, this.__config)
235
+ return this
236
+ }
237
+ fullRect(x: number, y: number, width: number, height: number) {
238
+ initRect(this.__useEl, x, y, width, height)
239
+ full(this.__useEl, this.__config)
240
+ return this
241
+ }
242
+
243
+ // 路径
244
+ beginPath() {
245
+ this.__currentPosition = []
246
+ this.__path = ""
247
+ return this
248
+ }
249
+ closePath() {
250
+ this.__path += "Z"
251
+ return this
252
+ }
253
+ moveTo(x: number, y: number) {
254
+ this.__currentPosition = [x, y]
255
+
256
+ this.__path += "M" + x + " " + y
257
+ return this
258
+ }
259
+ lineTo(x: number, y: number) {
260
+ this.__currentPosition = [x, y]
261
+
262
+ this.__path += (this.__path == "" ? "M" : "L") + x + " " + y
263
+ return this
264
+ }
265
+ fill() {
266
+ initPath(this.__useEl, this.__path)
267
+ fill(this.__useEl, this.__config)
268
+ return this
269
+ }
270
+ stroke() {
271
+ initPath(this.__useEl, this.__path)
272
+ stroke(this.__useEl, this.__config)
273
+ return this
274
+ }
275
+ full() {
276
+ initPath(this.__useEl, this.__path);
277
+ full(this.__useEl, this.__config)
278
+ return this
279
+ }
280
+
281
+ arc(x: number, y: number, r: number, beginDeg: number, deg: number) {
282
+ let begPosition = rotate(x, y, (beginDeg / 180) * Math.PI, x + r, y)
283
+ let endPosition = rotate(
284
+ x,
285
+ y,
286
+ ((beginDeg + deg) / 180) * Math.PI,
287
+ x + r,
288
+ y
289
+ )
290
+ // 如果当前没有路径,说明是开始的,就移动到正确位置
291
+ if (this.__path == "") {
292
+ this.__path += "M" + begPosition[0] + "," + begPosition[1]
293
+ }
294
+ // 如果当前有路径,位置不正确,应该画到正确位置(和canvas保持一致)
295
+ else if (
296
+ begPosition[0] != this.__currentPosition[0] ||
297
+ begPosition[1] != this.__currentPosition[1]
298
+ ) {
299
+ this.__path += "L" + begPosition[0] + "," + begPosition[1]
300
+ }
301
+ this.__path +=
302
+ "A" +
303
+ r +
304
+ "," +
305
+ r +
306
+ " 0 " +
307
+ (deg > 180 || deg < -180 ? 1 : 0) +
308
+ "," +
309
+ (deg > 0 ? 1 : 0) +
310
+ " " +
311
+ endPosition[0] +
312
+ "," +
313
+ endPosition[1]
314
+ return this
315
+ }
316
+
317
+ // 路径 - 贝塞尔曲线
318
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number) {
319
+ this.__path += "Q" + cpx + " " + cpy + "," + x + " " + y
320
+ return this
292
321
  }
293
- // 如果当前有路径,位置不正确,应该画到正确位置(和canvas保持一致)
294
- else if (
295
- begPosition[0] != this.__currentPosition[0] ||
296
- begPosition[1] != this.__currentPosition[1]
322
+ bezierCurveTo(
323
+ cp1x: number,
324
+ cp1y: number,
325
+ cp2x: number,
326
+ cp2y: number,
327
+ x: number,
328
+ y: number
297
329
  ) {
298
- this.__path += "L" + begPosition[0] + "," + begPosition[1]
330
+ this.__path +=
331
+ "C" + cp1x + " " + cp1y + "," + cp2x + " " + cp2y + "," + x + " " + y
332
+ return this
299
333
  }
300
- this.__path +=
301
- "A" +
302
- r +
303
- "," +
304
- r +
305
- " 0 " +
306
- (deg > 180 || deg < -180 ? 1 : 0) +
307
- "," +
308
- (deg > 0 ? 1 : 0) +
309
- " " +
310
- endPosition[0] +
311
- "," +
312
- endPosition[1]
313
- return this
314
- }
315
-
316
- // 路径 - 贝塞尔曲线
317
- quadraticCurveTo(cpx: number, cpy: number, x: number, y: number) {
318
- this.__path += "Q" + cpx + " " + cpy + "," + x + " " + y
319
- return this
320
- }
321
- bezierCurveTo(
322
- cp1x: number,
323
- cp1y: number,
324
- cp2x: number,
325
- cp2y: number,
326
- x: number,
327
- y: number
328
- ) {
329
- this.__path +=
330
- "C" + cp1x + " " + cp1y + "," + cp2x + " " + cp2y + "," + x + " " + y
331
- return this
332
- }
333
334
  }
334
335
 
335
336
  export default SVG
package/src/throttle.ts CHANGED
@@ -5,7 +5,7 @@ import mergeOption from './common/mergeOption'
5
5
  export default function (callback: Function, option: throttleOptionType = {}) {
6
6
 
7
7
  // 校对缺省值
8
- option = mergeOption(option, {
8
+ option = mergeOption(option, <throttleOptionType>{
9
9
  time: 200,
10
10
  keep: false,
11
11
  opportunity: "end"