vislite 1.2.0-alpha.2 → 1.2.0-alpha.4

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 (72) hide show
  1. package/CHANGELOG +266 -254
  2. package/lib/Buffer/index.es.js +1 -1
  3. package/lib/Buffer/index.es.min.js +1 -1
  4. package/lib/Canvas/index.es.js +16 -5
  5. package/lib/Canvas/index.es.min.js +2 -2
  6. package/lib/Cardinal/index.es.js +1 -1
  7. package/lib/Cardinal/index.es.min.js +1 -1
  8. package/lib/Eoap/index.es.js +1 -1
  9. package/lib/Eoap/index.es.min.js +1 -1
  10. package/lib/Hermite/index.es.js +1 -1
  11. package/lib/Hermite/index.es.min.js +1 -1
  12. package/lib/Matrix4/index.es.js +1 -1
  13. package/lib/Matrix4/index.es.min.js +1 -1
  14. package/lib/Mercator/index.es.js +1 -1
  15. package/lib/Mercator/index.es.min.js +1 -1
  16. package/lib/RawCanvas/index.es.js +15 -4
  17. package/lib/RawCanvas/index.es.min.js +2 -2
  18. package/lib/SVG/index.es.js +12 -8
  19. package/lib/SVG/index.es.min.js +2 -2
  20. package/lib/Shader/index.es.js +1 -1
  21. package/lib/Shader/index.es.min.js +1 -1
  22. package/lib/Texture/index.es.js +1 -1
  23. package/lib/Texture/index.es.min.js +1 -1
  24. package/lib/TreeLayout/index.es.js +38 -8
  25. package/lib/TreeLayout/index.es.min.js +2 -2
  26. package/lib/animation/index.es.js +38 -8
  27. package/lib/animation/index.es.min.js +2 -2
  28. package/lib/assemble/index.es.js +1 -1
  29. package/lib/assemble/index.es.min.js +1 -1
  30. package/lib/getLoopColors/index.es.js +1 -1
  31. package/lib/getLoopColors/index.es.min.js +1 -1
  32. package/lib/getWebGLContext/index.es.js +1 -1
  33. package/lib/getWebGLContext/index.es.min.js +1 -1
  34. package/lib/index.umd.js +88 -36
  35. package/lib/index.umd.min.js +2 -2
  36. package/lib/initOption/index.es.js +1 -1
  37. package/lib/initOption/index.es.min.js +1 -1
  38. package/lib/mergeOption/index.es.js +1 -1
  39. package/lib/mergeOption/index.es.min.js +1 -1
  40. package/lib/move/index.es.js +1 -1
  41. package/lib/move/index.es.min.js +1 -1
  42. package/lib/rotate/index.es.js +1 -1
  43. package/lib/rotate/index.es.min.js +1 -1
  44. package/lib/ruler/index.es.js +1 -1
  45. package/lib/ruler/index.es.min.js +1 -1
  46. package/lib/scale/index.es.js +1 -1
  47. package/lib/scale/index.es.min.js +1 -1
  48. package/lib/throttle/index.es.js +25 -25
  49. package/lib/throttle/index.es.min.js +2 -2
  50. package/miniprogram/ui-canvas/index.js +115 -115
  51. package/package/animation/index.ts +1 -1
  52. package/package/throttle/index.ts +1 -1
  53. package/package.json +7 -2
  54. package/src/Canvas.ts +84 -84
  55. package/src/common/canvas/gradient.ts +32 -24
  56. package/src/common/canvas/index.ts +182 -177
  57. package/src/common/canvas/painter.ts +9 -3
  58. package/src/common/svg/config.ts +194 -190
  59. package/src/common/svg/index.ts +350 -347
  60. package/src/common/svg/tool.ts +42 -44
  61. package/src/layout/TreeLayout.ts +1 -1
  62. package/types/Canvas.d.ts +10 -1
  63. package/types/CanvasConfig.d.ts +116 -106
  64. package/types/SVGConfig.d.ts +89 -79
  65. package/types/animation.d.ts +2 -6
  66. package/types/index.d.ts +160 -158
  67. package/types/painterConfig.d.ts +5 -3
  68. package/types/throttle.d.ts +2 -4
  69. package/types/throttleOption.d.ts +1 -22
  70. package/types/uni-canvas.d.ts +4 -0
  71. package/src/animation.ts +0 -99
  72. package/src/throttle.ts +0 -53
@@ -1,45 +1,43 @@
1
- import type SVGConfigType from '../../../types/SVGConfig'
2
-
3
- import { XLINK_ATTRIBUTE } from "./dictionary"
4
-
5
- // 新建节点
6
- export function toNode(tagname: string) {
7
- return document.createElementNS('http://www.w3.org/2000/svg', tagname)
8
- }
9
-
10
- // 设置属性
11
- const _setAttribute = function (el: SVGElement, key: string, value: string | number) {
12
-
13
- // 需要使用xlink命名空间的xml属性
14
- if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
15
- el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "")
16
- }
17
-
18
- // 否则
19
- else {
20
- el.setAttribute(key, value + "")
21
- }
22
- }
23
- export const setAttribute = _setAttribute
24
-
25
- // 获取属性
26
- export function getAttribute(el: SVGElement, key: string) {
27
- if (XLINK_ATTRIBUTE.indexOf(key) > -1) key = 'xlink:' + key
28
- return el.getAttribute(key)
29
- }
30
-
31
- export function full(el: SVGElement, config: SVGConfigType) {
32
- _setAttribute(el, "stroke", config.strokeStyle as string)
33
- _setAttribute(el, "fill", config.fillStyle as string)
34
- _setAttribute(el, "stroke-dasharray", (config.lineDash as Array<number>).join(','))
35
- }
36
-
37
- export function fill(el: SVGElement, config: SVGConfigType) {
38
- _setAttribute(el, "fill", config.fillStyle as string)
39
- }
40
-
41
- export function stroke(el: SVGElement, config: SVGConfigType) {
42
- _setAttribute(el, "stroke", config.strokeStyle as string)
43
- _setAttribute(el, "fill", "none")
44
- _setAttribute(el, "stroke-dasharray", (config.lineDash as Array<number>).join(','))
1
+ import type SVGConfigType from '../../../types/SVGConfig'
2
+
3
+ import { XLINK_ATTRIBUTE } from "./dictionary"
4
+
5
+ // 新建节点
6
+ export function toNode(tagname: string) {
7
+ return document.createElementNS('http://www.w3.org/2000/svg', tagname)
8
+ }
9
+
10
+ // 设置属性
11
+ const _setAttribute = function (el: SVGElement, key: string, value: string | number) {
12
+
13
+ // 需要使用xlink命名空间的xml属性
14
+ if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
15
+ el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "")
16
+ }
17
+
18
+ // 否则
19
+ else {
20
+ el.setAttribute(key, value + "")
21
+ }
22
+ }
23
+ export const setAttribute = _setAttribute
24
+
25
+ // 获取属性
26
+ export function getAttribute(el: SVGElement, key: string) {
27
+ if (XLINK_ATTRIBUTE.indexOf(key) > -1) key = 'xlink:' + key
28
+ return el.getAttribute(key)
29
+ }
30
+
31
+ export function full(el: SVGElement, config: SVGConfigType) {
32
+ _setAttribute(el, "stroke", config.strokeStyle as string)
33
+ _setAttribute(el, "fill", config.fillStyle as string)
34
+ }
35
+
36
+ export function fill(el: SVGElement, config: SVGConfigType) {
37
+ _setAttribute(el, "fill", config.fillStyle as string)
38
+ }
39
+
40
+ export function stroke(el: SVGElement, config: SVGConfigType) {
41
+ _setAttribute(el, "stroke", config.strokeStyle as string)
42
+ _setAttribute(el, "fill", "none")
45
43
  }
@@ -4,7 +4,7 @@ import type TreeOptionType from '../../types/TreeOption'
4
4
 
5
5
  import Tree from '../common/tree/index'
6
6
  import { initOption } from '../common/option'
7
- import animation from '../animation'
7
+ import { animation } from "@oipage/core.js/src/animation/index"
8
8
  import rotate from '../rotate'
9
9
 
10
10
  class TreeLayout extends Tree implements TreeLayoutType {
package/types/Canvas.d.ts CHANGED
@@ -297,6 +297,15 @@ export default interface CanvasType {
297
297
  */
298
298
  createRadialGradient(cx: number, cy: number, r: number): GradientType<CanvasGradient>
299
299
 
300
+ /**
301
+ * 创建角度渐变
302
+ * @param cx 中心
303
+ * @param cy
304
+ * @param beginDeg 开始弧度
305
+ * @param deg 跨越弧度,可选,默认2PI
306
+ */
307
+ createConicGradient(cx: number, cy: number, beginDeg: number, deg?: number): GradientType<CanvasGradient>
308
+
300
309
  /**
301
310
  * 获取指定位置颜色
302
311
  * @param x
@@ -326,5 +335,5 @@ export default interface CanvasType {
326
335
  * @param eventName 事件名称
327
336
  * @param callback 回调函数
328
337
  */
329
- bind(eventName: string, callback: (regionName: string) => void): this
338
+ bind(eventName: string, callback: (regionName: string, x: number, y: number) => void): this
330
339
  }
@@ -1,107 +1,117 @@
1
- import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
2
-
3
- export default interface CanvasConfigType {
4
-
5
- /**
6
- * 填充色或图案,默认"#000"
7
- */
8
- fillStyle?: string | CanvasGradient
9
-
10
- /**
11
- * 轮廓色或图案,默认"#000"
12
- */
13
- strokeStyle?: string | CanvasGradient
14
-
15
- /**
16
- * 线条宽度,默认1(单位px)
17
- */
18
- lineWidth?: number
19
-
20
- /**
21
- * 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
22
- */
23
- textAlign?: textAlignType
24
-
25
- /**
26
- * 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
27
- */
28
- textBaseline?: textBaselineType
29
-
30
- /**
31
- * 设置线条虚线,默认为[]表示使用实线绘制
32
- *
33
- * 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
34
- */
35
- lineDash?: Array<number>
36
-
37
- /**
38
- * 阴影的模糊系数,默认0,也就是无阴影
39
- */
40
- shadowBlur?: number
41
-
42
- /**
43
- * 阴影的颜色
44
- */
45
- shadowColor?: string | CanvasGradient
46
-
47
- /**
48
- * 文字大小,默认16
49
- */
50
- "fontSize"?: number
51
-
52
- /**
53
- * 已废弃,向下兼容,请用 fontSize 代替
54
- */
55
- "font-size"?: number // 向下兼容
56
-
57
- /**
58
- * 字体,默认"sans-serif"
59
- */
60
- "fontFamily"?: string
61
-
62
- /**
63
- * 已废弃,向下兼容,请用 fontFamily 代替
64
- */
65
- "font-family"?: string // 向下兼容
66
-
67
- /**
68
- * 字重,默认400
69
- */
70
- "fontWeight"?: number
71
-
72
- /**
73
- * 已废弃,向下兼容,请用 fontWeight 代替
74
- */
75
- "font-weight"?: number // 向下兼容
76
-
77
- /**
78
- * 字类型,默认"normal"
79
- */
80
- "fontStyle"?: string
81
-
82
- /**
83
- * 已废弃,向下兼容,请用 fontStyle 代替
84
- */
85
- "font-style"?: string // 向下兼容
86
-
87
- /**
88
- * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
89
- */
90
- "arcStartCap"?: arcCapType
91
-
92
- /**
93
- * 已废弃,向下兼容,请用 arcStartCap 代替
94
- */
95
- "arc-start-cap"?: string // 向下兼容
96
-
97
- /**
98
- * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
99
- */
100
- "arcEndCap"?: arcCapType
101
-
102
- /**
103
- * 已废弃,向下兼容,请用 arcEndCap 代替
104
- */
105
- "arc-end-cap"?: string // 向下兼容
106
-
1
+ import { arcCapType, textAlignType, textBaselineType, lineCapType, lineJoinType } from './painterConfig'
2
+
3
+ export default interface CanvasConfigType {
4
+
5
+ /**
6
+ * 填充色或图案,默认"#000"
7
+ */
8
+ fillStyle?: string | CanvasGradient
9
+
10
+ /**
11
+ * 轮廓色或图案,默认"#000"
12
+ */
13
+ strokeStyle?: string | CanvasGradient
14
+
15
+ /**
16
+ * 线条宽度,默认1(单位px)
17
+ */
18
+ lineWidth?: number
19
+
20
+ /**
21
+ * 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形)
22
+ */
23
+ lineCap?: lineCapType
24
+
25
+ /**
26
+ * 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆)
27
+ */
28
+ lineJoin?: lineJoinType
29
+
30
+ /**
31
+ * 设置线条虚线,默认为[]表示使用实线绘制
32
+ *
33
+ * 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
34
+ */
35
+ lineDash?: Array<number>
36
+
37
+ /**
38
+ * 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
39
+ */
40
+ textAlign?: textAlignType
41
+
42
+ /**
43
+ * 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
44
+ */
45
+ textBaseline?: textBaselineType
46
+
47
+ /**
48
+ * 阴影的模糊系数,默认0,也就是无阴影
49
+ */
50
+ shadowBlur?: number
51
+
52
+ /**
53
+ * 阴影的颜色
54
+ */
55
+ shadowColor?: string | CanvasGradient
56
+
57
+ /**
58
+ * 文字大小,默认16
59
+ */
60
+ "fontSize"?: number
61
+
62
+ /**
63
+ * 已废弃,向下兼容,请用 fontSize 代替
64
+ */
65
+ "font-size"?: number // 向下兼容
66
+
67
+ /**
68
+ * 字体,默认"sans-serif"
69
+ */
70
+ "fontFamily"?: string
71
+
72
+ /**
73
+ * 已废弃,向下兼容,请用 fontFamily 代替
74
+ */
75
+ "font-family"?: string // 向下兼容
76
+
77
+ /**
78
+ * 字重,默认400
79
+ */
80
+ "fontWeight"?: number
81
+
82
+ /**
83
+ * 已废弃,向下兼容,请用 fontWeight 代替
84
+ */
85
+ "font-weight"?: number // 向下兼容
86
+
87
+ /**
88
+ * 字类型,默认"normal"
89
+ */
90
+ "fontStyle"?: string
91
+
92
+ /**
93
+ * 已废弃,向下兼容,请用 fontStyle 代替
94
+ */
95
+ "font-style"?: string // 向下兼容
96
+
97
+ /**
98
+ * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
99
+ */
100
+ "arcStartCap"?: arcCapType
101
+
102
+ /**
103
+ * 已废弃,向下兼容,请用 arcStartCap 代替
104
+ */
105
+ "arc-start-cap"?: string // 向下兼容
106
+
107
+ /**
108
+ * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
109
+ */
110
+ "arcEndCap"?: arcCapType
111
+
112
+ /**
113
+ * 已废弃,向下兼容,请用 arcEndCap 代替
114
+ */
115
+ "arc-end-cap"?: string // 向下兼容
116
+
107
117
  }
@@ -1,80 +1,90 @@
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
-
1
+ import { arcCapType, textAlignType, textBaselineType, lineCapType, lineJoinType } 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
+ * 线的端点类型,默认"butt"平直边缘(还有"round"半圆和"square"矩形)
25
+ */
26
+ lineCap?: lineCapType
27
+
28
+ /**
29
+ * 线的拐角连接方式,默认"miter"连接处边缘延长相接(还有"bevel"对角线斜角和"round"圆)
30
+ */
31
+ lineJoin?: lineJoinType
32
+
33
+ /**
34
+ * 设置线条虚线,默认为[]表示使用实线绘制
35
+ *
36
+ * 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
37
+ */
38
+ lineDash?: Array<number>
39
+
40
+ /**
41
+ * 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
42
+ */
43
+ textAlign?: textAlignType
44
+
45
+ /**
46
+ * 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
47
+ */
48
+ textBaseline?: textBaselineType
49
+
50
+ /**
51
+ * 文字大小,默认16
52
+ */
53
+ "fontSize"?: number
54
+
55
+ /**
56
+ * 已废弃,向下兼容,请用 fontSize 代替
57
+ */
58
+ "font-size"?: number // 向下兼容
59
+
60
+ /**
61
+ * 字体,默认"sans-serif"
62
+ */
63
+ "fontFamily"?: string
64
+
65
+ /**
66
+ * 已废弃,向下兼容,请用 fontFamily 代替
67
+ */
68
+ "font-family"?: string // 向下兼容
69
+
70
+ /**
71
+ * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
72
+ */
73
+ "arcStartCap"?: arcCapType
74
+
75
+ /**
76
+ * 已废弃,向下兼容,请用 arcStartCap 代替
77
+ */
78
+ "arc-start-cap"?: string // 向下兼容
79
+
80
+ /**
81
+ * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
82
+ */
83
+ "arcEndCap"?: arcCapType
84
+
85
+ /**
86
+ * 已废弃,向下兼容,请用 arcEndCap 代替
87
+ */
88
+ "arc-end-cap"?: string // 向下兼容
89
+
80
90
  }
@@ -1,10 +1,6 @@
1
- interface animationFun {
2
- (deep: number): void
3
- }
1
+ import { animationType } from "@oipage/core.js/src/animation"
4
2
 
5
3
  /**
6
4
  * 轮询动画,返回一个函数,调用该函数,可以提前结束动画
7
5
  */
8
- export default interface animationType {
9
- (doback: animationFun, duration?: number, callback?: animationFun): Function
10
- }
6
+ export default animationType