vislite 1.3.0 → 1.4.0-alpha.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.
Files changed (191) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +307 -300
  3. package/LICENSE +20 -20
  4. package/README.md +284 -284
  5. package/lib/BarLayout/index.es.d.ts +3 -0
  6. package/lib/BarLayout/index.es.js +467 -0
  7. package/lib/BarLayout/index.es.min.d.ts +3 -0
  8. package/lib/BarLayout/index.es.min.js +10 -0
  9. package/lib/Buffer/index.es.js +35 -35
  10. package/lib/Buffer/index.es.min.js +1 -1
  11. package/lib/Canvas/index.es.js +774 -774
  12. package/lib/Canvas/index.es.min.js +1 -1
  13. package/lib/Cardinal/index.es.js +90 -90
  14. package/lib/Cardinal/index.es.min.js +1 -1
  15. package/lib/Eoap/index.es.js +33 -33
  16. package/lib/Eoap/index.es.min.js +1 -1
  17. package/lib/Hermite/index.es.js +35 -35
  18. package/lib/Hermite/index.es.min.js +1 -1
  19. package/lib/MapCoordinate/index.es.js +199 -199
  20. package/lib/MapCoordinate/index.es.min.js +1 -1
  21. package/lib/Matrix4/index.es.js +124 -124
  22. package/lib/Matrix4/index.es.min.js +1 -1
  23. package/lib/Mercator/index.es.js +19 -19
  24. package/lib/Mercator/index.es.min.js +1 -1
  25. package/lib/PieLayout/index.es.d.ts +3 -0
  26. package/lib/PieLayout/index.es.js +234 -0
  27. package/lib/PieLayout/index.es.min.d.ts +3 -0
  28. package/lib/PieLayout/index.es.min.js +9 -0
  29. package/lib/RawCanvas/index.es.js +704 -704
  30. package/lib/RawCanvas/index.es.min.js +1 -1
  31. package/lib/SVG/index.es.js +514 -491
  32. package/lib/SVG/index.es.min.js +2 -2
  33. package/lib/Shader/index.es.js +35 -35
  34. package/lib/Shader/index.es.min.js +1 -1
  35. package/lib/Texture/index.es.js +53 -53
  36. package/lib/Texture/index.es.min.js +1 -1
  37. package/lib/TreeLayout/index.es.js +316 -309
  38. package/lib/TreeLayout/index.es.min.js +6 -2
  39. package/lib/animation/index.es.js +16 -9
  40. package/lib/animation/index.es.min.js +6 -2
  41. package/lib/assemble/index.es.js +17 -17
  42. package/lib/assemble/index.es.min.js +1 -1
  43. package/lib/getLoopColors/index.es.js +35 -35
  44. package/lib/getLoopColors/index.es.min.js +1 -1
  45. package/lib/getWebGLContext/index.es.js +62 -62
  46. package/lib/getWebGLContext/index.es.min.js +1 -1
  47. package/lib/index.umd.js +2675 -2327
  48. package/lib/index.umd.min.js +12 -2
  49. package/lib/initOption/index.es.js +6 -6
  50. package/lib/initOption/index.es.min.js +1 -1
  51. package/lib/mergeOption/index.es.js +34 -34
  52. package/lib/mergeOption/index.es.min.js +1 -1
  53. package/lib/move/index.es.js +7 -7
  54. package/lib/move/index.es.min.js +1 -1
  55. package/lib/rotate/index.es.js +7 -7
  56. package/lib/rotate/index.es.min.js +1 -1
  57. package/lib/ruler/index.es.js +137 -137
  58. package/lib/ruler/index.es.min.js +1 -1
  59. package/lib/scale/index.es.js +6 -6
  60. package/lib/scale/index.es.min.js +1 -1
  61. package/lib/throttle/index.es.js +7 -2
  62. package/lib/throttle/index.es.min.js +5 -1
  63. package/minialipay/ui-canvas/drawImage.js +35 -35
  64. package/minialipay/ui-canvas/index.acss +4 -4
  65. package/minialipay/ui-canvas/index.axml +3 -3
  66. package/minialipay/ui-canvas/index.d.ts +1 -1
  67. package/minialipay/ui-canvas/index.js +100 -100
  68. package/minialipay/ui-canvas/index.json +6 -6
  69. package/miniprogram/ui-canvas/drawImage.js +35 -35
  70. package/miniprogram/ui-canvas/index.js +117 -117
  71. package/miniprogram/ui-canvas/index.json +4 -4
  72. package/miniprogram/ui-canvas/index.wxml +4 -4
  73. package/miniprogram/ui-canvas/index.wxss +5 -5
  74. package/package/BarLayout/index.ts +3 -0
  75. package/package/Buffer/index.ts +2 -2
  76. package/package/Canvas/index.ts +2 -2
  77. package/package/Cardinal/index.ts +2 -2
  78. package/package/Eoap/index.ts +2 -2
  79. package/package/Hermite/index.ts +2 -2
  80. package/package/MapCoordinate/index.ts +2 -2
  81. package/package/Matrix4/index.ts +2 -2
  82. package/package/Mercator/index.ts +2 -2
  83. package/package/PieLayout/index.ts +3 -0
  84. package/package/RawCanvas/index.ts +2 -2
  85. package/package/SVG/index.ts +2 -2
  86. package/package/Shader/index.ts +2 -2
  87. package/package/Texture/index.ts +2 -2
  88. package/package/TreeLayout/index.ts +2 -2
  89. package/package/animation/index.ts +2 -2
  90. package/package/assemble/index.ts +2 -2
  91. package/package/getLoopColors/index.ts +2 -2
  92. package/package/getWebGLContext/index.ts +40 -40
  93. package/package/index.ts +84 -80
  94. package/package/initOption/index.ts +2 -2
  95. package/package/mergeOption/index.ts +2 -2
  96. package/package/move/index.ts +2 -2
  97. package/package/rotate/index.ts +2 -2
  98. package/package/ruler/index.ts +2 -2
  99. package/package/scale/index.ts +2 -2
  100. package/package/throttle/index.ts +2 -2
  101. package/package.json +75 -75
  102. package/src/Canvas.ts +84 -84
  103. package/src/Eoap.ts +66 -66
  104. package/src/Matrix4/index.ts +84 -84
  105. package/src/Matrix4/move.ts +12 -12
  106. package/src/Matrix4/rotate.ts +15 -15
  107. package/src/Matrix4/scale.ts +11 -11
  108. package/src/Matrix4/transform.ts +64 -64
  109. package/src/Mercator.ts +27 -27
  110. package/src/SVG.ts +55 -24
  111. package/src/common/assemble.ts +22 -22
  112. package/src/common/canvas/arc.ts +51 -51
  113. package/src/common/canvas/config.ts +176 -176
  114. package/src/common/canvas/default.ts +64 -64
  115. package/src/common/canvas/gradient.ts +31 -31
  116. package/src/common/canvas/index.ts +188 -188
  117. package/src/common/canvas/painter.ts +443 -443
  118. package/src/common/canvas/texts.ts +18 -18
  119. package/src/common/map/getBoundary.ts +15 -15
  120. package/src/common/map/tool.ts +29 -29
  121. package/src/common/option.ts +29 -29
  122. package/src/common/setStyle.ts +5 -5
  123. package/src/common/svg/config.ts +213 -213
  124. package/src/common/svg/default.ts +29 -29
  125. package/src/common/svg/gradient.ts +53 -53
  126. package/src/common/svg/index.ts +332 -332
  127. package/src/common/svg/tool.ts +51 -51
  128. package/src/common/tree/index.ts +25 -25
  129. package/src/common/tree/toInnerTree.ts +61 -61
  130. package/src/common/tree/toPlainTree.ts +135 -132
  131. package/src/common/type.ts +26 -26
  132. package/src/common/webgl/buffer.ts +79 -79
  133. package/src/common/webgl/getWebGLContext.ts +45 -45
  134. package/src/common/webgl/shader.ts +75 -75
  135. package/src/common/webgl/texture.ts +98 -97
  136. package/src/coordinate/MapCoordinate.ts +80 -80
  137. package/src/getLoopColors.ts +42 -42
  138. package/src/interpolation/Cardinal.ts +110 -110
  139. package/src/interpolation/Hermite.ts +65 -65
  140. package/src/layout/BarLayout.ts +249 -0
  141. package/src/layout/PieLayout.ts +142 -0
  142. package/src/layout/TreeLayout.ts +197 -194
  143. package/src/move.ts +7 -7
  144. package/src/rotate.ts +7 -7
  145. package/src/ruler.ts +209 -209
  146. package/src/scale.ts +6 -6
  147. package/types/Bar.d.ts +92 -0
  148. package/types/BarConfig.d.ts +5 -0
  149. package/types/BarLayout.d.ts +49 -0
  150. package/types/BarOption.d.ts +32 -0
  151. package/types/Buffer.d.ts +23 -23
  152. package/types/Canvas.d.ts +352 -352
  153. package/types/CanvasConfig.d.ts +88 -88
  154. package/types/CanvasOption.d.ts +8 -8
  155. package/types/CanvasOpts.d.ts +9 -9
  156. package/types/Cardinal.d.ts +13 -13
  157. package/types/Gradient.d.ts +14 -14
  158. package/types/Hermite.d.ts +18 -18
  159. package/types/Map.d.ts +9 -9
  160. package/types/MapConfig.d.ts +27 -27
  161. package/types/MapCoordinate.d.ts +22 -22
  162. package/types/Matrix4.d.ts +47 -47
  163. package/types/Pie.d.ts +74 -0
  164. package/types/PieConfig.d.ts +27 -0
  165. package/types/PieLayout.d.ts +41 -0
  166. package/types/PieOption.d.ts +22 -0
  167. package/types/SVG.d.ts +247 -243
  168. package/types/SVGConfig.d.ts +71 -71
  169. package/types/Shader.d.ts +16 -16
  170. package/types/Texture.d.ts +16 -16
  171. package/types/Tree.d.ts +74 -74
  172. package/types/TreeConfig.d.ts +36 -36
  173. package/types/TreeLayout.d.ts +59 -59
  174. package/types/TreeOption.d.ts +48 -48
  175. package/types/animation.d.ts +5 -5
  176. package/types/assemble.d.ts +5 -5
  177. package/types/getLoopColors.d.ts +5 -5
  178. package/types/getWebGLContext.d.ts +7 -7
  179. package/types/index.d.ts +195 -179
  180. package/types/move.d.ts +5 -5
  181. package/types/option.d.ts +12 -12
  182. package/types/painterConfig.d.ts +4 -4
  183. package/types/rotate.d.ts +5 -5
  184. package/types/ruler.d.ts +10 -10
  185. package/types/scale.d.ts +5 -5
  186. package/types/throttle.d.ts +5 -5
  187. package/types/throttleOption.d.ts +1 -1
  188. package/types/ui-canvas.d.ts +4 -4
  189. package/types/uni-canvas.d.ts +3 -3
  190. package/uni-app/drawImage.js +19 -19
  191. package/uni-app/ui-canvas.vue +284 -284
@@ -1,138 +1,138 @@
1
1
  /*!
2
- * Matrix4 of VISLite JavaScript Library v1.3.0
2
+ * Matrix4 of VISLite JavaScript Library v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
- function _move (d, a, b, c) {
6
- if (c === void 0) { c = 0; }
7
- var sqrt = Math.sqrt(a * a + b * b + c * c);
8
- return [
9
- 1, 0, 0, 0,
10
- 0, 1, 0, 0,
11
- 0, 0, 1, 0,
12
- a * d / sqrt, b * d / sqrt, c * d / sqrt, 1
13
- ];
5
+ function _move (d, a, b, c) {
6
+ if (c === void 0) { c = 0; }
7
+ var sqrt = Math.sqrt(a * a + b * b + c * c);
8
+ return [
9
+ 1, 0, 0, 0,
10
+ 0, 1, 0, 0,
11
+ 0, 0, 1, 0,
12
+ a * d / sqrt, b * d / sqrt, c * d / sqrt, 1
13
+ ];
14
14
  }
15
15
 
16
- function _rotate (deg) {
17
- var sin = Math.sin(deg), cos = Math.cos(deg);
18
- return [
19
- cos, sin, 0, 0,
20
- -sin, cos, 0, 0,
21
- 0, 0, 1, 0,
22
- 0, 0, 0, 1
23
- ];
16
+ function _rotate (deg) {
17
+ var sin = Math.sin(deg), cos = Math.cos(deg);
18
+ return [
19
+ cos, sin, 0, 0,
20
+ -sin, cos, 0, 0,
21
+ 0, 0, 1, 0,
22
+ 0, 0, 0, 1
23
+ ];
24
24
  }
25
25
 
26
- function _scale (xTimes, yTimes, zTimes, cx, cy, cz) {
27
- if (cx === void 0) { cx = 0; }
28
- if (cy === void 0) { cy = 0; }
29
- if (cz === void 0) { cz = 0; }
30
- return [
31
- xTimes, 0, 0, 0,
32
- 0, yTimes, 0, 0,
33
- 0, 0, zTimes, 0,
34
- cx - cx * xTimes, cy - cy * yTimes, cz - cz * zTimes, 1
35
- ];
26
+ function _scale (xTimes, yTimes, zTimes, cx, cy, cz) {
27
+ if (cx === void 0) { cx = 0; }
28
+ if (cy === void 0) { cy = 0; }
29
+ if (cz === void 0) { cz = 0; }
30
+ return [
31
+ xTimes, 0, 0, 0,
32
+ 0, yTimes, 0, 0,
33
+ 0, 0, zTimes, 0,
34
+ cx - cx * xTimes, cy - cy * yTimes, cz - cz * zTimes, 1
35
+ ];
36
36
  }
37
37
 
38
- function _transform (a1, b1, c1, a2, b2, c2) {
39
- if (typeof a1 === 'number' && typeof b1 === 'number') {
40
- if (typeof c1 !== 'number') {
41
- c1 = 0;
42
- a2 = a1;
43
- b2 = b1;
44
- c2 = 1;
45
- }
46
- else if (typeof a2 !== 'number' || typeof b2 !== 'number' || typeof c2 !== 'number') {
47
- a2 = a1;
48
- b2 = b1;
49
- c2 = c1;
50
- a1 = 0;
51
- b1 = 0;
52
- c1 = 0;
53
- }
54
- if (a1 == a2 && b1 == b2 && c1 == c2)
55
- throw new Error('It\'s not a legitimate ray!');
56
- var sqrt1 = Math.sqrt((a2 - a1) * (a2 - a1) + (b2 - b1) * (b2 - b1)), cos1 = sqrt1 != 0 ? (b2 - b1) / sqrt1 : 1, sin1 = sqrt1 != 0 ? (a2 - a1) / sqrt1 : 0, b = (a2 - a1) * sin1 + (b2 - b1) * cos1, c = c2 - c1, sqrt2 = Math.sqrt(b * b + c * c), cos2 = sqrt2 != 0 ? c / sqrt2 : 1, sin2 = sqrt2 != 0 ? b / sqrt2 : 0;
57
- return [
58
- [
59
- cos1, cos2 * sin1, sin1 * sin2, 0,
60
- -sin1, cos1 * cos2, cos1 * sin2, 0,
61
- 0, -sin2, cos2, 0,
62
- b1 * sin1 - a1 * cos1, c1 * sin2 - a1 * sin1 * cos2 - b1 * cos1 * cos2, -a1 * sin1 * sin2 - b1 * cos1 * sin2 - c1 * cos2, 1
63
- ],
64
- [
65
- cos1, -sin1, 0, 0,
66
- cos2 * sin1, cos2 * cos1, -sin2, 0,
67
- sin1 * sin2, cos1 * sin2, cos2, 0,
68
- a1, b1, c1, 1
69
- ]
70
- ];
71
- }
72
- else {
73
- throw new Error('a1 and b1 is required!');
74
- }
38
+ function _transform (a1, b1, c1, a2, b2, c2) {
39
+ if (typeof a1 === 'number' && typeof b1 === 'number') {
40
+ if (typeof c1 !== 'number') {
41
+ c1 = 0;
42
+ a2 = a1;
43
+ b2 = b1;
44
+ c2 = 1;
45
+ }
46
+ else if (typeof a2 !== 'number' || typeof b2 !== 'number' || typeof c2 !== 'number') {
47
+ a2 = a1;
48
+ b2 = b1;
49
+ c2 = c1;
50
+ a1 = 0;
51
+ b1 = 0;
52
+ c1 = 0;
53
+ }
54
+ if (a1 == a2 && b1 == b2 && c1 == c2)
55
+ throw new Error('It\'s not a legitimate ray!');
56
+ var sqrt1 = Math.sqrt((a2 - a1) * (a2 - a1) + (b2 - b1) * (b2 - b1)), cos1 = sqrt1 != 0 ? (b2 - b1) / sqrt1 : 1, sin1 = sqrt1 != 0 ? (a2 - a1) / sqrt1 : 0, b = (a2 - a1) * sin1 + (b2 - b1) * cos1, c = c2 - c1, sqrt2 = Math.sqrt(b * b + c * c), cos2 = sqrt2 != 0 ? c / sqrt2 : 1, sin2 = sqrt2 != 0 ? b / sqrt2 : 0;
57
+ return [
58
+ [
59
+ cos1, cos2 * sin1, sin1 * sin2, 0,
60
+ -sin1, cos1 * cos2, cos1 * sin2, 0,
61
+ 0, -sin2, cos2, 0,
62
+ b1 * sin1 - a1 * cos1, c1 * sin2 - a1 * sin1 * cos2 - b1 * cos1 * cos2, -a1 * sin1 * sin2 - b1 * cos1 * sin2 - c1 * cos2, 1
63
+ ],
64
+ [
65
+ cos1, -sin1, 0, 0,
66
+ cos2 * sin1, cos2 * cos1, -sin2, 0,
67
+ sin1 * sin2, cos1 * sin2, cos2, 0,
68
+ a1, b1, c1, 1
69
+ ]
70
+ ];
71
+ }
72
+ else {
73
+ throw new Error('a1 and b1 is required!');
74
+ }
75
75
  }
76
76
 
77
- var _multiply = function (matrix4, param) {
78
- var newParam = [];
79
- for (var i = 0; i < 4; i++)
80
- for (var j = 0; j < param.length / 4; j++)
81
- newParam[j * 4 + i] =
82
- matrix4[i] * param[j * 4] +
83
- matrix4[i + 4] * param[j * 4 + 1] +
84
- matrix4[i + 8] * param[j * 4 + 2] +
85
- matrix4[i + 12] * param[j * 4 + 3];
86
- return newParam;
87
- };
88
- var __initMatrix4 = [
89
- 1, 0, 0, 0,
90
- 0, 1, 0, 0,
91
- 0, 0, 1, 0,
92
- 0, 0, 0, 1
93
- ];
94
- var Matrix4 = (function () {
95
- function Matrix4(initMatrix4) {
96
- if (initMatrix4 === void 0) { initMatrix4 = __initMatrix4; }
97
- this.name = 'Matrix4';
98
- this.__matrix4 = initMatrix4;
99
- }
100
- Matrix4.prototype.setValue = function (initMatrix4) {
101
- if (initMatrix4 === void 0) { initMatrix4 = __initMatrix4; }
102
- this.__matrix4 = initMatrix4;
103
- return this;
104
- };
105
- Matrix4.prototype.move = function (dis, a, b, c) {
106
- if (c === void 0) { c = 0; }
107
- this.__matrix4 = _multiply(_move(dis, a, b, c), this.__matrix4);
108
- return this;
109
- };
110
- Matrix4.prototype.rotate = function (deg, a1, b1, c1, a2, b2, c2) {
111
- var matrix4s = _transform(a1, b1, c1, a2, b2, c2);
112
- this.__matrix4 = _multiply(_multiply(_multiply(matrix4s[1], _rotate(deg)), matrix4s[0]), this.__matrix4);
113
- return this;
114
- };
115
- Matrix4.prototype.scale = function (xTimes, yTimes, zTimes, cx, cy, cz) {
116
- if (cx === void 0) { cx = 0; }
117
- if (cy === void 0) { cy = 0; }
118
- if (cz === void 0) { cz = 0; }
119
- this.__matrix4 = _multiply(_scale(xTimes, yTimes, zTimes, cx, cy, cz), this.__matrix4);
120
- return this;
121
- };
122
- Matrix4.prototype.multiply = function (newMatrix4, flag) {
123
- if (flag === void 0) { flag = false; }
124
- this.__matrix4 = flag ? _multiply(this.__matrix4, newMatrix4) : _multiply(newMatrix4, this.__matrix4);
125
- return this;
126
- };
127
- Matrix4.prototype.use = function (x, y, z, w) {
128
- if (z === void 0) { z = 0; }
129
- if (w === void 0) { w = 1; }
130
- return _multiply(this.__matrix4, [x, y, z, w]);
131
- };
132
- Matrix4.prototype.value = function () {
133
- return this.__matrix4;
134
- };
135
- return Matrix4;
77
+ var _multiply = function (matrix4, param) {
78
+ var newParam = [];
79
+ for (var i = 0; i < 4; i++)
80
+ for (var j = 0; j < param.length / 4; j++)
81
+ newParam[j * 4 + i] =
82
+ matrix4[i] * param[j * 4] +
83
+ matrix4[i + 4] * param[j * 4 + 1] +
84
+ matrix4[i + 8] * param[j * 4 + 2] +
85
+ matrix4[i + 12] * param[j * 4 + 3];
86
+ return newParam;
87
+ };
88
+ var __initMatrix4 = [
89
+ 1, 0, 0, 0,
90
+ 0, 1, 0, 0,
91
+ 0, 0, 1, 0,
92
+ 0, 0, 0, 1
93
+ ];
94
+ var Matrix4 = (function () {
95
+ function Matrix4(initMatrix4) {
96
+ if (initMatrix4 === void 0) { initMatrix4 = __initMatrix4; }
97
+ this.name = 'Matrix4';
98
+ this.__matrix4 = initMatrix4;
99
+ }
100
+ Matrix4.prototype.setValue = function (initMatrix4) {
101
+ if (initMatrix4 === void 0) { initMatrix4 = __initMatrix4; }
102
+ this.__matrix4 = initMatrix4;
103
+ return this;
104
+ };
105
+ Matrix4.prototype.move = function (dis, a, b, c) {
106
+ if (c === void 0) { c = 0; }
107
+ this.__matrix4 = _multiply(_move(dis, a, b, c), this.__matrix4);
108
+ return this;
109
+ };
110
+ Matrix4.prototype.rotate = function (deg, a1, b1, c1, a2, b2, c2) {
111
+ var matrix4s = _transform(a1, b1, c1, a2, b2, c2);
112
+ this.__matrix4 = _multiply(_multiply(_multiply(matrix4s[1], _rotate(deg)), matrix4s[0]), this.__matrix4);
113
+ return this;
114
+ };
115
+ Matrix4.prototype.scale = function (xTimes, yTimes, zTimes, cx, cy, cz) {
116
+ if (cx === void 0) { cx = 0; }
117
+ if (cy === void 0) { cy = 0; }
118
+ if (cz === void 0) { cz = 0; }
119
+ this.__matrix4 = _multiply(_scale(xTimes, yTimes, zTimes, cx, cy, cz), this.__matrix4);
120
+ return this;
121
+ };
122
+ Matrix4.prototype.multiply = function (newMatrix4, flag) {
123
+ if (flag === void 0) { flag = false; }
124
+ this.__matrix4 = flag ? _multiply(this.__matrix4, newMatrix4) : _multiply(newMatrix4, this.__matrix4);
125
+ return this;
126
+ };
127
+ Matrix4.prototype.use = function (x, y, z, w) {
128
+ if (z === void 0) { z = 0; }
129
+ if (w === void 0) { w = 1; }
130
+ return _multiply(this.__matrix4, [x, y, z, w]);
131
+ };
132
+ Matrix4.prototype.value = function () {
133
+ return this.__matrix4;
134
+ };
135
+ return Matrix4;
136
136
  }());
137
137
 
138
138
  export { Matrix4 as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Matrix4 of VISLite JavaScript Library v1.3.0
2
+ * Matrix4 of VISLite JavaScript Library v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  var t=function(t,r){for(var i=[],o=0;o<4;o++)for(var n=0;n<r.length/4;n++)i[4*n+o]=t[o]*r[4*n]+t[o+4]*r[4*n+1]+t[o+8]*r[4*n+2]+t[o+12]*r[4*n+3];return i},r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],i=function(){function i(t){void 0===t&&(t=r),this.name="Matrix4",this.__matrix4=t}return i.prototype.setValue=function(t){return void 0===t&&(t=r),this.__matrix4=t,this},i.prototype.move=function(r,i,o,n){return void 0===n&&(n=0),this.__matrix4=t(function(t,r,i,o){void 0===o&&(o=0);var n=Math.sqrt(r*r+i*i+o*o);return[1,0,0,0,0,1,0,0,0,0,1,0,r*t/n,i*t/n,o*t/n,1]}(r,i,o,n),this.__matrix4),this},i.prototype.rotate=function(r,i,o,n,e,u,a){var s=function(t,r,i,o,n,e){if("number"==typeof t&&"number"==typeof r){if("number"!=typeof i?(i=0,o=t,n=r,e=1):"number"==typeof o&&"number"==typeof n&&"number"==typeof e||(o=t,n=r,e=i,t=0,r=0,i=0),t==o&&r==n&&i==e)throw new Error("It's not a legitimate ray!");var u=Math.sqrt((o-t)*(o-t)+(n-r)*(n-r)),a=0!=u?(n-r)/u:1,s=0!=u?(o-t)/u:0,h=(o-t)*s+(n-r)*a,_=e-i,f=Math.sqrt(h*h+_*_),m=0!=f?_/f:1,p=0!=f?h/f:0;return[[a,m*s,s*p,0,-s,a*m,a*p,0,0,-p,m,0,r*s-t*a,i*p-t*s*m-r*a*m,-t*s*p-r*a*p-i*m,1],[a,-s,0,0,m*s,m*a,-p,0,s*p,a*p,m,0,t,r,i,1]]}throw new Error("a1 and b1 is required!")}(i,o,n,e,u,a);return this.__matrix4=t(t(t(s[1],function(t){var r=Math.sin(t),i=Math.cos(t);return[i,r,0,0,-r,i,0,0,0,0,1,0,0,0,0,1]}(r)),s[0]),this.__matrix4),this},i.prototype.scale=function(r,i,o,n,e,u){return void 0===n&&(n=0),void 0===e&&(e=0),void 0===u&&(u=0),this.__matrix4=t(function(t,r,i,o,n,e){return void 0===o&&(o=0),void 0===n&&(n=0),void 0===e&&(e=0),[t,0,0,0,0,r,0,0,0,0,i,0,o-o*t,n-n*r,e-e*i,1]}(r,i,o,n,e,u),this.__matrix4),this},i.prototype.multiply=function(r,i){return void 0===i&&(i=!1),this.__matrix4=i?t(this.__matrix4,r):t(r,this.__matrix4),this},i.prototype.use=function(r,i,o,n){return void 0===o&&(o=0),void 0===n&&(n=1),t(this.__matrix4,[r,i,o,n])},i.prototype.value=function(){return this.__matrix4},i}();export{i as default};
@@ -1,25 +1,25 @@
1
1
  /*!
2
- * Mercator of VISLite JavaScript Library v1.3.0
2
+ * Mercator of VISLite JavaScript Library v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
- var Mercator = (function () {
6
- function Mercator(scale, center) {
7
- if (scale === void 0) { scale = 7; }
8
- if (center === void 0) { center = [107, 36]; }
9
- this.name = 'Mercator';
10
- var perimeter = 100 * scale * Math.PI;
11
- var help = perimeter / 180;
12
- var cx = help * center[0];
13
- var cy = -1 * help * center[1];
14
- this.use = function (λ, φ) {
15
- return [
16
- (help * λ - cx) * 0.8,
17
- -1 * help * φ - cy,
18
- 0
19
- ];
20
- };
21
- }
22
- return Mercator;
5
+ var Mercator = (function () {
6
+ function Mercator(scale, center) {
7
+ if (scale === void 0) { scale = 7; }
8
+ if (center === void 0) { center = [107, 36]; }
9
+ this.name = 'Mercator';
10
+ var perimeter = 100 * scale * Math.PI;
11
+ var help = perimeter / 180;
12
+ var cx = help * center[0];
13
+ var cy = -1 * help * center[1];
14
+ this.use = function (λ, φ) {
15
+ return [
16
+ (help * λ - cx) * 0.8,
17
+ -1 * help * φ - cy,
18
+ 0
19
+ ];
20
+ };
21
+ }
22
+ return Mercator;
23
23
  }());
24
24
 
25
25
  export { Mercator as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Mercator of VISLite JavaScript Library v1.3.0
2
+ * Mercator of VISLite JavaScript Library v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  var t=function(t,a){void 0===t&&(t=7),void 0===a&&(a=[107,36]),this.name="Mercator";var r=100*t*Math.PI/180,e=r*a[0],i=-1*r*a[1];this.use=function(t,a){return[.8*(r*t-e),-1*r*a-i,0]}};export{t as default};
@@ -0,0 +1,3 @@
1
+ import { PieLayout } from "../../types/index"
2
+
3
+ export default PieLayout
@@ -0,0 +1,234 @@
1
+ /*!
2
+ * PieLayout of VISLite JavaScript Library v1.4.0-alpha.0
3
+ * git+https://github.com/oi-contrib/VISLite.git
4
+ */
5
+ function initOption(setOption, defaultOption) {
6
+ for (var key in setOption) {
7
+ defaultOption[key] = setOption[key];
8
+ }
9
+ return defaultOption;
10
+ }
11
+
12
+ function rotate (cx, cy, deg, x, y) {
13
+ var cos = Math.cos(deg), sin = Math.sin(deg);
14
+ return [
15
+ (x - cx) * cos - (y - cy) * sin + cx,
16
+ (x - cx) * sin + (y - cy) * cos + cy
17
+ ];
18
+ }
19
+
20
+ /*!
21
+ * animation of OIPage v1.2.0
22
+ * git+https://github.com/oi-contrib/OIPage.git
23
+ */
24
+
25
+ //当前正在运动的动画的tick函数堆栈
26
+ var $timers = [];
27
+ //唯一定时器的定时间隔
28
+ var $interval = 13;
29
+ //定时器ID
30
+ var $timerId;
31
+
32
+ /**
33
+ * 动画轮播
34
+ * @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
35
+ * @param {number} duration 动画时长,可选
36
+ * @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
37
+ *
38
+ * @returns {function} 返回一个函数,调用该函数,可以提前结束动画
39
+ */
40
+ function animation(doback, duration, callback) {
41
+ if (arguments.length < 2) duration = 400;
42
+ if (arguments.length < 3) callback = function () { };
43
+
44
+ var clock = {
45
+ //把tick函数推入堆栈
46
+ "timer": function (tick, duration, callback) {
47
+ if (!tick) {
48
+ throw new Error('Tick is required!');
49
+ }
50
+ var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
51
+ $timers.push({
52
+ "id": id,
53
+ "createTime": new Date(),
54
+ "tick": tick,
55
+ "duration": duration,
56
+ "callback": callback
57
+ });
58
+ clock.start();
59
+ return id;
60
+ },
61
+
62
+ //开启唯一的定时器timerId
63
+ "start": function () {
64
+ if (!$timerId) {
65
+ $timerId = setInterval(clock.tick, $interval);
66
+ }
67
+ },
68
+
69
+ //被定时器调用,遍历timers堆栈
70
+ "tick": function () {
71
+ var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
72
+
73
+ $timers = [];
74
+ $timers.length = 0;
75
+
76
+ for (flag = 0; flag < timers.length; flag++) {
77
+ //初始化数据
78
+ timer = timers[flag];
79
+ createTime = timer.createTime;
80
+ tick = timer.tick;
81
+ duration = timer.duration;
82
+ callback = timer.callback;
83
+
84
+ //执行
85
+ passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
86
+ passTime = passTime > 1 ? 1 : passTime;
87
+ tick(passTime);
88
+ if (passTime < 1 && timer.id) {
89
+ //动画没有结束再添加
90
+ $timers.push(timer);
91
+ } else {
92
+ callback(passTime);
93
+ }
94
+ }
95
+ if ($timers.length <= 0) {
96
+ clock.stop();
97
+ }
98
+ },
99
+
100
+ //停止定时器,重置timerId=null
101
+ "stop": function () {
102
+ if ($timerId) {
103
+ clearInterval($timerId);
104
+ $timerId = null;
105
+ }
106
+ }
107
+ };
108
+
109
+ var id = clock.timer(function (deep) {
110
+ //其中deep为0-1,表示改变的程度
111
+ doback(deep);
112
+ }, duration, callback);
113
+
114
+ return {
115
+ // 一个函数
116
+ // 用于在动画结束前结束动画
117
+ stop: function () {
118
+ var i;
119
+ for (i in $timers) {
120
+ if ($timers[i].id == id) {
121
+ $timers[i].id = void 0;
122
+ return;
123
+ }
124
+ }
125
+ }
126
+ };
127
+
128
+ }
129
+
130
+ var PieLayout = (function () {
131
+ function PieLayout(config) {
132
+ if (config === void 0) { config = {}; }
133
+ this.name = 'PieLayout';
134
+ this.__option = {
135
+ cx: 200,
136
+ cy: 200,
137
+ radius: [50, 100],
138
+ duration: 200,
139
+ };
140
+ this.__hoverIndex = -1;
141
+ this.__config = initOption(config, {
142
+ name: function (pieData, initPie) { return pieData.name; },
143
+ value: function (pieData, initPie) { return pieData.value; }
144
+ });
145
+ }
146
+ PieLayout.prototype.setOption = function (option) {
147
+ initOption(option, this.__option);
148
+ return this;
149
+ };
150
+ PieLayout.prototype.use = function (initPie, hoverIndex) {
151
+ if (hoverIndex === void 0) { hoverIndex = -1; }
152
+ var pie = {
153
+ count: initPie.length,
154
+ cx: this.__option.cx,
155
+ cy: this.__option.cy,
156
+ radius: this.__option.radius,
157
+ hoverIndex: hoverIndex,
158
+ node: []
159
+ };
160
+ var totalValue = 0, names = [], values = [];
161
+ for (var i = 0; i < initPie.length; i++) {
162
+ names[i] = this.__config.name(initPie[i], initPie);
163
+ values[i] = this.__config.value(initPie[i], initPie);
164
+ totalValue += values[i];
165
+ }
166
+ var beginDeg = Math.PI * -0.5, currenDeg;
167
+ for (var i = 0; i < initPie.length; i++) {
168
+ currenDeg = values[i] / totalValue * Math.PI * 2;
169
+ var radius = [this.__option.radius[0], this.__option.radius[1] * (1 + (hoverIndex === i ? 0.05 : 0))];
170
+ var pdeg = beginDeg + currenDeg * 0.5, pradius = Math.max(this.__option.radius[0], this.__option.radius[1]);
171
+ var p0 = rotate(pie.cx, pie.cy, pdeg, pie.cx + pradius, pie.cy);
172
+ var p1 = rotate(pie.cx, pie.cy, pdeg, pie.cx + pradius + 15, pie.cy);
173
+ var pflag = p0[0] > pie.cx ? 1 : -1;
174
+ var p2 = [p1[0] + pflag * 20, p1[1]];
175
+ var p3 = [p1[0] + pflag * 25, p1[1]];
176
+ pie.node[i] = {
177
+ value: values[i],
178
+ name: names[i],
179
+ beginDeg: beginDeg,
180
+ deg: currenDeg,
181
+ isHover: hoverIndex === i,
182
+ radius: radius,
183
+ label: {
184
+ line: [p0, p1, p2],
185
+ position: p3,
186
+ align: pflag === -1 ? "right" : "left"
187
+ }
188
+ };
189
+ beginDeg += currenDeg;
190
+ }
191
+ return pie;
192
+ };
193
+ PieLayout.prototype.bind = function (initPie, renderBack) {
194
+ this.__rback = renderBack;
195
+ this.__oralPie = initPie;
196
+ this.__prePie = this.use(this.__oralPie, this.__hoverIndex);
197
+ this.__rback(this.__prePie);
198
+ return this;
199
+ };
200
+ PieLayout.prototype.unbind = function () {
201
+ this.__rback = function () { return null; };
202
+ this.__oralPie = null;
203
+ this.__prePie = null;
204
+ this.__hoverIndex = -1;
205
+ return this;
206
+ };
207
+ PieLayout.prototype.setHover = function (index) {
208
+ if (!this.__prePie || this.__hoverIndex === index)
209
+ return this;
210
+ this.__hoverIndex = index;
211
+ this.doUpdate();
212
+ return this;
213
+ };
214
+ PieLayout.prototype.doUpdate = function () {
215
+ var _this = this;
216
+ var newPie = this.use(this.__oralPie, this.__hoverIndex);
217
+ var cachePie = JSON.parse(JSON.stringify(newPie));
218
+ animation(function (deep) {
219
+ if (_this.__prePie) {
220
+ for (var i = 0; i < cachePie.count; i++) {
221
+ cachePie.node[i].radius[1] = _this.__prePie.node[i].radius[1] + (newPie.node[i].radius[1] - _this.__prePie.node[i].radius[1]) * deep;
222
+ }
223
+ }
224
+ _this.__rback(cachePie);
225
+ }, this.__option.duration, function () {
226
+ _this.__prePie = newPie;
227
+ _this.__rback(_this.__prePie);
228
+ });
229
+ return this;
230
+ };
231
+ return PieLayout;
232
+ }());
233
+
234
+ export { PieLayout as default };
@@ -0,0 +1,3 @@
1
+ import { PieLayout } from "../../types/index"
2
+
3
+ export default PieLayout
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * PieLayout of VISLite JavaScript Library v1.4.0-alpha.0
3
+ * git+https://github.com/oi-contrib/VISLite.git
4
+ */
5
+ function t(t,i){for(var n in t)i[n]=t[n];return i}function i(t,i,n,e,r){var o=Math.cos(n),a=Math.sin(n);return[(e-t)*o-(r-i)*a+t,(e-t)*a+(r-i)*o+i]}
6
+ /*!
7
+ * animation of OIPage v1.2.0
8
+ * git+https://github.com/oi-contrib/OIPage.git
9
+ */var n,e=[];var r=function(){function r(i){void 0===i&&(i={}),this.name="PieLayout",this.__option={cx:200,cy:200,radius:[50,100],duration:200},this.__hoverIndex=-1,this.__config=t(i,{name:function(t,i){return t.name},value:function(t,i){return t.value}})}return r.prototype.setOption=function(i){return t(i,this.__option),this},r.prototype.use=function(t,n){void 0===n&&(n=-1);for(var e={count:t.length,cx:this.__option.cx,cy:this.__option.cy,radius:this.__option.radius,hoverIndex:n,node:[]},r=0,o=[],a=[],_=0;_<t.length;_++)o[_]=this.__config.name(t[_],t),a[_]=this.__config.value(t[_],t),r+=a[_];var s,u=-.5*Math.PI;for(_=0;_<t.length;_++){s=a[_]/r*Math.PI*2;var h=[this.__option.radius[0],this.__option.radius[1]*(1+(n===_?.05:0))],c=u+.5*s,d=Math.max(this.__option.radius[0],this.__option.radius[1]),p=i(e.cx,e.cy,c,e.cx+d,e.cy),l=i(e.cx,e.cy,c,e.cx+d+15,e.cy),f=p[0]>e.cx?1:-1,v=[l[0]+20*f,l[1]],x=[l[0]+25*f,l[1]];e.node[_]={value:a[_],name:o[_],beginDeg:u,deg:s,isHover:n===_,radius:h,label:{line:[p,l,v],position:x,align:-1===f?"right":"left"}},u+=s}return e},r.prototype.bind=function(t,i){return this.__rback=i,this.__oralPie=t,this.__prePie=this.use(this.__oralPie,this.__hoverIndex),this.__rback(this.__prePie),this},r.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralPie=null,this.__prePie=null,this.__hoverIndex=-1,this},r.prototype.setHover=function(t){return this.__prePie&&this.__hoverIndex!==t?(this.__hoverIndex=t,this.doUpdate(),this):this},r.prototype.doUpdate=function(){var t=this,i=this.use(this.__oralPie,this.__hoverIndex),r=JSON.parse(JSON.stringify(i));return function(t,i,r){arguments.length<2&&(i=400),arguments.length<3&&(r=function(){});var o={timer:function(t,i,n){if(!t)throw new Error("Tick is required!");var r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return e.push({id:r,createTime:new Date,tick:t,duration:i,callback:n}),o.start(),r},start:function(){n||(n=setInterval(o.tick,13))},tick:function(){var t,i,n,r,a,_,s,u=e;for((e=[]).length=0,i=0;i<u.length;i++)t=(a=u[i]).createTime,n=a.tick,_=a.duration,r=a.callback,n(s=(s=(+(new Date).valueOf()-t.valueOf())/_)>1?1:s),s<1&&a.id?e.push(a):r(s);e.length<=0&&o.stop()},stop:function(){n&&(clearInterval(n),n=null)}},a=o.timer((function(i){t(i)}),i,r)}((function(n){if(t.__prePie)for(var e=0;e<r.count;e++)r.node[e].radius[1]=t.__prePie.node[e].radius[1]+(i.node[e].radius[1]-t.__prePie.node[e].radius[1])*n;t.__rback(r)}),this.__option.duration,(function(){t.__prePie=i,t.__rback(t.__prePie)})),this},r}();export{r as default};