vislite 1.5.0-alpha.0 → 1.5.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 +316 -312
- package/LICENSE +20 -20
- package/README.md +284 -284
- package/lib/BarLayout/index.es.js +347 -347
- package/lib/BarLayout/index.es.min.js +1 -1
- package/lib/Buffer/index.es.js +35 -35
- package/lib/Buffer/index.es.min.js +1 -1
- package/lib/Canvas/index.es.js +775 -775
- package/lib/Canvas/index.es.min.js +1 -1
- package/lib/Cardinal/index.es.js +90 -90
- package/lib/Cardinal/index.es.min.js +1 -1
- package/lib/Eoap/index.es.js +33 -33
- package/lib/Eoap/index.es.min.js +1 -1
- package/lib/Hermite/index.es.js +35 -35
- package/lib/Hermite/index.es.min.js +1 -1
- package/lib/MapCoordinate/index.es.js +199 -199
- package/lib/MapCoordinate/index.es.min.js +1 -1
- package/lib/Matrix4/index.es.js +124 -124
- package/lib/Matrix4/index.es.min.js +1 -1
- package/lib/Mercator/index.es.js +19 -19
- package/lib/Mercator/index.es.min.js +1 -1
- package/lib/PieLayout/index.es.js +114 -114
- package/lib/PieLayout/index.es.min.js +1 -1
- package/lib/RawCanvas/index.es.js +704 -704
- package/lib/RawCanvas/index.es.min.js +1 -1
- package/lib/SVG/index.es.js +514 -514
- package/lib/SVG/index.es.min.js +1 -1
- package/lib/Shader/index.es.js +35 -35
- package/lib/Shader/index.es.min.js +1 -1
- package/lib/Texture/index.es.js +53 -53
- package/lib/Texture/index.es.min.js +1 -1
- package/lib/TreeLayout/index.es.js +301 -301
- package/lib/TreeLayout/index.es.min.js +1 -1
- package/lib/animation/index.es.js +3 -3
- package/lib/animation/index.es.min.js +1 -1
- package/lib/assemble/index.es.js +17 -17
- package/lib/assemble/index.es.min.js +1 -1
- package/lib/getLoopColors/index.es.js +35 -35
- package/lib/getLoopColors/index.es.min.js +1 -1
- package/lib/getWebGLContext/index.es.js +62 -62
- package/lib/getWebGLContext/index.es.min.js +1 -1
- package/lib/index.umd.js +2653 -2653
- package/lib/index.umd.min.js +1 -1
- package/lib/initOption/index.es.js +6 -6
- package/lib/initOption/index.es.min.js +1 -1
- package/lib/mergeOption/index.es.js +34 -34
- package/lib/mergeOption/index.es.min.js +1 -1
- package/lib/move/index.es.js +7 -7
- package/lib/move/index.es.min.js +1 -1
- package/lib/rotate/index.es.js +7 -7
- package/lib/rotate/index.es.min.js +1 -1
- package/lib/ruler/index.es.js +137 -137
- package/lib/ruler/index.es.min.js +1 -1
- package/lib/scale/index.es.js +6 -6
- package/lib/scale/index.es.min.js +1 -1
- package/lib/throttle/index.es.js +1 -1
- package/lib/throttle/index.es.min.js +1 -1
- package/minialipay/ui-canvas/drawImage.js +35 -35
- package/minialipay/ui-canvas/index.acss +4 -4
- package/minialipay/ui-canvas/index.axml +3 -3
- package/minialipay/ui-canvas/index.d.ts +1 -1
- package/minialipay/ui-canvas/index.js +100 -100
- package/minialipay/ui-canvas/index.json +6 -6
- package/miniprogram/ui-canvas/drawImage.js +35 -35
- package/miniprogram/ui-canvas/index.js +125 -117
- 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/BarLayout/index.ts +2 -2
- 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/MapCoordinate/index.ts +2 -2
- package/package/Matrix4/index.ts +2 -2
- package/package/Mercator/index.ts +2 -2
- package/package/PieLayout/index.ts +2 -2
- package/package/RawCanvas/index.ts +2 -2
- package/package/SVG/index.ts +2 -2
- package/package/Shader/index.ts +2 -2
- package/package/Texture/index.ts +2 -2
- package/package/TreeLayout/index.ts +2 -2
- package/package/animation/index.ts +5 -5
- package/package/assemble/index.ts +2 -2
- package/package/getLoopColors/index.ts +2 -2
- package/package/getWebGLContext/index.ts +40 -40
- package/package/index.ts +84 -84
- package/package/initOption/index.ts +2 -2
- package/package/mergeOption/index.ts +2 -2
- package/package/move/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 +75 -75
- package/src/Canvas.ts +89 -89
- 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 +55 -55
- package/src/common/assemble.ts +22 -22
- package/src/common/canvas/arc.ts +51 -51
- package/src/common/canvas/config.ts +176 -176
- package/src/common/canvas/default.ts +64 -64
- package/src/common/canvas/gradient.ts +31 -31
- package/src/common/canvas/index.ts +188 -188
- package/src/common/canvas/painter.ts +443 -443
- package/src/common/canvas/texts.ts +18 -18
- package/src/common/map/getBoundary.ts +15 -15
- package/src/common/map/tool.ts +29 -29
- package/src/common/option.ts +29 -29
- package/src/common/setStyle.ts +5 -5
- package/src/common/svg/config.ts +213 -213
- package/src/common/svg/default.ts +29 -29
- package/src/common/svg/gradient.ts +53 -53
- package/src/common/svg/index.ts +332 -332
- package/src/common/svg/tool.ts +51 -51
- package/src/common/tree/index.ts +25 -25
- package/src/common/tree/toInnerTree.ts +61 -61
- package/src/common/tree/toPlainTree.ts +135 -135
- package/src/common/type.ts +26 -26
- package/src/common/webgl/buffer.ts +79 -79
- package/src/common/webgl/getWebGLContext.ts +45 -45
- package/src/common/webgl/shader.ts +75 -75
- package/src/common/webgl/texture.ts +98 -98
- package/src/coordinate/MapCoordinate.ts +80 -80
- package/src/getLoopColors.ts +42 -42
- package/src/interpolation/Cardinal.ts +110 -110
- package/src/interpolation/Hermite.ts +65 -65
- package/src/layout/BarLayout.ts +248 -248
- package/src/layout/PieLayout.ts +141 -141
- package/src/layout/TreeLayout.ts +197 -197
- package/src/move.ts +7 -7
- package/src/rotate.ts +7 -7
- package/src/ruler.ts +209 -209
- package/src/scale.ts +6 -6
- package/types/Bar.d.ts +91 -91
- package/types/BarConfig.d.ts +4 -4
- package/types/BarLayout.d.ts +48 -48
- package/types/BarOption.d.ts +31 -31
- package/types/Buffer.d.ts +23 -23
- package/types/Canvas.d.ts +352 -352
- package/types/CanvasConfig.d.ts +88 -88
- package/types/CanvasOption.d.ts +13 -13
- 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/MapConfig.d.ts +27 -27
- package/types/MapCoordinate.d.ts +22 -22
- package/types/Matrix4.d.ts +47 -47
- package/types/Pie.d.ts +73 -73
- package/types/PieConfig.d.ts +26 -26
- package/types/PieLayout.d.ts +40 -40
- package/types/PieOption.d.ts +21 -21
- package/types/SVG.d.ts +247 -247
- package/types/SVGConfig.d.ts +71 -71
- package/types/Shader.d.ts +16 -16
- package/types/Texture.d.ts +16 -16
- package/types/Tree.d.ts +74 -74
- package/types/TreeConfig.d.ts +36 -36
- package/types/TreeLayout.d.ts +59 -59
- package/types/TreeOption.d.ts +48 -48
- package/types/animation.d.ts +11 -11
- package/types/assemble.d.ts +5 -5
- package/types/getLoopColors.d.ts +5 -5
- package/types/getWebGLContext.d.ts +7 -7
- package/types/index.d.ts +195 -195
- package/types/move.d.ts +5 -5
- package/types/option.d.ts +12 -12
- package/types/painterConfig.d.ts +4 -4
- package/types/rotate.d.ts +5 -5
- package/types/ruler.d.ts +10 -10
- package/types/scale.d.ts +5 -5
- package/types/throttle.d.ts +5 -5
- package/types/ui-canvas.d.ts +4 -4
- package/types/uni-canvas.d.ts +3 -3
- package/uni-app/drawImage.js +19 -19
- package/uni-app/ui-canvas.vue +295 -284
package/lib/Matrix4/index.es.js
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Matrix4 of VISLite JavaScript Library v1.5.0
|
|
2
|
+
* Matrix4 of VISLite JavaScript Library v1.5.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.5.0
|
|
2
|
+
* Matrix4 of VISLite JavaScript Library v1.5.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};
|
package/lib/Mercator/index.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Mercator of VISLite JavaScript Library v1.5.0
|
|
2
|
+
* Mercator of VISLite JavaScript Library v1.5.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.5.0
|
|
2
|
+
* Mercator of VISLite JavaScript Library v1.5.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};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PieLayout of VISLite JavaScript Library v1.5.0
|
|
2
|
+
* PieLayout of VISLite JavaScript Library v1.5.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
|
-
function initOption(setOption, defaultOption) {
|
|
6
|
-
for (var key in setOption) {
|
|
7
|
-
defaultOption[key] = setOption[key];
|
|
8
|
-
}
|
|
9
|
-
return defaultOption;
|
|
5
|
+
function initOption(setOption, defaultOption) {
|
|
6
|
+
for (var key in setOption) {
|
|
7
|
+
defaultOption[key] = setOption[key];
|
|
8
|
+
}
|
|
9
|
+
return defaultOption;
|
|
10
10
|
}
|
|
11
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
|
-
];
|
|
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
18
|
}
|
|
19
19
|
|
|
20
20
|
/*!
|
|
@@ -127,108 +127,108 @@ function animation(doback, duration, callback) {
|
|
|
127
127
|
|
|
128
128
|
}
|
|
129
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;
|
|
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
232
|
}());
|
|
233
233
|
|
|
234
234
|
export { PieLayout as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PieLayout of VISLite JavaScript Library v1.5.0
|
|
2
|
+
* PieLayout of VISLite JavaScript Library v1.5.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
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]}
|