vislite 0.7.0-alpha.0 → 0.7.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/CHANGELOG +8 -3
- package/README.md +20 -1
- package/lib/Buffer/index.umd.js +2 -2
- package/lib/Buffer/index.umd.min.js +2 -2
- package/lib/Canvas/index.umd.js +4 -4
- package/lib/Canvas/index.umd.min.js +3 -3
- package/lib/Cardinal/index.umd.js +2 -2
- package/lib/Cardinal/index.umd.min.js +2 -2
- package/lib/Eoap/index.umd.js +2 -2
- package/lib/Eoap/index.umd.min.js +2 -2
- package/lib/Geometry/index.umd.js +69 -8
- package/lib/Geometry/index.umd.min.js +3 -3
- package/lib/Hermite/index.umd.js +2 -2
- package/lib/Hermite/index.umd.min.js +2 -2
- package/lib/Matrix4/index.umd.js +2 -2
- package/lib/Matrix4/index.umd.min.js +2 -2
- package/lib/Mercator/index.umd.js +2 -2
- package/lib/Mercator/index.umd.min.js +2 -2
- package/lib/OralCanvas/index.es.js +3 -3
- package/lib/OralCanvas/index.es.min.js +3 -3
- package/lib/OralWebGL/index.es.js +21 -18
- package/lib/OralWebGL/index.es.min.js +3 -3
- package/lib/SVG/index.umd.js +2 -2
- package/lib/SVG/index.umd.min.js +2 -2
- package/lib/Shader/index.umd.js +3 -2
- package/lib/Shader/index.umd.min.js +3 -3
- package/lib/Texture/index.umd.js +2 -2
- package/lib/Texture/index.umd.min.js +2 -2
- package/lib/TreeLayout/index.umd.js +13 -11
- package/lib/TreeLayout/index.umd.min.js +3 -3
- package/lib/WebGL/index.umd.js +22 -19
- package/lib/WebGL/index.umd.min.js +3 -3
- package/lib/animation/index.umd.js +2 -2
- package/lib/animation/index.umd.min.js +2 -2
- package/lib/formatColor/index.umd.js +2 -2
- package/lib/formatColor/index.umd.min.js +2 -2
- package/lib/getLoopColors/index.umd.js +2 -2
- package/lib/getLoopColors/index.umd.min.js +2 -2
- package/lib/getWebGLContext/index.umd.js +4 -4
- package/lib/getWebGLContext/index.umd.min.js +3 -3
- package/lib/index.umd.js +104 -38
- package/lib/index.umd.min.js +3 -3
- package/lib/move/index.umd.js +2 -2
- package/lib/move/index.umd.min.js +2 -2
- package/lib/resizeObserver/index.umd.js +2 -2
- package/lib/resizeObserver/index.umd.min.js +2 -2
- package/lib/rotate/index.umd.js +2 -2
- package/lib/rotate/index.umd.min.js +2 -2
- package/lib/ruler/index.umd.js +4 -4
- package/lib/ruler/index.umd.min.js +3 -3
- package/lib/scale/index.umd.js +2 -2
- package/lib/scale/index.umd.min.js +2 -2
- package/lib/throttle/index.umd.js +2 -2
- package/lib/throttle/index.umd.min.js +2 -2
- package/lib/viewHandler/index.umd.js +2 -2
- package/lib/viewHandler/index.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/Canvas.ts +70 -70
- package/src/Geometry.ts +126 -82
- package/src/Matrix4/rotate.ts +15 -15
- package/src/Matrix4/transform.ts +64 -64
- package/src/WebGL.ts +66 -66
- package/src/common/assemble.ts +22 -22
- package/src/common/canvas/index.ts +177 -177
- package/src/common/canvas/painter.ts +419 -417
- package/src/common/geometry/prism-vertical.ts +40 -40
- package/src/common/geometry/tool/rotateLine.ts +36 -0
- package/src/common/setStyle.ts +5 -5
- package/src/common/svg/config.ts +190 -186
- package/src/common/svg/tool.ts +44 -44
- package/src/common/tree/toInnerTree.ts +59 -57
- package/src/common/tree/toPlainTree.ts +132 -132
- package/src/common/webgl/buffer.ts +79 -79
- package/src/common/webgl/doDraw.ts +108 -108
- package/src/common/webgl/getWebGLContext.ts +28 -28
- package/src/common/webgl/index.ts +226 -224
- package/src/common/webgl/shader.ts +75 -75
- package/src/common/webgl/texture.ts +97 -97
- package/src/layout/TreeLayout.ts +188 -186
- package/src/resizeObserver.ts +37 -37
- package/src/ruler.ts +209 -209
- package/src/viewHandler.ts +160 -158
- package/types/Canvas.d.ts +308 -308
- package/types/Geometry.d.ts +65 -40
- package/types/TreeConfig.d.ts +36 -24
package/lib/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.7.0
|
|
2
|
+
* VISLite JavaScript Library v0.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sun Jan 14 2024 15:48:51 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -478,7 +478,7 @@
|
|
|
478
478
|
var rulerArray = getResult(0);
|
|
479
479
|
var balanceMax = function () {
|
|
480
480
|
var rulerArray_temp = [];
|
|
481
|
-
var changeDist = rulerArray[rulerArray.length - 1] - option.max;
|
|
481
|
+
var changeDist = rulerArray[rulerArray.length - 1] - (option === null || option === void 0 ? void 0 : option.max);
|
|
482
482
|
for (var index = 0; index < rulerArray.length; index++) {
|
|
483
483
|
if (index + 1 < rulerArray.length && rulerArray[index + 1] - changeDist < minValue) ;
|
|
484
484
|
else {
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
};
|
|
490
490
|
var balanceMin = function () {
|
|
491
491
|
var rulerArray_temp = [];
|
|
492
|
-
var changeDist = rulerArray[0] - option.min;
|
|
492
|
+
var changeDist = rulerArray[0] - (option === null || option === void 0 ? void 0 : option.min);
|
|
493
493
|
for (var index = 0; index < rulerArray.length; index++) {
|
|
494
494
|
rulerArray_temp[index] = rulerArray[index] - changeDist;
|
|
495
495
|
if (maxValue <= rulerArray_temp[index])
|
|
@@ -1554,7 +1554,7 @@
|
|
|
1554
1554
|
if (opts === void 0) { opts = {}; }
|
|
1555
1555
|
var _this = _super.call(this, ViewCanvas, opts, RegionCanvas ? new Painter(RegionCanvas, {
|
|
1556
1556
|
willReadFrequently: true,
|
|
1557
|
-
}) :
|
|
1557
|
+
}) : undefined, true) || this;
|
|
1558
1558
|
_this.name = "Canvas";
|
|
1559
1559
|
_this.__regionList = {};
|
|
1560
1560
|
_this.__regionAssemble = assemble(0, 255, 10, 3);
|
|
@@ -1684,7 +1684,7 @@
|
|
|
1684
1684
|
willReadFrequently: false
|
|
1685
1685
|
});
|
|
1686
1686
|
var width = el.clientWidth, height = el.clientHeight;
|
|
1687
|
-
var ViewCanvas, RegionCanvas;
|
|
1687
|
+
var ViewCanvas, RegionCanvas = null;
|
|
1688
1688
|
var _el = el;
|
|
1689
1689
|
if (_el._vislite_canvas_) {
|
|
1690
1690
|
ViewCanvas = _el._vislite_canvas_[0];
|
|
@@ -1725,8 +1725,8 @@
|
|
|
1725
1725
|
|
|
1726
1726
|
function getWebGLContext$1 (canvas, scale, opts) {
|
|
1727
1727
|
if (opts === void 0) { opts = {}; }
|
|
1728
|
-
var names = ["
|
|
1729
|
-
var painter =
|
|
1728
|
+
var names = ["experimental-webgl", "webkit-3d", "moz-webgl"];
|
|
1729
|
+
var painter = canvas.getContext("webgl", opts);
|
|
1730
1730
|
for (var i = 0; i < names.length; i++) {
|
|
1731
1731
|
try {
|
|
1732
1732
|
painter = canvas.getContext(names[i], opts);
|
|
@@ -1882,6 +1882,7 @@
|
|
|
1882
1882
|
};
|
|
1883
1883
|
var ShaderObject = (function () {
|
|
1884
1884
|
function ShaderObject(painter) {
|
|
1885
|
+
this.program = null;
|
|
1885
1886
|
this.__painter = painter;
|
|
1886
1887
|
}
|
|
1887
1888
|
ShaderObject.prototype.use = function () {
|
|
@@ -1939,6 +1940,7 @@
|
|
|
1939
1940
|
}
|
|
1940
1941
|
|
|
1941
1942
|
function doDraw (type, painter, mesh, meshWorld, globalWorld) {
|
|
1943
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
1942
1944
|
var shader = getShader(type, painter, mesh);
|
|
1943
1945
|
new BufferObject(painter).use()
|
|
1944
1946
|
.write(mesh.geometry.attributes.position.array)
|
|
@@ -1952,31 +1954,31 @@
|
|
|
1952
1954
|
.divide(painter.getAttribLocation(shader.program, "a_normal"), mesh.geometry.attributes.normal.itemSize, mesh.geometry.attributes.normal.itemSize, 0);
|
|
1953
1955
|
}
|
|
1954
1956
|
if ("color" in mesh.material) {
|
|
1955
|
-
painter.uniform4f(painter.getUniformLocation(shader.program, "u_color"), mesh.material.color.r, mesh.material.color.g, mesh.material.color.b, mesh.material.color.alpha);
|
|
1957
|
+
painter.uniform4f(painter.getUniformLocation(shader.program, "u_color"), (_a = mesh.material.color) === null || _a === void 0 ? void 0 : _a.r, (_b = mesh.material.color) === null || _b === void 0 ? void 0 : _b.g, (_c = mesh.material.color) === null || _c === void 0 ? void 0 : _c.b, (_d = mesh.material.color) === null || _d === void 0 ? void 0 : _d.alpha);
|
|
1956
1958
|
}
|
|
1957
1959
|
if ("colors" in mesh.material) {
|
|
1958
1960
|
new BufferObject(painter).use()
|
|
1959
|
-
.write(mesh.material.colors.array)
|
|
1960
|
-
.divide(painter.getAttribLocation(shader.program, "a_color"), mesh.material.colors.itemSize, mesh.material.colors.itemSize, 0);
|
|
1961
|
+
.write((_e = mesh.material.colors) === null || _e === void 0 ? void 0 : _e.array)
|
|
1962
|
+
.divide(painter.getAttribLocation(shader.program, "a_color"), (_f = mesh.material.colors) === null || _f === void 0 ? void 0 : _f.itemSize, (_g = mesh.material.colors) === null || _g === void 0 ? void 0 : _g.itemSize, 0);
|
|
1961
1963
|
}
|
|
1962
1964
|
else if ("cube" in mesh.material) {
|
|
1963
|
-
var size = mesh.material.cube.right.image.value.width;
|
|
1965
|
+
var size = ((_j = (_h = mesh.material.cube) === null || _h === void 0 ? void 0 : _h.right) === null || _j === void 0 ? void 0 : _j.image.value).width;
|
|
1964
1966
|
painter.uniform1i(painter.getUniformLocation(shader.program, "u_texture"), 0);
|
|
1965
1967
|
getTexture(type, painter, 'cube').useCube([
|
|
1966
|
-
mesh.material.cube.right.image.value,
|
|
1967
|
-
mesh.material.cube.left.image.value,
|
|
1968
|
-
mesh.material.cube.top.image.value,
|
|
1969
|
-
mesh.material.cube.bottom.image.value,
|
|
1970
|
-
mesh.material.cube.far.image.value,
|
|
1971
|
-
mesh.material.cube.near.image.value
|
|
1968
|
+
(_l = (_k = mesh.material.cube) === null || _k === void 0 ? void 0 : _k.right) === null || _l === void 0 ? void 0 : _l.image.value,
|
|
1969
|
+
(_o = (_m = mesh.material.cube) === null || _m === void 0 ? void 0 : _m.left) === null || _o === void 0 ? void 0 : _o.image.value,
|
|
1970
|
+
(_q = (_p = mesh.material.cube) === null || _p === void 0 ? void 0 : _p.top) === null || _q === void 0 ? void 0 : _q.image.value,
|
|
1971
|
+
(_s = (_r = mesh.material.cube) === null || _r === void 0 ? void 0 : _r.bottom) === null || _s === void 0 ? void 0 : _s.image.value,
|
|
1972
|
+
(_u = (_t = mesh.material.cube) === null || _t === void 0 ? void 0 : _t.far) === null || _u === void 0 ? void 0 : _u.image.value,
|
|
1973
|
+
(_w = (_v = mesh.material.cube) === null || _v === void 0 ? void 0 : _v.near) === null || _w === void 0 ? void 0 : _w.image.value
|
|
1972
1974
|
], size, size);
|
|
1973
1975
|
}
|
|
1974
1976
|
else if ("image" in mesh.material) {
|
|
1975
1977
|
painter.uniform1i(painter.getUniformLocation(shader.program, "u_sampler"), 0);
|
|
1976
1978
|
new BufferObject(painter).use()
|
|
1977
|
-
.write(mesh.geometry.attributes.uv.array)
|
|
1978
|
-
.divide(painter.getAttribLocation(shader.program, "a_textcoord"), mesh.geometry.attributes.uv.itemSize, 2, 0);
|
|
1979
|
-
getTexture(type, painter, '2d').useImage(mesh.material.image.value);
|
|
1979
|
+
.write((_x = mesh.geometry.attributes.uv) === null || _x === void 0 ? void 0 : _x.array)
|
|
1980
|
+
.divide(painter.getAttribLocation(shader.program, "a_textcoord"), (_y = mesh.geometry.attributes.uv) === null || _y === void 0 ? void 0 : _y.itemSize, 2, 0);
|
|
1981
|
+
getTexture(type, painter, '2d').useImage((_z = mesh.material.image) === null || _z === void 0 ? void 0 : _z.value);
|
|
1980
1982
|
}
|
|
1981
1983
|
if (mesh.geometry.index) {
|
|
1982
1984
|
new BufferObject(painter, true).use()
|
|
@@ -2056,11 +2058,12 @@
|
|
|
2056
2058
|
return this;
|
|
2057
2059
|
};
|
|
2058
2060
|
WebGL.prototype.draw = function (object3D, isUpdateRegion) {
|
|
2061
|
+
var _a;
|
|
2059
2062
|
if (isUpdateRegion === void 0) { isUpdateRegion = false; }
|
|
2060
2063
|
if (!isUpdateRegion)
|
|
2061
2064
|
needUpdate = true;
|
|
2062
2065
|
var meshWorld = {
|
|
2063
|
-
matrix: object3D.matrix.value()
|
|
2066
|
+
matrix: (_a = object3D.matrix) === null || _a === void 0 ? void 0 : _a.value()
|
|
2064
2067
|
};
|
|
2065
2068
|
var globalWorld = {
|
|
2066
2069
|
matrix: this.__scene.matrix.value(),
|
|
@@ -2159,7 +2162,7 @@
|
|
|
2159
2162
|
region: true
|
|
2160
2163
|
});
|
|
2161
2164
|
var width = el.clientWidth, height = el.clientHeight;
|
|
2162
|
-
var ViewCanvas, RegionCanvas;
|
|
2165
|
+
var ViewCanvas, RegionCanvas = null;
|
|
2163
2166
|
var _el = el;
|
|
2164
2167
|
if (_el._vislite_canvas_) {
|
|
2165
2168
|
ViewCanvas = _el._vislite_canvas_[0];
|
|
@@ -2733,7 +2736,7 @@
|
|
|
2733
2736
|
return this;
|
|
2734
2737
|
};
|
|
2735
2738
|
TreeLayout.prototype.unbind = function () {
|
|
2736
|
-
this.__rback = null;
|
|
2739
|
+
this.__rback = function () { return null; };
|
|
2737
2740
|
this.__oralTree = null;
|
|
2738
2741
|
this.__preTree = null;
|
|
2739
2742
|
this.__noOpens = {};
|
|
@@ -2744,11 +2747,13 @@
|
|
|
2744
2747
|
var newTree = this.use(this.__oralTree, this.__noOpens);
|
|
2745
2748
|
var cacheTree = JSON.parse(JSON.stringify(newTree));
|
|
2746
2749
|
animation(function (deep) {
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2750
|
+
if (_this.__preTree) {
|
|
2751
|
+
for (var key in cacheTree.node) {
|
|
2752
|
+
if (newTree.node[key].show || _this.__preTree.node[key].show) {
|
|
2753
|
+
cacheTree.node[key].show = true;
|
|
2754
|
+
cacheTree.node[key].left = _this.__preTree.node[key].left + (newTree.node[key].left - _this.__preTree.node[key].left) * deep;
|
|
2755
|
+
cacheTree.node[key].top = _this.__preTree.node[key].top + (newTree.node[key].top - _this.__preTree.node[key].top) * deep;
|
|
2756
|
+
}
|
|
2752
2757
|
}
|
|
2753
2758
|
}
|
|
2754
2759
|
_this.__rback(cacheTree);
|
|
@@ -2759,21 +2764,21 @@
|
|
|
2759
2764
|
};
|
|
2760
2765
|
TreeLayout.prototype.closeNode = function (id) {
|
|
2761
2766
|
if (!this.__preTree)
|
|
2762
|
-
return;
|
|
2767
|
+
return this;
|
|
2763
2768
|
this.__noOpens[id] = true;
|
|
2764
2769
|
this.doUpdate();
|
|
2765
2770
|
return this;
|
|
2766
2771
|
};
|
|
2767
2772
|
TreeLayout.prototype.openNode = function (id) {
|
|
2768
2773
|
if (!this.__preTree)
|
|
2769
|
-
return;
|
|
2774
|
+
return this;
|
|
2770
2775
|
this.__noOpens[id] = false;
|
|
2771
2776
|
this.doUpdate();
|
|
2772
2777
|
return this;
|
|
2773
2778
|
};
|
|
2774
2779
|
TreeLayout.prototype.toggleNode = function (id) {
|
|
2775
2780
|
if (!this.__preTree)
|
|
2776
|
-
return;
|
|
2781
|
+
return this;
|
|
2777
2782
|
this.__noOpens[id] = !this.__noOpens[id];
|
|
2778
2783
|
this.doUpdate();
|
|
2779
2784
|
return this;
|
|
@@ -2874,6 +2879,30 @@
|
|
|
2874
2879
|
return points;
|
|
2875
2880
|
}
|
|
2876
2881
|
|
|
2882
|
+
function rotateLineFactory (x, y, z, x2, y2, z2) {
|
|
2883
|
+
return function (x0, y0, z0, isNormal) {
|
|
2884
|
+
var sin, cos, temp;
|
|
2885
|
+
var _x0 = x0 - (isNormal ? 0 : x), _y0 = y0 - (isNormal ? 0 : y), _z0 = z0 - (isNormal ? 0 : z);
|
|
2886
|
+
var _x2 = x2 - x, _y2 = y2 - y, _z2 = z2 - z;
|
|
2887
|
+
var __d = Math.sqrt(_x2 * _x2 + _z2 * _z2);
|
|
2888
|
+
cos = _x2 / __d;
|
|
2889
|
+
sin = _z2 / __d;
|
|
2890
|
+
var _x2N = _z2 * sin + _x2 * cos;
|
|
2891
|
+
var d = Math.sqrt(_y2 * _y2 + _x2N * _x2N);
|
|
2892
|
+
cos = _y2 / d;
|
|
2893
|
+
sin = _x2N / d;
|
|
2894
|
+
temp = [_y0, _x0];
|
|
2895
|
+
_y0 = temp[0] * cos - temp[1] * sin;
|
|
2896
|
+
_x0 = temp[0] * sin + temp[1] * cos;
|
|
2897
|
+
cos = _x2 / __d;
|
|
2898
|
+
sin = _z2 / __d;
|
|
2899
|
+
temp = [_x0, _z0];
|
|
2900
|
+
_x0 = temp[0] * cos - temp[1] * sin;
|
|
2901
|
+
_z0 = temp[0] * sin + temp[1] * cos;
|
|
2902
|
+
return [_x0 + (isNormal ? 0 : x), _y0 + (isNormal ? 0 : y), _z0 + (isNormal ? 0 : z)];
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2877
2906
|
var Geometry = (function () {
|
|
2878
2907
|
function Geometry(option) {
|
|
2879
2908
|
if (option === void 0) { option = {}; }
|
|
@@ -2889,27 +2918,64 @@
|
|
|
2889
2918
|
}
|
|
2890
2919
|
return this;
|
|
2891
2920
|
};
|
|
2892
|
-
Geometry.prototype.cylinder = function (x, y, z, radius,
|
|
2921
|
+
Geometry.prototype.cylinder = function (x, y, z, radius, x2, y2, z2) {
|
|
2893
2922
|
var num = splitNum(this.__option.precision, radius);
|
|
2894
|
-
|
|
2923
|
+
if (arguments.length == 5) {
|
|
2924
|
+
return this.prism(x, y, z, radius, x2, num);
|
|
2925
|
+
}
|
|
2926
|
+
else {
|
|
2927
|
+
return this.prism(x, y, z, radius, x2, y2, z2, num);
|
|
2928
|
+
}
|
|
2895
2929
|
};
|
|
2896
|
-
Geometry.prototype.prism = function (x, y, z, radius,
|
|
2930
|
+
Geometry.prototype.prism = function (x, y, z, radius, x2, y2, z2, num) {
|
|
2897
2931
|
var _a, _b, _c;
|
|
2932
|
+
var height, rotateLine = null;
|
|
2933
|
+
if (arguments.length == 6) {
|
|
2934
|
+
height = x2;
|
|
2935
|
+
num = y2;
|
|
2936
|
+
}
|
|
2937
|
+
else {
|
|
2938
|
+
height = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y) + (z2 - z) * (z2 - z));
|
|
2939
|
+
rotateLine = rotateLineFactory(x, y, z, x2, y2, z2);
|
|
2940
|
+
}
|
|
2898
2941
|
var result = [{
|
|
2942
|
+
name: "bottom",
|
|
2943
|
+
points: [],
|
|
2944
|
+
length: 0,
|
|
2945
|
+
method: "TRIANGLES"
|
|
2946
|
+
}, {
|
|
2947
|
+
name: "top",
|
|
2948
|
+
points: [],
|
|
2949
|
+
length: 0,
|
|
2950
|
+
method: "TRIANGLES"
|
|
2951
|
+
}, {
|
|
2952
|
+
name: "side",
|
|
2899
2953
|
points: [],
|
|
2900
2954
|
length: 0,
|
|
2901
2955
|
method: "TRIANGLES"
|
|
2902
2956
|
}];
|
|
2903
2957
|
(_a = result[0].points).push.apply(_a, prismHorizontal(this.__option.normal, x, y, z, radius, num, height > 0 ? -1 : 1));
|
|
2904
|
-
(_b = result[
|
|
2905
|
-
(_c = result[
|
|
2906
|
-
|
|
2958
|
+
(_b = result[1].points).push.apply(_b, prismHorizontal(this.__option.normal, x, y + height, z, radius, num, height > 0 ? 1 : -1));
|
|
2959
|
+
(_c = result[2].points).push.apply(_c, prismVertical(this.__option.normal, x, y, z, radius, height, num));
|
|
2960
|
+
for (var i = 0; i < result.length; i++) {
|
|
2961
|
+
if (rotateLine) {
|
|
2962
|
+
var points = [];
|
|
2963
|
+
var isNormal = false;
|
|
2964
|
+
for (var index = 0; index < result[i].points.length; index += 3) {
|
|
2965
|
+
points.push.apply(points, rotateLine(result[i].points[index], result[i].points[index + 1], result[i].points[index + 2], this.__option.normal && isNormal));
|
|
2966
|
+
isNormal = !isNormal;
|
|
2967
|
+
}
|
|
2968
|
+
result[i].points = points;
|
|
2969
|
+
}
|
|
2970
|
+
result[i].length = result[i].points.length / (this.__option.normal ? 6 : 3);
|
|
2971
|
+
}
|
|
2907
2972
|
return result;
|
|
2908
2973
|
};
|
|
2909
2974
|
Geometry.prototype.sphere = function (cx, cy, cz, radius) {
|
|
2910
2975
|
var _a;
|
|
2911
2976
|
var num = splitNum(this.__option.precision, radius);
|
|
2912
2977
|
var result = [{
|
|
2978
|
+
name: "surface",
|
|
2913
2979
|
points: [],
|
|
2914
2980
|
length: 0,
|
|
2915
2981
|
method: "TRIANGLES"
|
package/lib/index.umd.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.7.0
|
|
2
|
+
* VISLite JavaScript Library v0.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sun Jan 14 2024 15:48:51 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
|
-
var t,e;t=this,e=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,e,i,r,n,o){if(!(t<i))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=i;var a=this.__u*n,s=this.__u*o;return e/=i-t,r/=i-t,this.__MR=[2*e-2*r+a+s,3*r-3*e-2*a-s,a,e],this},t.prototype.use=function(t){if(this.__MR){var e=(t-this.__a)/(this.__b-this.__a),i=e*e;return(e*i*this.__MR[0]+i*this.__MR[1]+e*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),e=function(){function e(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return e.prototype.setP=function(e){this.__HS={x:[],h:[]};var i,r,n=(e[1][1]-e[0][1])/(e[1][0]-e[0][0]);for(this.__HS.x[0]=e[0][0],i=1;i<e.length;i++){if(e[i][0]<=e[i-1][0])throw new Error("The point position should be increamented!");this.__HS.x[i]=e[i][0],r=i<e.length-1?e[i+1][1]>e[i][1]&&e[i-1][1]>e[i][1]||e[i+1][1]<e[i][1]&&e[i-1][1]<e[i][1]||e[i+1][1]==e[i][1]||e[i-1][1]==e[i][1]?0:(e[i+1][1]-e[i-1][1])/(e[i+1][0]-e[i-1][0]):(e[i][1]-e[i-1][1])/(e[i][0]-e[i-1][0]),this.__HS.h[i-1]=new t(.5*(1-this.__t)).setP(e[i-1][0],e[i-1][1],e[i][0],e[i][1],n,r),n=r}return this},e.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},e}(),i=function(t,e){for(var i=[],r=0;r<4;r++)for(var n=0;n<e.length/4;n++)i[4*n+r]=t[r]*e[4*n]+t[r+4]*e[4*n+1]+t[r+8]*e[4*n+2]+t[r+12]*e[4*n+3];return i},r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n=function(){function t(t){void 0===t&&(t=r),this.name="Matrix4",this.__matrix4=t}return t.prototype.setValue=function(t){return void 0===t&&(t=r),this.__matrix4=t,this},t.prototype.move=function(t,e,r,n){return void 0===n&&(n=0),this.__matrix4=i(function(t,e,i,r){void 0===r&&(r=0);var n=Math.sqrt(e*e+i*i+r*r);return[1,0,0,0,0,1,0,0,0,0,1,0,e*t/n,i*t/n,r*t/n,1]}(t,e,r,n),this.__matrix4),this},t.prototype.rotate=function(t,e,r,n,o,a,s){var _=function(t,e,i,r,n,o){if("number"==typeof t&&"number"==typeof e){if("number"!=typeof i?(i=0,r=t,n=e,o=1):"number"==typeof r&&"number"==typeof n&&"number"==typeof o||(r=t,n=e,o=i,t=0,e=0,i=0),t==r&&e==n&&i==o)throw new Error("It's not a legitimate ray!");var a=Math.sqrt((r-t)*(r-t)+(n-e)*(n-e)),s=0!=a?(n-e)/a:1,_=0!=a?(r-t)/a:0,h=(r-t)*_+(n-e)*s,u=o-i,l=Math.sqrt(h*h+u*u),p=0!=l?u/l:1,c=0!=l?h/l:0;return[[s,p*_,_*c,0,-_,s*p,s*c,0,0,-c,p,0,e*_-t*s,i*c-t*_*p-e*s*p,-t*_*c-e*s*c-i*p,1],[s,-_,0,0,p*_,p*s,-c,0,_*c,s*c,p,0,t,e,i,1]]}throw new Error("a1 and b1 is required!")}(e,r,n,o,a,s);return this.__matrix4=i(i(i(_[1],function(t){var e=Math.sin(t),i=Math.cos(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,e,r,n,o,a){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),this.__matrix4=i(function(t,e,i,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),[t,0,0,0,0,e,0,0,0,0,i,0,r-r*t,n-n*e,o-o*i,1]}(t,e,r,n,o,a),this.__matrix4),this},t.prototype.multiply=function(t,e){return void 0===e&&(e=!1),this.__matrix4=e?i(this.__matrix4,t):i(t,this.__matrix4),this},t.prototype.use=function(t,e,r,n){return void 0===r&&(r=0),void 0===n&&(n=1),i(this.__matrix4,[t,e,r,n])},t.prototype.value=function(){return this.__matrix4},t}();function o(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[(r-t)*o-(n-e)*a+t,(r-t)*a+(n-e)*o+e]}var a,s=function(t){var e=t.toString(16);return 1==e.length?"0"+e:e},_=[];function h(t,e,i){void 0===e&&(e=400),void 0===i&&(i=function(){});var r={timer:function(t,e,i){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return _.push({id:n,createTime:new Date,tick:t,duration:e,callback:i}),r.start(),n},start:function(){a||(a=setInterval(r.tick,13))},tick:function(){var t,e,i,n,o,a,s,h=_;for((_=[]).length=0,e=0;e<h.length;e++)t=(o=h[e]).createTime,i=o.tick,a=o.duration,n=o.callback,i(s=(s=(+(new Date).valueOf()-t.valueOf())/a)>1?1:s),s<1&&o.id?_.push(o):n(s);_.length<=0&&r.stop()},stop:function(){a&&(clearInterval(a),a=null)}},n=r.timer((function(e){t(e)}),e,i);return function(){var t;for(t in _)if(_[t].id==n)return void(_[t].id=void 0)}}var u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},u(t,e)};function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function p(t,e,i){if(i||2===arguments.length)for(var r,n=0,o=e.length;n<o;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=["href","title","show","type","role","actuate"];function f(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}var d=function(t,e,i){c.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,i+""):t.setAttribute(e,i+"")},g=d;function v(t,e){d(t,"stroke",e.strokeStyle),d(t,"fill",e.fillStyle),d(t,"stroke-dasharray",e.lineDash.join(","))}function m(t,e){d(t,"fill",e.fillStyle)}function y(t,e){d(t,"stroke",e.strokeStyle),d(t,"fill","none"),d(t,"stroke-dasharray",e.lineDash.join(","))}var E=function(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[+((r-t)*o-(n-e)*a+t).toFixed(7),+((r-t)*a+(n-e)*o+e).toFixed(7)]};function x(t,e,i,r,n,o,a){e<0&&(t+=e,e*=-1);var s,_=[];s=E(0,0,t,n,0),_[0]=s[0],_[1]=s[1],s=E(0,0,e,s[0],s[1]),_[2]=s[0],_[3]=s[1],s=E(0,0,t,o,0),_[4]=s[0],_[5]=s[1],s=E(0,0,e,s[0],s[1]),_[6]=s[0],_[7]=s[1],a(t,t+e,_[0]+i,_[1]+r,_[4]+i,_[5]+r,_[2]+i,_[3]+r,_[6]+i,_[7]+r,.5*(o-n))}var b=function(t){var e=t.getElementsByTagName("defs");if(e.length<=0){var i=f("defs");return t.appendChild(i),i}return e[0]},w=function(t,e,i,r,n){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");g(t,"dy",{top:.5*e.fontSize,middle:0,bottom:.5*-e.fontSize}[e.textBaseline]),function(t,e){for(var i in e)t.style[i]=e[i]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[e.textAlign],"dominant-baseline":"central","font-size":e.fontSize+"px","font-family":e.fontFamily}),g(t,"x",i),g(t,"y",r),"number"==typeof n&&g(t,"transform","rotate("+(n%=360)+","+i+","+r+")")},T=function(t,e,i,r){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");g(t,"cx",e),g(t,"cy",i),g(t,"r",r)},C=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");g(t,"d",e)},P=function(t,e,i,r,n){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");n<0&&(i-=n*=-1),r<0&&(e-=r*=-1),g(t,"x",e),g(t,"y",i),g(t,"width",r),g(t,"height",n)},R=function(t,e,i,r,n,o,a,s){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(a=a/180*Math.PI,s=s/180*Math.PI,a%=2*Math.PI,n>o){var _=n;n=o,o=_}s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=1.999999*Math.PI:s%=2*Math.PI,x(a,s,i,r,n,o,(function(i,r,a,s,_,h,u,l,p,c,f){var d=r-i>Math.PI?1:0,v="M"+a+" "+s;f<0&&(f=-f),v+="A"+n+" "+n+" 0 "+d+" 1 "+u+" "+l,"round"==e.arcEndCap?v+="A"+f+" "+f+" 0 1 0 "+p+" "+c:"-round"==e.arcEndCap?v+="A"+f+" "+f+" 0 1 1 "+p+" "+c:v+="L"+p+" "+c,v+="A"+o+" "+o+" 0 "+d+" 0 "+_+" "+h,"round"==e.arcStartCap?v+="A"+f+" "+f+" 0 1 0 "+a+" "+s:"-round"==e.arcStartCap?v+="A"+f+" "+f+" 0 1 1 "+a+" "+s:v+="L"+a+" "+s,"butt"==e.arcStartCap&&(v+="Z"),g(t,"d",v)}))},S={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},A=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[S[t]||t];for(var e in t){var i=S[e]||e;this.__config[i]=t[e]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,e){return e=e||this.__svg,"string"==typeof t&&(t=f(t)),e.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,e){var i=t;if("string"==typeof t&&(i={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==i)throw new Error("Unsupported drawing method:"+t);return this.appendEl(i,e)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return c.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)g(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,m(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,y(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,v(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),m(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),y(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),v(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return T(this.__useEl,t,e,i),m(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return T(this.__useEl,t,e,i),y(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return T(this.__useEl,t,e,i),v(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),m(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),y(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),v(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return C(this.__useEl,this.__path),m(this.__useEl,this.__config),this},t.prototype.stroke=function(){return C(this.__useEl,this.__path),y(this.__useEl,this.__config),this},t.prototype.full=function(){return C(this.__useEl,this.__path),v(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,r,n){var a=o(t,e,r/180*Math.PI,t+i,e),s=o(t,e,(r+n)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+a[0]+","+a[1]:a[0]==this.__currentPosition[0]&&a[1]==this.__currentPosition[1]||(this.__path+="L"+a[0]+","+a[1]),this.__path+="A"+i+","+i+" 0 "+(n>180||n<-180?1:0)+","+(n>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__path+="Q"+t+" "+e+","+i+" "+r,this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__path+="C"+t+" "+e+","+i+" "+r+","+n+" "+o,this},t.prototype.bind=function(t,e){return this.__useEl.addEventListener(t,(function(t){e.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=b(t),a="vislite-lg-"+(new Date).valueOf()+"-"+Math.random(),s=f("linearGradient");o.appendChild(s),g(s,"id",a),g(s,"x1",e+"%"),g(s,"y1",i+"%"),g(s,"x2",r+"%"),g(s,"y2",n+"%");var _={value:function(){return"url(#"+a+")"},setColor:function(t,e){var i=f("stop");return s.appendChild(i),g(i,"offset",100*t+"%"),g(i,"style","stop-color:"+e+";"),_}};return _}(this.__svg,t,e,i,r)},t.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=b(t),o="vislite-rg-"+(new Date).valueOf()+"-"+Math.random(),a=f("radialGradient");n.appendChild(a),g(a,"id",o),g(a,"cx",e+"%"),g(a,"cy",i+"%"),g(a,"r",r+"%");var s={value:function(){return"url(#"+o+")"},setColor:function(t,e){var i=f("stop");return a.appendChild(i),g(i,"offset",100*t+"%"),g(i,"style","stop-color:"+e+";"),s}};return s}(this.__svg,t,e,i)},t}(),M=function(t){function e(e){if(!e)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=e.clientWidth,r=e.clientHeight,n=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.appendChild(n),n.setAttribute("width",i+""),n.setAttribute("height",r+""),n.setAttribute("viewBox","0 0 "+i+" "+r),t.call(this,n)||this}return l(e,t),e}(A),L=function(t,e,i,r,n){return t.beginPath(),t.translate(i,r),t.rotate(n),t.font=e.fontStyle+" "+e.fontWeight+" "+e.fontSize+"px "+e.fontFamily,t},I=function(t,e,i,r,n,o,a,s){if(n>o){var _=n;n=o,o=_}return a%=2*Math.PI,s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=2*Math.PI:s%=2*Math.PI,x(a,s,i,r,n,o,(function(a,s,_,h,u,l,p,c,f,d,g){g<0&&(g=-g),t.beginPath(),t.moveTo(_,h),t.arc(i,r,n,a,s,!1),"round"==e.arcEndCap?t.arc(.5*(p+f),.5*(c+d),g,s-Math.PI,s,!0):"-round"==e.arcEndCap?t.arc(.5*(p+f),.5*(c+d),g,s-Math.PI,s,!1):t.lineTo(f,d),t.arc(i,r,o,s,a,!0),"round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),g,a,a-Math.PI,!0):"-round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),g,a,a-Math.PI,!1):t.lineTo(_,h)})),"butt"==e.arcStartCap&&t.closePath(),t},k=function(t,e,i,r){return t.beginPath(),t.moveTo(e+r,i),t.arc(e,i,r,0,2*Math.PI),t},z=function(t,e,i,r,n){return t.beginPath(),t.rect(e,i,r,n),t};function U(t,e,i,r,n){for(var o=0,a="",s=0;s<e.length;s++)t.measureText(a+e[s]).width>i||/\n$/.test(a)?(n(a,((o+=1)-.5)*r),a=e[s]):s==e.length-1?(o+=1,n(a+e[s],(o-.5)*r)):a+=e[s];return o*r}var N=function(){function t(t,e,i,r){void 0===e&&(e={}),void 0===r&&(r=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",e),this.__region=i,this.__isPainter=r,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,e){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,e),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(e);else if(t in this.__specialConfig)"fontSize"==t&&(e=Math.round(e)),this.__specialConfig[t]=e;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=e}return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e)}));return this.painter.restore(),_},t.prototype.strokeTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.strokeText(t,0,e)}));return this.painter.restore(),_},t.prototype.fullTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e),a.painter.strokeText(t,0,e)}));return this.painter.restore(),_},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,e){return this.__region&&this.__region.moveTo(t,e),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.lineTo=function(t,e){return this.__region&&this.__region.lineTo(t,e),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.arc=function(t,e,i,r,n){return this.__region&&this.__region.arc(t,e,i,r,n),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,e,i,r,r+n,n<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__region&&this.__region.quadraticCurveTo(t,e,i,r),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,e,i,r),this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__region&&this.__region.bezierCurveTo(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,e,i,r,n,o),this},t.prototype.clearRect=function(t,e,i,r){return this.__region&&this.__region.clearRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,e,i,r),this},t.prototype.fillArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fillArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,e,i,r,n,o).fill(),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return this.__region&&this.__region.strokeArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,e,i,r,n,o).stroke(),this},t.prototype.fullArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fullArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||(I(this.painter,this.__specialConfig,t,e,i,r,n,o),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,e,i){return this.__region&&this.__region.fillCircle(t,e,i),this.__isPainter&&this.__onlyRegion||k(this.painter,t,e,i).fill(),this},t.prototype.strokeCircle=function(t,e,i){return this.__region&&this.__region.strokeCircle(t,e,i),this.__isPainter&&this.__onlyRegion||k(this.painter,t,e,i).stroke(),this},t.prototype.fullCircle=function(t,e,i){return this.__region&&this.__region.fullCircle(t,e,i),this.__isPainter&&this.__onlyRegion||(k(this.painter,t,e,i),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,e,i,r){return this.__region&&this.__region.fillRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||z(this.painter,t,e,i,r).fill(),this},t.prototype.strokeRect=function(t,e,i,r){return this.__region&&this.__region.strokeRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||z(this.painter,t,e,i,r).stroke(),this},t.prototype.fullRect=function(t,e,i,r){return this.__region&&this.__region.fullRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||(z(this.painter,t,e,i,r),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t}();function O(t,e,i,r){for(var n=[],o=0;o<r;o++)n[o]=t;return function(){for(var o=0;o<r;o++){if(n[o]+i<e){n[o]=+(n[o]+i).toFixed(7);break}o<r-1&&(n[o]=t)}return n}}var B={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},F=function(t){function e(e,i,r){void 0===r&&(r={});var n=t.call(this,e,r,i?new N(i,{willReadFrequently:!0}):null,!0)||this;return n.name="Canvas",n.__regionList={},n.__regionAssemble=O(0,255,10,3),n.setRegion(""),n}return l(e,t),e.prototype.config=function(t){for(var e in t){var i=B[e]||e;this.useConfig(i,t[e])}return this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var e=this.__regionAssemble();this.__regionList[t]="rgb("+e[0]+","+e[1]+","+e[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,e){var i=this;return new Promise((function(r){var n=i.__region?i.__region.painter.getImageData(t-.5,e-.5,1,1):{data:[0,0,0,0]},o=n.data,a=function(){if(i.__region)for(var t in i.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==i.__regionList[t]){r(t);break}r("")};o?a():n.then((function(t){o=t,a()}))}))},e.prototype.textWidth=function(t){this.painter.save(),L(this.painter,this.__specialConfig,0,0,0);var e=this.painter.measureText(t+"").width;return this.painter.restore(),e},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.getInfo=function(){return{width:this.painter.canvas.width,height:this.painter.canvas.height}},e.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=t.createLinearGradient(e,i,r,n),a={value:function(){return o},setColor:function(t,e){return o.addColorStop(t,e),a}};return a}(this.painter,t,e,i,r)},e.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=t.createRadialGradient(e,i,0,e,i,r),o={value:function(){return n},setColor:function(t,e){return n.addColorStop(t,e),o}};return o}(this.painter,t,e,i)},e.prototype.getColor=function(t,e){var i=this.painter.getImageData(t-.5,e-.5,1,1).data;return"rgba("+i[0]+","+i[1]+","+i[2]+","+i[3]+")"},e}(N);function D(t,e){for(var i in t)e[i]=t[i];return e}var G=function(t){function e(e,i){void 0===i&&(i={});var r=this;if(!e)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");i=D(i,{region:!0,willReadFrequently:!1});var n,o,a=e.clientWidth,s=e.clientHeight,_=e;_._vislite_canvas_?(n=_._vislite_canvas_[0],o=_._vislite_canvas_[1]):(n=document.createElement("canvas"),e.appendChild(n),i.region&&(o=document.createElement("canvas")),_._vislite_canvas_=[n,o],e.setAttribute("vislite","Canvas"));for(var h=0,u=[n,o];h<u.length;h++){var l=u[h];l&&(l.style.width=a+"px",l.setAttribute("width",a+""),l.style.height=s+"px",l.setAttribute("height",s+""))}return(r=t.call(this,n,o,{willReadFrequently:i.willReadFrequently})||this).__canvas=n,r}return l(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(e){e(t.__canvas.toDataURL())}))},e}(F);function H(t,e,i){void 0===i&&(i={});for(var r=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,o=0;o<r.length;o++){try{n=t.getContext(r[o],i)}catch(t){}if(n)break}if(!n)throw new Error("Non canvas or browser does not support webgl.");var a=n.canvas.width,s=n.canvas.height,_=a*e,h=s*e;return n.viewport(.5*(a-_),.5*(s-h),_,h),n.depthFunc(n.LEQUAL),n.enable(n.DEPTH_TEST),n}function W(t){var e=t.drawingBufferWidth,i=t.drawingBufferHeight,r=new Uint8Array(4*e*i);return t.readPixels(0,0,e,i,t.RGBA,t.UNSIGNED_BYTE,r),function(t,n){return"rgba("+r[4*((n=i-n)*e+t)]+","+r[4*(n*e+t)+1]+","+r[4*(n*e+t)+2]+","+r[4*(n*e+t)+3]+")"}}var q=function(){function t(t,e){void 0===e&&(e=!1),this.__painter=t,this.__isElement=e,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,e,i,r){var n=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(n,e,r)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,e,i,r){return void 0===r&&(r=0),function(t,e,i,r,n,o,a){t.vertexAttribPointer(e,i,r,a,n,o),t.enableVertexAttribArray(e)}(this.__painter,t,e,this.__painter.FLOAT,i*this.__fsize,r*this.__fsize,!1),this},t}(),V=function(){function t(t,e,i){void 0===i&&(i=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[e],this.__texture=function(t,e,i){var r=t.createTexture();return t.activeTexture(t["TEXTURE"+i]),t.bindTexture(e,r),r}(t,this.__type,i),t.texParameteri(this.__type,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(this.__type,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}return t.prototype.useImage=function(t){return function(t,e,i,r,n,o){t.texImage2D(e,i,r,r,n,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,e,i){return function(t,e,i,r,n,o,a,s,_){for(var h,u=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],l=0;l<u.length;l++)o[l]&&(h=u[l],t.texImage2D(h,i,r,a,s,0,r,n,null),t.bindTexture(e,_),t.texImage2D(h,i,r,r,n,o[l]));t.generateMipmap(e)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,e,i,this.__texture),this},t}(),X={};function Y(t,e,i){var r=t+"-"+i;return X[r]||(X[r]=new V(e,i)),X[r]}var j=function(t,e,i){var r=t.createShader(e);if(null==r)throw new Error("Unable to create shader!");if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(r));return r},$=function(){function t(t){this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,e){return this.program=function(t,e,i){var r=j(t,t.VERTEX_SHADER,e),n=j(t,t.FRAGMENT_SHADER,i),o=t.createProgram();if(t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,e),this},t}(),Z="attribute vec4 a_position;\nuniform mat4 u_matrix;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\n temp.z = -1.0 * temp.z;\n\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\n float dist = 4.0;\n\n // 使用投影直接计算\n // 为保证纹理和相对位置正确\n // x、y、z的改变满足线性变换\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n}",J="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_color = a_color;\n}",Q="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec2 a_textcoord;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_textcoord = a_textcoord;\n}",K="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_normal;\nvarying vec3 v_normal;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_normal = normalize(vec3(a_normal));\n}",tt="precision mediump float;\n\nuniform vec4 u_color;\n\nvoid main()\n{\n gl_FragColor = u_color;\n}",et="precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}",it="precision mediump float;\n\nuniform sampler2D u_sampler;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n gl_FragColor = texture2D(u_sampler, v_textcoord);\n}",rt="precision mediump float;\n\nvarying vec3 v_normal;\nuniform samplerCube u_texture;\n\nvoid main()\n{\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\n}",nt={};function ot(t,e,i,r,n){var o=function(t,e,i){var r,n,o=t+(i.material.color?"1":"0")+(i.material.colors?"1":"0")+(i.material.image?"1":"0")+(i.material.cube?"1":"0");if(nt[o])return nt[o].use();var a=(r={},r[t+"1000"]=Z,r[t+"0100"]=J,r[t+"0010"]=Q,r[t+"0001"]=K,r)[o].replace(/uniform +mat4 +u_matrix;/,"\n uniform mat4 u_matrix_world;\n uniform mat4 u_matrix_mesh;\n uniform mat4 u_matrix_proporion;").replace(/u_matrix +\* +a_position/,"u_matrix_proporion * u_matrix_world * u_matrix_mesh * a_position"),s=(n={},n[t+"1000"]=tt,n[t+"0100"]=et,n[t+"0010"]=it,n[t+"0001"]=rt,n)[o],_=new $(e).compile(a,s).use();return nt[o]=_,_}(t,e,i);if(new q(e).use().write(i.geometry.attributes.position.array).divide(e.getAttribLocation(o.program,"a_position"),i.geometry.attributes.position.itemSize,i.geometry.attributes.position.itemSize,0),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_world"),!1,n.matrix),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_proporion"),!1,n.proporion),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_mesh"),!1,r.matrix),i.geometry.attributes.normal&&new q(e).use().write(i.geometry.attributes.normal.array).divide(e.getAttribLocation(o.program,"a_normal"),i.geometry.attributes.normal.itemSize,i.geometry.attributes.normal.itemSize,0),"color"in i.material&&e.uniform4f(e.getUniformLocation(o.program,"u_color"),i.material.color.r,i.material.color.g,i.material.color.b,i.material.color.alpha),"colors"in i.material)new q(e).use().write(i.material.colors.array).divide(e.getAttribLocation(o.program,"a_color"),i.material.colors.itemSize,i.material.colors.itemSize,0);else if("cube"in i.material){var a=i.material.cube.right.image.value.width;e.uniform1i(e.getUniformLocation(o.program,"u_texture"),0),Y(t,e,"cube").useCube([i.material.cube.right.image.value,i.material.cube.left.image.value,i.material.cube.top.image.value,i.material.cube.bottom.image.value,i.material.cube.far.image.value,i.material.cube.near.image.value],a,a)}else"image"in i.material&&(e.uniform1i(e.getUniformLocation(o.program,"u_sampler"),0),new q(e).use().write(i.geometry.attributes.uv.array).divide(e.getAttribLocation(o.program,"a_textcoord"),i.geometry.attributes.uv.itemSize,2,0),Y(t,e,"2d").useImage(i.material.image.value));i.geometry.index?(new q(e,!0).use().write(i.geometry.index.array),e.drawElements(e[i.geometry.type],i.geometry.index.count,e.UNSIGNED_BYTE,0)):e.drawArrays(e[i.geometry.type],0,i.geometry.attributes.position.count)}var at,st=!1,_t=function(){function t(t,e){this.name="WebGL",this.__getColor=function(t,e){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=O(0,1,.2,3),this.__regionName="",this.__regionColor=[0,0,0,1],this.__scene={children:[],matrix:new n([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,10])},this.__unique=(new Date).valueOf(),this.painter=H(t,10),e&&(this.__regionPainter=H(e,10,{}));var i=this.painter.canvas.width/this.painter.canvas.height,r=1,o=1;i>1?r=1/i:o=i;var a=Math.min(r,o);this.__proporion=[r,0,0,0,0,o,0,0,0,0,a,0,0,0,0,1]}return t.prototype.matrix=function(t){return new n(t)},t.prototype.getMatrix=function(){return this.__scene.matrix},t.prototype.getObject3D=function(){return this.__scene.children},t.prototype.review=function(t){void 0===t&&(t=!1),t?this.__regionPainter&&(this.__regionPainter.clearColor(1,1,1,1),this.__regionPainter.clear(this.__regionPainter.COLOR_BUFFER_BIT)):(this.painter.clearColor(1,1,1,1),this.painter.clear(this.painter.COLOR_BUFFER_BIT));for(var e=0;e<this.__scene.children.length;e++)this.draw(this.__scene.children[e],t);return this},t.prototype.draw=function(t,e){void 0===e&&(e=!1),e||(st=!0);var i={matrix:t.matrix.value()},r={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var n=0;n<t.mesh.length;n++)e?this.__regionPainter&&(ot("painter"+this.__unique,this.__regionPainter,{geometry:t.mesh[n].geometry,material:{color:{r:this.__regionColor[0],g:this.__regionColor[1],b:this.__regionColor[2],alpha:this.__regionColor[3]}}},i,r),this.__getColor=W(this.__regionPainter)):ot("region"+this.__unique,this.painter,t.mesh[n],i,r)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new n),"region"in t||(t.region="");for(var e=0;e<t.mesh.length;e++){var i=t.mesh[e];i.geometry.attributes.normal&&Array.isArray(i.geometry.attributes.normal.array)&&(i.geometry.attributes.normal.array=new Float32Array(i.geometry.attributes.normal.array)),i.geometry.attributes.position&&Array.isArray(i.geometry.attributes.position.array)&&(i.geometry.attributes.position.array=new Float32Array(i.geometry.attributes.position.array)),i.geometry.attributes.uv&&Array.isArray(i.geometry.attributes.uv.array)&&(i.geometry.attributes.uv.array=new Float32Array(i.geometry.attributes.uv.array)),i.geometry.index&&Array.isArray(i.geometry.index.array)&&(i.geometry.index.array=new Uint8Array(i.geometry.index.array)),i.material.colors&&Array.isArray(i.material.colors.array)&&(i.material.colors.array=new Float32Array(i.material.colors.array))}this.__scene.children.push(t),this.draw(t)},t.prototype.setRegion=function(t){return this.__regionName=t+"",t?(null==this.__regionList[t]&&(this.__regionList[t]=p(p([],this.__regionAssemble(),!0),[1],!1)),this.__regionColor=this.__regionList[t]):this.__regionColor=[0,0,0,1],this},t.prototype.getRegion=function(t,e){var i=this;return st&&this.review(!0),st=!1,new Promise((function(r){var n=i.__getColor(t,e);for(var o in i.__regionList){var a=i.__regionList[o];if("rgba("+255*a[0]+","+255*a[1]+","+255*a[2]+","+255*a[3]+")"==n){r(o);break}}r("")}))},t}(),ht=function(t){function e(e,i){if(void 0===i&&(i={}),!e)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");i=D(i,{region:!0});var r,n,o=e.clientWidth,a=e.clientHeight,s=e;s._vislite_canvas_?(r=s._vislite_canvas_[0],n=s._vislite_canvas_[1]):(i.region&&(n=document.createElement("canvas"),e.appendChild(n),n.style.position="absolute",n.style.zIndex="-1",n.style.opacity="0"),r=document.createElement("canvas"),e.appendChild(r),s._vislite_canvas_=[r,n],e.setAttribute("vislite","WebGL"));for(var _=0,h=[r,n];_<h.length;_++){var u=h[_];u&&(u.style.width=o+"px",u.setAttribute("width",o+""),u.style.height=a+"px",u.setAttribute("height",a+""))}return t.call(this,r,n)||this}return l(e,t),e}(_t),ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.compile=function(e,i){return i?t.prototype.compile.call(this,e,i):t.prototype.compile.call(this,{color:Z,colors:J,image:Q,cube:K}[e],{color:tt,colors:et,image:it,cube:rt}[e]),this},e}($),lt=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e*n-i*o,e*o+i*n,r]},pt=function(){function t(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return t.prototype.use=function(t,e){var i,r,n,o,a,s,_=(i=(360-e)/180*Math.PI,r=100*this.__scale,n=0,o=0,a=Math.cos(i),s=Math.sin(i),[o*s+r*a,n,o*a-r*s]);return _=lt(t/180*Math.PI,_[0],_[1],_[2]),_=lt((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e,i*n-r*o,i*o+r*n]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),ct=function(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Mercator";var i=100*t*Math.PI/180,r=i*e[0],n=-1*i*e[1];this.use=function(t,e){return[.8*(i*t-r),-1*i*e-n,0]}},ft=function(t,e){var i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}},dt={},gt=0,vt=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=D(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,i){var r=function(t,e){var i,r,n={},o=e.root(t);i=r=e.id(o),n[i]={data:o,pid:null,id:i,isOpen:!0,show:!0,children:[]};var a=1;return function r(o,s){var _=e.children(o,t);a+=_?_.length:0;for(var h=0;_&&h<_.length;h++)i=e.id(_[h]),n[s].children.push(i),n[i]={data:_[h],pid:s,id:i,isOpen:!0,show:!0,children:[]},r(_[h],i)}(o,i),{rid:r,value:n,num:a}}(t,e),n=r.value,o=r.rid;if(1==r.num)return n[o].left=.5,n[o].top=.5,n[o].show=!0,{deep:1,node:n,root:o,size:1};var a=[],s=0,_=0;for(var h in i[o]?(n[o].left=.5,n[o].top=.5,n[o].show=!0,s=1):function t(e,r){r>_&&(_=r);var o=0;if(!i[e.id])for(o=0;o<e.children.length;o++)t(n[e.children[o]],r+1);if(n[e.id].left=r+.5,0==o?(null==a[r]&&(a[r]=-.5),null==a[r-1]&&(a[r-1]=-.5),n[e.id].top=a[r]+1,a[r]+1+.5*(n[e.pid].children.length-1)-1<a[r-1]&&(n[e.id].top=a[r-1]+1-.5*(n[e.pid].children.length-1))):n[e.id].top=.5*(n[e.children[0]].top+n[e.children[o-1]].top),n[e.id].top<=a[r])var h=a[r]+1-n[e.id].top((function t(e,i){n[e].top+=h,a[i]<n[e].top&&(a[i]=n[e].top);for(var r=0;r<n[e].children.length;r++)t(n[e].children[r],i+1)}))(e.id,r);a[r]=n[e.id].top,n[e.id].top+.5>s&&(s=n[e.id].top+.5)}(n[o],0),i)i[h]&&(n[h].isOpen=!1,function t(e,i,r){for(var o=0;o<n[e].children.length;o++)n[n[e].children[o]].left=i,n[n[e].children[o]].top=r,n[n[e].children[o]].show=!1,t(n[e].children[o],i,r)}(h,n[h].left,n[h].top));return{node:n,root:o,size:s,deep:_+1}}(t,this.__config,e)},t}(),mt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="TreeLayout",e.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},e.__noOpens={},e}return l(e,t),e.prototype.setOption=function(t){return D(t,this.__option),this},e.prototype.use=function(e,i){void 0===i&&(i={});var r=t.prototype.use.call(this,e,i);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var n in r.node)if(!r.node[n].show){var a=0,s=n;do{s=r.node[s].pid,a++}while(!r.node[s].show);r.node[n].left+=this.__option.offsetX*a,r.node[n].top+=this.__option.offsetY*a}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var _=this.__option.height/r.size,h=this.__option.width/(r.deep-1),u=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var n in r.node)1==r.deep?(r.node[n].left=this.__option.x+.5*this.__option.width*l,r.node[n].top=this.__option.y):(r.node[n].left=this.__option.x+(r.node[n].left-.5)*h*l,r.node[n].top=r.node[n].top*_+u)}else if("TB"==this.__option.direction||"BT"==this.__option.direction)for(var n in _=this.__option.width/r.size,h=this.__option.height/(r.deep-1),u=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1,r.node)if(1==r.deep)r.node[n].left=this.__option.x,r.node[n].top=this.__option.y+.5*this.__option.height*l;else{var p=r.node[n].left;r.node[n].left=r.node[n].top*_+u,r.node[n].top=this.__option.y+(p-.5)*h*l}}else if("circle"==this.__option.type){var c=this.__option.x,f=this.__option.y,d=2*Math.PI/r.size,g=this.__option.radius/(r.deep-1);for(var n in r.node)if(.5==r.node[n].left)r.node[n].left=c,r.node[n].top=f;else{var v=o(c,f,d*r.node[n].top,c+(r.node[n].left-.5)*g,f);r.node[n].left=v[0],r.node[n].top=v[1]}}return r},e.prototype.bind=function(t,e,i){return void 0===i&&(i={}),this.__rback=e,this.__oralTree=t,this.__noOpens=i,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},e.prototype.unbind=function(){return this.__rback=null,this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},e.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),i=JSON.parse(JSON.stringify(e));h((function(r){for(var n in i.node)(e.node[n].show||t.__preTree.node[n].show)&&(i.node[n].show=!0,i.node[n].left=t.__preTree.node[n].left+(e.node[n].left-t.__preTree.node[n].left)*r,i.node[n].top=t.__preTree.node[n].top+(e.node[n].top-t.__preTree.node[n].top)*r);t.__rback(i)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)}))},e.prototype.closeNode=function(t){if(this.__preTree)return this.__noOpens[t]=!0,this.doUpdate(),this},e.prototype.openNode=function(t){if(this.__preTree)return this.__noOpens[t]=!1,this.doUpdate(),this},e.prototype.toggleNode=function(t){if(this.__preTree)return this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this},e}(vt),yt=function(t,e){var i=Math.ceil(2*Math.PI/Math.asin(t/e)*2);return isNaN(i)||i<12?12:i};function Et(t,e,i,r,n,a,s){var _,h;if(4==a){var u=n/1.414;_=e+u,h=r+u}else _=e+n,h=r;for(var l=[_,h],p=[],c=2*Math.PI/a,f=0;f<a;f++)p.push(e,i,r),t&&p.push(0,s,0),p.push(l[0],i,l[1]),t&&p.push(0,s,0),l=o(e,r,c*(f+1),_,h),p.push(l[0],i,l[1]),t&&p.push(0,s,0);return p}function xt(t,e,i,r,n,a,s){var _,h=[e,i+n,r],u=2*Math.PI/a;t&&h.push(0,n,0);for(var l=function(){h.push.apply(h,h.slice(h.length-(t?12:6)))},p=1;p<.5*a;p++){_=o(e,i,u*p,e,i+n),p>1&&l();var c=o(e,r,u*s,_[0],r);h.push(c[0],_[1],c[1]),t&&h.push(c[0]-e,_[1]-i,c[1]-r),p>1&&l();var f=o(e,r,u*(s+1),_[0],r);h.push(f[0],_[1],f[1]),t&&h.push(f[0]-e,f[1]-i,f[1]-r)}return l(),h.push(e,i-n,r),t&&h.push(0,-n,0),h}var bt=function(){function t(t){void 0===t&&(t={}),this.name="Geometry",this.__option=D(t,{precision:.1,normal:!1})}return t.prototype.config=function(t){for(var e in t)this.__option[e]=t[e];return this},t.prototype.cylinder=function(t,e,i,r,n){var o=yt(this.__option.precision,r);return this.prism(t,e,i,r,n,o)},t.prototype.prism=function(t,e,i,r,n,a){var s,_,h,u=[{points:[],length:0,method:"TRIANGLES"}];return(s=u[0].points).push.apply(s,Et(this.__option.normal,t,e,i,r,a,n>0?-1:1)),(_=u[0].points).push.apply(_,Et(this.__option.normal,t,e+n,i,r,a,n>0?1:-1)),(h=u[0].points).push.apply(h,function(t,e,i,r,n,a,s){var _,h=[];_=4==s?o(e,r,.25*Math.PI,e-n,r):[e+n,r];for(var u,l=2*Math.PI/s,c=2*Math.PI/(2*s),f=[],d=0;d<s;d++){if(u=o.apply(void 0,p([e,r,l],_,!1)),t){var g=o.apply(void 0,p([e,r,c],_,!1));f=[g[0],0,g[1]]}h.push.apply(h,p([_[0],i,_[1]],f,!1)),h.push.apply(h,p([_[0],i+a,_[1]],f,!1)),h.push.apply(h,p([u[0],i+a,u[1]],f,!1)),h.push.apply(h,p([_[0],i,_[1]],f,!1)),h.push.apply(h,p([u[0],i,u[1]],f,!1)),h.push.apply(h,p([u[0],i+a,u[1]],f,!1)),_=u}return h}(this.__option.normal,t,e,i,r,n,a)),u[0].length=12*a,u},t.prototype.sphere=function(t,e,i,r){for(var n,o=yt(this.__option.precision,r),a=[{points:[],length:0,method:"TRIANGLES"}],s=0;s<o;s++)(n=a[0].points).push.apply(n,xt(this.__option.normal,t,e,i,r,o,s));return a[0].length=a[0].points.length/(this.__option.normal?6:3),a},t}(),wt={Cardinal:e,Hermite:t,Matrix4:n,rotate:o,move:function(t,e,i,r,n){var o=Math.sqrt(t*t+e*e);return[t*i/o+r,e*i/o+n]},scale:function(t,e,i,r,n){return[i*(r-t)+t,i*(n-e)+e]},getLoopColors:function(t,e){void 0===e&&(e=1);var i=["rgba(84,112,198,"+e+")","rgba(145,204,117,"+e+")","rgba(250,200,88,"+e+")","rgba(238,102,102,"+e+")","rgba(115,192,222,"+e+")","rgba(59,162,114,"+e+")","rgba(252,132,82,"+e+")","rgba(154,96,180,"+e+")","rgba(234,124,204,"+e+")"],r=[];if(t<=i.length)return i;if(t%i.length==0)for(var n=0;n<t/i.length;n++)r=r.concat(i);else{for(var o=1;o<t/i.length;o++)r=r.concat(i);if(t%i.length==1)r=r.concat(i[4]);else for(var a=0;a<t%i.length;a++)r=r.concat(i[a])}return r},formatColor:function(t,e){var i=document.getElementsByTagName("head")[0];i.style.color=t;for(var r=(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(i,null):i.currentStyle).getPropertyValue("color").replace(/rgba?\(/,"").replace(")","").split(","),n=0;n<r.length;n++)r[n]=+r[n];switch(r.push(1),e){case"3d":return[r[0]/255,r[1]/255,r[2]/255,r[3]];case"rgba":return"rgba(".concat(r[0],", ").concat(r[1],", ").concat(r[2],", ").concat(r[3],")");case"rgb":return"rgb(".concat(r[0],", ").concat(r[1],", ").concat(r[2],")");case"hexAlpha":return"#".concat(s(r[0])).concat(s(r[1])).concat(s(r[2])).concat(s(+(255*r[3]).toFixed(0)));case"hex":return"#".concat(s(r[0])).concat(s(r[1])).concat(s(r[2]))}throw new Error("Unsupported color format: "+e)},animation:h,ruler:function(t,e,i,r){if(t<e){var n=e;e=t,t=n}else if(t==e)return[t];var o=function(t){for(var e=t<100&&t>-100?10:.1,i=-1,r=t;10==e?r>=-100&&r<=100:r<=-100||r>=100;)i+=1,r*=e;if(10==e)return Math.pow(10,i);for(var n="0.",o=1;o<i;o++)n+="0";return+(n+"1")}(t-e),a=Math.ceil((t-e)*o/i),s=function(i){var r=({3:2,4:5,6:5,7:5,8:10,9:10,11:10,12:10,13:15,14:15,16:15,17:15,18:20,19:20,21:20,22:20,23:25,24:25,26:25,27:25}[a+i]||a+i)/o,n=Math.floor(e/r)*r,s=[];s.push(n);for(var _=1;s[s.length-1]<t;_++)s.push(n+r*_);return s},_=s(0),h=function(){for(var t=[],i=_[_.length-1]-r.max,n=0;n<_.length;n++)n+1<_.length&&_[n+1]-i<e||t.push(_[n]-i);return t},u=function(){for(var e=[],i=_[0]-r.min,n=0;n<_.length&&(e[n]=_[n]-i,!(t<=e[n]));n++);return e};if(r){if("max"in r&&"min"in r&&r.max>=t&&r.min<=e){var l=function(){if(_[0]>=r.min&&_[_.length-1]<=r.max)return!0;var t=h();if(t[0]>=r.min&&t[t.length-1]<=r.max)return _=t,!0;var e=u();return e[0]>=r.min&&e[t.length-1]<=r.max?(_=e,!0):void 0};if(l())return _;for(var p=1;p<100;p++){if(_=s(p),l())return _;if(_=s(-p),l())return _}}"max"in r&&r.max>=t?r.max<_[_.length-1]&&(_=h()):"min"in r&&r.min<=e&&r.min>_[0]&&(_=u())}for(var c=0;c<_.length;c++){var f=_[c]+"";/\./.test(f)&&(/9{7,}$/.test(f)?(f=f.replace(/9{7,}$/,""),_[c]=+(f.substring(0,f.length-1)+(+f[f.length-1]+1))):/0{7,}\d$/.test(f)&&(_[c]=+f.replace(/0{7,}\d$/,"")))}return _},SVG:M,Canvas:G,WebGL:ht,getWebGLContext:function(t,e){if(void 0===e&&(e=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var i,r=t.clientWidth,n=t.clientHeight,o=t;return o._vislite_canvas_?i=o._vislite_canvas_:(i=document.createElement("canvas"),t.appendChild(i),o._vislite_canvas_=i,t.setAttribute("vislite","WebGL")),i.style.width=r+"px",i.setAttribute("width",r+""),i.style.height=n+"px",i.setAttribute("height",n+""),H(i,e)},Shader:ut,Texture:V,Buffer:q,Eoap:pt,Mercator:ct,viewHandler:function(t){var e=document.getElementsByTagName("body")[0];e.addEventListener("keydown",(function(e){var i=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(e);"up"==i?t({type:"lookUp",normal:[],value:.1,event:e}):"down"==i?t({type:"lookDown",normal:[],value:.1,event:e}):"left"==i?t({type:"lookLeft",normal:[],value:.1,event:e}):"right"==i&&t({type:"lookRight",normal:[],value:.1,event:e})}));var i=null,r=function(r){if(null==i)t({type:"hover",normal:[],value:0,event:r});else{var n=ft(e,r),o=[n.x-i.x,n.y-i.y],a=[o[1],o[0],0];if(0==a[0]&&0==a[1])return;t({type:"rotate",normal:a,value:.01*(Math.abs(n.x-i.x)+Math.abs(n.y-i.y)),event:r}),i=n}};e.addEventListener("mousedown",(function(t){i=ft(e,t)})),e.addEventListener("mouseup",(function(){i=null})),e.addEventListener("mousemove",(function(t){r(t)})),e.addEventListener("touchend",(function(){i=null})),e.addEventListener("touchstart",(function(t){i=ft(e,t)})),e.addEventListener("touchmove",(function(t){r(t.touches[0])}));var n=function(e,i){0!=e&&t({type:"scale",value:e<0?.899:1.101,normal:[],event:i})};e.addEventListener("mousewheel",(function(t){n(t.wheelDelta,t)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){n(-1*t.detail,t)}),!1)},resizeObserver:function(t,e){try{return at||(at=new ResizeObserver((function(t){for(var e=0,i=t;e<i.length;e++){var r=i[e];dt[r.target._resize_observer_]()}}))),gt++,t._resize_observer_=gt,dt[gt]=e,at.observe(t),function(){at&&(at.unobserve(t),delete dt[t._resize_observer_])}}catch(t){e(),console.error("ResizeObserver undefined!")}},throttle:function(t,e){void 0===e&&(e={}),e=D(e,{time:200,keep:!1,opportunity:"end"});var i,r=!1,n=!1,o=!1;return function(){var a=this;if(i=arguments,r)n=!0,o=!0;else{"end"!=e.opportunity&&t.apply(a,i),r=!0;var s=setInterval((function(){n?e.keep||t.apply(a,i):("begin"!=e.opportunity&&(o||"end"==e.opportunity)&&t.apply(a,i),r=!1,o=!1,clearInterval(s)),n=!1}),e.time)}}},TreeLayout:mt,Geometry:bt};return wt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=e();
|
|
11
|
+
var t,e;t=this,e=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,e,i,r,n,o){if(!(t<i))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=i;var s=this.__u*n,a=this.__u*o;return e/=i-t,r/=i-t,this.__MR=[2*e-2*r+s+a,3*r-3*e-2*s-a,s,e],this},t.prototype.use=function(t){if(this.__MR){var e=(t-this.__a)/(this.__b-this.__a),i=e*e;return(e*i*this.__MR[0]+i*this.__MR[1]+e*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),e=function(){function e(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return e.prototype.setP=function(e){this.__HS={x:[],h:[]};var i,r,n=(e[1][1]-e[0][1])/(e[1][0]-e[0][0]);for(this.__HS.x[0]=e[0][0],i=1;i<e.length;i++){if(e[i][0]<=e[i-1][0])throw new Error("The point position should be increamented!");this.__HS.x[i]=e[i][0],r=i<e.length-1?e[i+1][1]>e[i][1]&&e[i-1][1]>e[i][1]||e[i+1][1]<e[i][1]&&e[i-1][1]<e[i][1]||e[i+1][1]==e[i][1]||e[i-1][1]==e[i][1]?0:(e[i+1][1]-e[i-1][1])/(e[i+1][0]-e[i-1][0]):(e[i][1]-e[i-1][1])/(e[i][0]-e[i-1][0]),this.__HS.h[i-1]=new t(.5*(1-this.__t)).setP(e[i-1][0],e[i-1][1],e[i][0],e[i][1],n,r),n=r}return this},e.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},e}(),i=function(t,e){for(var i=[],r=0;r<4;r++)for(var n=0;n<e.length/4;n++)i[4*n+r]=t[r]*e[4*n]+t[r+4]*e[4*n+1]+t[r+8]*e[4*n+2]+t[r+12]*e[4*n+3];return i},r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n=function(){function t(t){void 0===t&&(t=r),this.name="Matrix4",this.__matrix4=t}return t.prototype.setValue=function(t){return void 0===t&&(t=r),this.__matrix4=t,this},t.prototype.move=function(t,e,r,n){return void 0===n&&(n=0),this.__matrix4=i(function(t,e,i,r){void 0===r&&(r=0);var n=Math.sqrt(e*e+i*i+r*r);return[1,0,0,0,0,1,0,0,0,0,1,0,e*t/n,i*t/n,r*t/n,1]}(t,e,r,n),this.__matrix4),this},t.prototype.rotate=function(t,e,r,n,o,s,a){var _=function(t,e,i,r,n,o){if("number"==typeof t&&"number"==typeof e){if("number"!=typeof i?(i=0,r=t,n=e,o=1):"number"==typeof r&&"number"==typeof n&&"number"==typeof o||(r=t,n=e,o=i,t=0,e=0,i=0),t==r&&e==n&&i==o)throw new Error("It's not a legitimate ray!");var s=Math.sqrt((r-t)*(r-t)+(n-e)*(n-e)),a=0!=s?(n-e)/s:1,_=0!=s?(r-t)/s:0,h=(r-t)*_+(n-e)*a,u=o-i,l=Math.sqrt(h*h+u*u),p=0!=l?u/l:1,c=0!=l?h/l:0;return[[a,p*_,_*c,0,-_,a*p,a*c,0,0,-c,p,0,e*_-t*a,i*c-t*_*p-e*a*p,-t*_*c-e*a*c-i*p,1],[a,-_,0,0,p*_,p*a,-c,0,_*c,a*c,p,0,t,e,i,1]]}throw new Error("a1 and b1 is required!")}(e,r,n,o,s,a);return this.__matrix4=i(i(i(_[1],function(t){var e=Math.sin(t),i=Math.cos(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,e,r,n,o,s){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=0),this.__matrix4=i(function(t,e,i,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),[t,0,0,0,0,e,0,0,0,0,i,0,r-r*t,n-n*e,o-o*i,1]}(t,e,r,n,o,s),this.__matrix4),this},t.prototype.multiply=function(t,e){return void 0===e&&(e=!1),this.__matrix4=e?i(this.__matrix4,t):i(t,this.__matrix4),this},t.prototype.use=function(t,e,r,n){return void 0===r&&(r=0),void 0===n&&(n=1),i(this.__matrix4,[t,e,r,n])},t.prototype.value=function(){return this.__matrix4},t}();function o(t,e,i,r,n){var o=Math.cos(i),s=Math.sin(i);return[(r-t)*o-(n-e)*s+t,(r-t)*s+(n-e)*o+e]}var s,a=function(t){var e=t.toString(16);return 1==e.length?"0"+e:e},_=[];function h(t,e,i){void 0===e&&(e=400),void 0===i&&(i=function(){});var r={timer:function(t,e,i){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return _.push({id:n,createTime:new Date,tick:t,duration:e,callback:i}),r.start(),n},start:function(){s||(s=setInterval(r.tick,13))},tick:function(){var t,e,i,n,o,s,a,h=_;for((_=[]).length=0,e=0;e<h.length;e++)t=(o=h[e]).createTime,i=o.tick,s=o.duration,n=o.callback,i(a=(a=(+(new Date).valueOf()-t.valueOf())/s)>1?1:a),a<1&&o.id?_.push(o):n(a);_.length<=0&&r.stop()},stop:function(){s&&(clearInterval(s),s=null)}},n=r.timer((function(e){t(e)}),e,i);return function(){var t;for(t in _)if(_[t].id==n)return void(_[t].id=void 0)}}var u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},u(t,e)};function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function p(t,e,i){if(i||2===arguments.length)for(var r,n=0,o=e.length;n<o;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=["href","title","show","type","role","actuate"];function f(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}var d=function(t,e,i){c.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,i+""):t.setAttribute(e,i+"")},v=d;function g(t,e){d(t,"stroke",e.strokeStyle),d(t,"fill",e.fillStyle),d(t,"stroke-dasharray",e.lineDash.join(","))}function m(t,e){d(t,"fill",e.fillStyle)}function y(t,e){d(t,"stroke",e.strokeStyle),d(t,"fill","none"),d(t,"stroke-dasharray",e.lineDash.join(","))}var E=function(t,e,i,r,n){var o=Math.cos(i),s=Math.sin(i);return[+((r-t)*o-(n-e)*s+t).toFixed(7),+((r-t)*s+(n-e)*o+e).toFixed(7)]};function x(t,e,i,r,n,o,s){e<0&&(t+=e,e*=-1);var a,_=[];a=E(0,0,t,n,0),_[0]=a[0],_[1]=a[1],a=E(0,0,e,a[0],a[1]),_[2]=a[0],_[3]=a[1],a=E(0,0,t,o,0),_[4]=a[0],_[5]=a[1],a=E(0,0,e,a[0],a[1]),_[6]=a[0],_[7]=a[1],s(t,t+e,_[0]+i,_[1]+r,_[4]+i,_[5]+r,_[2]+i,_[3]+r,_[6]+i,_[7]+r,.5*(o-n))}var b=function(t){var e=t.getElementsByTagName("defs");if(e.length<=0){var i=f("defs");return t.appendChild(i),i}return e[0]},w=function(t,e,i,r,n){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");v(t,"dy",{top:.5*e.fontSize,middle:0,bottom:.5*-e.fontSize}[e.textBaseline]),function(t,e){for(var i in e)t.style[i]=e[i]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[e.textAlign],"dominant-baseline":"central","font-size":e.fontSize+"px","font-family":e.fontFamily}),v(t,"x",i),v(t,"y",r),"number"==typeof n&&v(t,"transform","rotate("+(n%=360)+","+i+","+r+")")},T=function(t,e,i,r){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");v(t,"cx",e),v(t,"cy",i),v(t,"r",r)},C=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");v(t,"d",e)},P=function(t,e,i,r,n){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");n<0&&(i-=n*=-1),r<0&&(e-=r*=-1),v(t,"x",e),v(t,"y",i),v(t,"width",r),v(t,"height",n)},R=function(t,e,i,r,n,o,s,a){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(s=s/180*Math.PI,a=a/180*Math.PI,s%=2*Math.PI,n>o){var _=n;n=o,o=_}a>=1.999999*Math.PI||a<=1.999999*-Math.PI?a=1.999999*Math.PI:a%=2*Math.PI,x(s,a,i,r,n,o,(function(i,r,s,a,_,h,u,l,p,c,f){var d=r-i>Math.PI?1:0,g="M"+s+" "+a;f<0&&(f=-f),g+="A"+n+" "+n+" 0 "+d+" 1 "+u+" "+l,"round"==e.arcEndCap?g+="A"+f+" "+f+" 0 1 0 "+p+" "+c:"-round"==e.arcEndCap?g+="A"+f+" "+f+" 0 1 1 "+p+" "+c:g+="L"+p+" "+c,g+="A"+o+" "+o+" 0 "+d+" 0 "+_+" "+h,"round"==e.arcStartCap?g+="A"+f+" "+f+" 0 1 0 "+s+" "+a:"-round"==e.arcStartCap?g+="A"+f+" "+f+" 0 1 1 "+s+" "+a:g+="L"+s+" "+a,"butt"==e.arcStartCap&&(g+="Z"),v(t,"d",g)}))},S={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},A=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[S[t]||t];for(var e in t){var i=S[e]||e;this.__config[i]=t[e]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,e){return e=e||this.__svg,"string"==typeof t&&(t=f(t)),e.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,e){var i=t;if("string"==typeof t&&(i={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==i)throw new Error("Unsupported drawing method:"+t);return this.appendEl(i,e)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return c.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)v(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,m(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,y(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),w(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,g(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),m(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),y(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,r,n,o){return R(this.__useEl,this.__config,t,e,i,r,n,o),g(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return T(this.__useEl,t,e,i),m(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return T(this.__useEl,t,e,i),y(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return T(this.__useEl,t,e,i),g(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),m(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),y(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,r){return P(this.__useEl,t,e,i,r),g(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return C(this.__useEl,this.__path),m(this.__useEl,this.__config),this},t.prototype.stroke=function(){return C(this.__useEl,this.__path),y(this.__useEl,this.__config),this},t.prototype.full=function(){return C(this.__useEl,this.__path),g(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,r,n){var s=o(t,e,r/180*Math.PI,t+i,e),a=o(t,e,(r+n)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+s[0]+","+s[1]:s[0]==this.__currentPosition[0]&&s[1]==this.__currentPosition[1]||(this.__path+="L"+s[0]+","+s[1]),this.__path+="A"+i+","+i+" 0 "+(n>180||n<-180?1:0)+","+(n>0?1:0)+" "+a[0]+","+a[1],this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__path+="Q"+t+" "+e+","+i+" "+r,this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__path+="C"+t+" "+e+","+i+" "+r+","+n+" "+o,this},t.prototype.bind=function(t,e){return this.__useEl.addEventListener(t,(function(t){e.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=b(t),s="vislite-lg-"+(new Date).valueOf()+"-"+Math.random(),a=f("linearGradient");o.appendChild(a),v(a,"id",s),v(a,"x1",e+"%"),v(a,"y1",i+"%"),v(a,"x2",r+"%"),v(a,"y2",n+"%");var _={value:function(){return"url(#"+s+")"},setColor:function(t,e){var i=f("stop");return a.appendChild(i),v(i,"offset",100*t+"%"),v(i,"style","stop-color:"+e+";"),_}};return _}(this.__svg,t,e,i,r)},t.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=b(t),o="vislite-rg-"+(new Date).valueOf()+"-"+Math.random(),s=f("radialGradient");n.appendChild(s),v(s,"id",o),v(s,"cx",e+"%"),v(s,"cy",i+"%"),v(s,"r",r+"%");var a={value:function(){return"url(#"+o+")"},setColor:function(t,e){var i=f("stop");return s.appendChild(i),v(i,"offset",100*t+"%"),v(i,"style","stop-color:"+e+";"),a}};return a}(this.__svg,t,e,i)},t}(),M=function(t){function e(e){if(!e)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=e.clientWidth,r=e.clientHeight,n=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.appendChild(n),n.setAttribute("width",i+""),n.setAttribute("height",r+""),n.setAttribute("viewBox","0 0 "+i+" "+r),t.call(this,n)||this}return l(e,t),e}(A),L=function(t,e,i,r,n){return t.beginPath(),t.translate(i,r),t.rotate(n),t.font=e.fontStyle+" "+e.fontWeight+" "+e.fontSize+"px "+e.fontFamily,t},I=function(t,e,i,r,n,o,s,a){if(n>o){var _=n;n=o,o=_}return s%=2*Math.PI,a>=1.999999*Math.PI||a<=1.999999*-Math.PI?a=2*Math.PI:a%=2*Math.PI,x(s,a,i,r,n,o,(function(s,a,_,h,u,l,p,c,f,d,v){v<0&&(v=-v),t.beginPath(),t.moveTo(_,h),t.arc(i,r,n,s,a,!1),"round"==e.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,a-Math.PI,a,!0):"-round"==e.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,a-Math.PI,a,!1):t.lineTo(f,d),t.arc(i,r,o,a,s,!0),"round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,s,s-Math.PI,!0):"-round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,s,s-Math.PI,!1):t.lineTo(_,h)})),"butt"==e.arcStartCap&&t.closePath(),t},k=function(t,e,i,r){return t.beginPath(),t.moveTo(e+r,i),t.arc(e,i,r,0,2*Math.PI),t},z=function(t,e,i,r,n){return t.beginPath(),t.rect(e,i,r,n),t};function U(t,e,i,r,n){for(var o=0,s="",a=0;a<e.length;a++)t.measureText(s+e[a]).width>i||/\n$/.test(s)?(n(s,((o+=1)-.5)*r),s=e[a]):a==e.length-1?(o+=1,n(s+e[a],(o-.5)*r)):s+=e[a];return o*r}var N=function(){function t(t,e,i,r){void 0===e&&(e={}),void 0===r&&(r=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",e),this.__region=i,this.__isPainter=r,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,e){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,e),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(e);else if(t in this.__specialConfig)"fontSize"==t&&(e=Math.round(e)),this.__specialConfig[t]=e;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=e}return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,e,i,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,e,i,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,e,i,r,n,o){var s=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var a=0;if(this.__region&&(a=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){s.painter.fillText(t,0,e)}));return this.painter.restore(),_},t.prototype.strokeTexts=function(t,e,i,r,n,o){var s=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var a=0;if(this.__region&&(a=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){s.painter.strokeText(t,0,e)}));return this.painter.restore(),_},t.prototype.fullTexts=function(t,e,i,r,n,o){var s=this;void 0===n&&(n=1.2),void 0===o&&(o=0);var a=0;if(this.__region&&(a=this.__region.fillTexts(t,e,i,r,n)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),L(this.painter,this.__specialConfig,e,i,o);var _=U(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){s.painter.fillText(t,0,e),s.painter.strokeText(t,0,e)}));return this.painter.restore(),_},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,e){return this.__region&&this.__region.moveTo(t,e),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.lineTo=function(t,e){return this.__region&&this.__region.lineTo(t,e),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.arc=function(t,e,i,r,n){return this.__region&&this.__region.arc(t,e,i,r,n),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,e,i,r,r+n,n<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__region&&this.__region.quadraticCurveTo(t,e,i,r),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,e,i,r),this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__region&&this.__region.bezierCurveTo(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,e,i,r,n,o),this},t.prototype.clearRect=function(t,e,i,r){return this.__region&&this.__region.clearRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,e,i,r),this},t.prototype.fillArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fillArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,e,i,r,n,o).fill(),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return this.__region&&this.__region.strokeArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,e,i,r,n,o).stroke(),this},t.prototype.fullArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fullArc(t,e,i,r,n,o),this.__isPainter&&this.__onlyRegion||(I(this.painter,this.__specialConfig,t,e,i,r,n,o),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,e,i){return this.__region&&this.__region.fillCircle(t,e,i),this.__isPainter&&this.__onlyRegion||k(this.painter,t,e,i).fill(),this},t.prototype.strokeCircle=function(t,e,i){return this.__region&&this.__region.strokeCircle(t,e,i),this.__isPainter&&this.__onlyRegion||k(this.painter,t,e,i).stroke(),this},t.prototype.fullCircle=function(t,e,i){return this.__region&&this.__region.fullCircle(t,e,i),this.__isPainter&&this.__onlyRegion||(k(this.painter,t,e,i),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,e,i,r){return this.__region&&this.__region.fillRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||z(this.painter,t,e,i,r).fill(),this},t.prototype.strokeRect=function(t,e,i,r){return this.__region&&this.__region.strokeRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||z(this.painter,t,e,i,r).stroke(),this},t.prototype.fullRect=function(t,e,i,r){return this.__region&&this.__region.fullRect(t,e,i,r),this.__isPainter&&this.__onlyRegion||(z(this.painter,t,e,i,r),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t}();function O(t,e,i,r){for(var n=[],o=0;o<r;o++)n[o]=t;return function(){for(var o=0;o<r;o++){if(n[o]+i<e){n[o]=+(n[o]+i).toFixed(7);break}o<r-1&&(n[o]=t)}return n}}var B={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},F=function(t){function e(e,i,r){void 0===r&&(r={});var n=t.call(this,e,r,i?new N(i,{willReadFrequently:!0}):void 0,!0)||this;return n.name="Canvas",n.__regionList={},n.__regionAssemble=O(0,255,10,3),n.setRegion(""),n}return l(e,t),e.prototype.config=function(t){for(var e in t){var i=B[e]||e;this.useConfig(i,t[e])}return this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var e=this.__regionAssemble();this.__regionList[t]="rgb("+e[0]+","+e[1]+","+e[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,e){var i=this;return new Promise((function(r){var n=i.__region?i.__region.painter.getImageData(t-.5,e-.5,1,1):{data:[0,0,0,0]},o=n.data,s=function(){if(i.__region)for(var t in i.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==i.__regionList[t]){r(t);break}r("")};o?s():n.then((function(t){o=t,s()}))}))},e.prototype.textWidth=function(t){this.painter.save(),L(this.painter,this.__specialConfig,0,0,0);var e=this.painter.measureText(t+"").width;return this.painter.restore(),e},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.getInfo=function(){return{width:this.painter.canvas.width,height:this.painter.canvas.height}},e.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=t.createLinearGradient(e,i,r,n),s={value:function(){return o},setColor:function(t,e){return o.addColorStop(t,e),s}};return s}(this.painter,t,e,i,r)},e.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=t.createRadialGradient(e,i,0,e,i,r),o={value:function(){return n},setColor:function(t,e){return n.addColorStop(t,e),o}};return o}(this.painter,t,e,i)},e.prototype.getColor=function(t,e){var i=this.painter.getImageData(t-.5,e-.5,1,1).data;return"rgba("+i[0]+","+i[1]+","+i[2]+","+i[3]+")"},e}(N);function G(t,e){for(var i in t)e[i]=t[i];return e}var D=function(t){function e(e,i){void 0===i&&(i={});var r=this;if(!e)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");i=G(i,{region:!0,willReadFrequently:!1});var n,o=e.clientWidth,s=e.clientHeight,a=null,_=e;_._vislite_canvas_?(n=_._vislite_canvas_[0],a=_._vislite_canvas_[1]):(n=document.createElement("canvas"),e.appendChild(n),i.region&&(a=document.createElement("canvas")),_._vislite_canvas_=[n,a],e.setAttribute("vislite","Canvas"));for(var h=0,u=[n,a];h<u.length;h++){var l=u[h];l&&(l.style.width=o+"px",l.setAttribute("width",o+""),l.style.height=s+"px",l.setAttribute("height",s+""))}return(r=t.call(this,n,a,{willReadFrequently:i.willReadFrequently})||this).__canvas=n,r}return l(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(e){e(t.__canvas.toDataURL())}))},e}(F);function H(t,e,i){void 0===i&&(i={});for(var r=["experimental-webgl","webkit-3d","moz-webgl"],n=t.getContext("webgl",i),o=0;o<r.length;o++){try{n=t.getContext(r[o],i)}catch(t){}if(n)break}if(!n)throw new Error("Non canvas or browser does not support webgl.");var s=n.canvas.width,a=n.canvas.height,_=s*e,h=a*e;return n.viewport(.5*(s-_),.5*(a-h),_,h),n.depthFunc(n.LEQUAL),n.enable(n.DEPTH_TEST),n}function q(t){var e=t.drawingBufferWidth,i=t.drawingBufferHeight,r=new Uint8Array(4*e*i);return t.readPixels(0,0,e,i,t.RGBA,t.UNSIGNED_BYTE,r),function(t,n){return"rgba("+r[4*((n=i-n)*e+t)]+","+r[4*(n*e+t)+1]+","+r[4*(n*e+t)+2]+","+r[4*(n*e+t)+3]+")"}}var W=function(){function t(t,e){void 0===e&&(e=!1),this.__painter=t,this.__isElement=e,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,e,i,r){var n=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(n,e,r)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,e,i,r){return void 0===r&&(r=0),function(t,e,i,r,n,o,s){t.vertexAttribPointer(e,i,r,s,n,o),t.enableVertexAttribArray(e)}(this.__painter,t,e,this.__painter.FLOAT,i*this.__fsize,r*this.__fsize,!1),this},t}(),V=function(){function t(t,e,i){void 0===i&&(i=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[e],this.__texture=function(t,e,i){var r=t.createTexture();return t.activeTexture(t["TEXTURE"+i]),t.bindTexture(e,r),r}(t,this.__type,i),t.texParameteri(this.__type,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(this.__type,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}return t.prototype.useImage=function(t){return function(t,e,i,r,n,o){t.texImage2D(e,i,r,r,n,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,e,i){return function(t,e,i,r,n,o,s,a,_){for(var h,u=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],l=0;l<u.length;l++)o[l]&&(h=u[l],t.texImage2D(h,i,r,s,a,0,r,n,null),t.bindTexture(e,_),t.texImage2D(h,i,r,r,n,o[l]));t.generateMipmap(e)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,e,i,this.__texture),this},t}(),X={};function Y(t,e,i){var r=t+"-"+i;return X[r]||(X[r]=new V(e,i)),X[r]}var j=function(t,e,i){var r=t.createShader(e);if(null==r)throw new Error("Unable to create shader!");if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(r));return r},$=function(){function t(t){this.program=null,this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,e){return this.program=function(t,e,i){var r=j(t,t.VERTEX_SHADER,e),n=j(t,t.FRAGMENT_SHADER,i),o=t.createProgram();if(t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,e),this},t}(),Z="attribute vec4 a_position;\nuniform mat4 u_matrix;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\n temp.z = -1.0 * temp.z;\n\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\n float dist = 4.0;\n\n // 使用投影直接计算\n // 为保证纹理和相对位置正确\n // x、y、z的改变满足线性变换\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n}",J="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_color = a_color;\n}",Q="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec2 a_textcoord;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_textcoord = a_textcoord;\n}",K="attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_normal;\nvarying vec3 v_normal;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_normal = normalize(vec3(a_normal));\n}",tt="precision mediump float;\n\nuniform vec4 u_color;\n\nvoid main()\n{\n gl_FragColor = u_color;\n}",et="precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}",it="precision mediump float;\n\nuniform sampler2D u_sampler;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n gl_FragColor = texture2D(u_sampler, v_textcoord);\n}",rt="precision mediump float;\n\nvarying vec3 v_normal;\nuniform samplerCube u_texture;\n\nvoid main()\n{\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\n}",nt={};function ot(t,e,i,r,n){var o,s,a,_,h,u,l,p,c,f,d,v,g,m,y,E,x,b,w,T,C,P,R,S,A=function(t,e,i){var r,n,o=t+(i.material.color?"1":"0")+(i.material.colors?"1":"0")+(i.material.image?"1":"0")+(i.material.cube?"1":"0");if(nt[o])return nt[o].use();var s=(r={},r[t+"1000"]=Z,r[t+"0100"]=J,r[t+"0010"]=Q,r[t+"0001"]=K,r)[o].replace(/uniform +mat4 +u_matrix;/,"\n uniform mat4 u_matrix_world;\n uniform mat4 u_matrix_mesh;\n uniform mat4 u_matrix_proporion;").replace(/u_matrix +\* +a_position/,"u_matrix_proporion * u_matrix_world * u_matrix_mesh * a_position"),a=(n={},n[t+"1000"]=tt,n[t+"0100"]=et,n[t+"0010"]=it,n[t+"0001"]=rt,n)[o],_=new $(e).compile(s,a).use();return nt[o]=_,_}(t,e,i);if(new W(e).use().write(i.geometry.attributes.position.array).divide(e.getAttribLocation(A.program,"a_position"),i.geometry.attributes.position.itemSize,i.geometry.attributes.position.itemSize,0),e.uniformMatrix4fv(e.getUniformLocation(A.program,"u_matrix_world"),!1,n.matrix),e.uniformMatrix4fv(e.getUniformLocation(A.program,"u_matrix_proporion"),!1,n.proporion),e.uniformMatrix4fv(e.getUniformLocation(A.program,"u_matrix_mesh"),!1,r.matrix),i.geometry.attributes.normal&&new W(e).use().write(i.geometry.attributes.normal.array).divide(e.getAttribLocation(A.program,"a_normal"),i.geometry.attributes.normal.itemSize,i.geometry.attributes.normal.itemSize,0),"color"in i.material&&e.uniform4f(e.getUniformLocation(A.program,"u_color"),null===(o=i.material.color)||void 0===o?void 0:o.r,null===(s=i.material.color)||void 0===s?void 0:s.g,null===(a=i.material.color)||void 0===a?void 0:a.b,null===(_=i.material.color)||void 0===_?void 0:_.alpha),"colors"in i.material)new W(e).use().write(null===(h=i.material.colors)||void 0===h?void 0:h.array).divide(e.getAttribLocation(A.program,"a_color"),null===(u=i.material.colors)||void 0===u?void 0:u.itemSize,null===(l=i.material.colors)||void 0===l?void 0:l.itemSize,0);else if("cube"in i.material){var M=(null===(c=null===(p=i.material.cube)||void 0===p?void 0:p.right)||void 0===c?void 0:c.image.value).width;e.uniform1i(e.getUniformLocation(A.program,"u_texture"),0),Y(t,e,"cube").useCube([null===(d=null===(f=i.material.cube)||void 0===f?void 0:f.right)||void 0===d?void 0:d.image.value,null===(g=null===(v=i.material.cube)||void 0===v?void 0:v.left)||void 0===g?void 0:g.image.value,null===(y=null===(m=i.material.cube)||void 0===m?void 0:m.top)||void 0===y?void 0:y.image.value,null===(x=null===(E=i.material.cube)||void 0===E?void 0:E.bottom)||void 0===x?void 0:x.image.value,null===(w=null===(b=i.material.cube)||void 0===b?void 0:b.far)||void 0===w?void 0:w.image.value,null===(C=null===(T=i.material.cube)||void 0===T?void 0:T.near)||void 0===C?void 0:C.image.value],M,M)}else"image"in i.material&&(e.uniform1i(e.getUniformLocation(A.program,"u_sampler"),0),new W(e).use().write(null===(P=i.geometry.attributes.uv)||void 0===P?void 0:P.array).divide(e.getAttribLocation(A.program,"a_textcoord"),null===(R=i.geometry.attributes.uv)||void 0===R?void 0:R.itemSize,2,0),Y(t,e,"2d").useImage(null===(S=i.material.image)||void 0===S?void 0:S.value));i.geometry.index?(new W(e,!0).use().write(i.geometry.index.array),e.drawElements(e[i.geometry.type],i.geometry.index.count,e.UNSIGNED_BYTE,0)):e.drawArrays(e[i.geometry.type],0,i.geometry.attributes.position.count)}var st,at=!1,_t=function(){function t(t,e){this.name="WebGL",this.__getColor=function(t,e){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=O(0,1,.2,3),this.__regionName="",this.__regionColor=[0,0,0,1],this.__scene={children:[],matrix:new n([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,10])},this.__unique=(new Date).valueOf(),this.painter=H(t,10),e&&(this.__regionPainter=H(e,10,{}));var i=this.painter.canvas.width/this.painter.canvas.height,r=1,o=1;i>1?r=1/i:o=i;var s=Math.min(r,o);this.__proporion=[r,0,0,0,0,o,0,0,0,0,s,0,0,0,0,1]}return t.prototype.matrix=function(t){return new n(t)},t.prototype.getMatrix=function(){return this.__scene.matrix},t.prototype.getObject3D=function(){return this.__scene.children},t.prototype.review=function(t){void 0===t&&(t=!1),t?this.__regionPainter&&(this.__regionPainter.clearColor(1,1,1,1),this.__regionPainter.clear(this.__regionPainter.COLOR_BUFFER_BIT)):(this.painter.clearColor(1,1,1,1),this.painter.clear(this.painter.COLOR_BUFFER_BIT));for(var e=0;e<this.__scene.children.length;e++)this.draw(this.__scene.children[e],t);return this},t.prototype.draw=function(t,e){var i;void 0===e&&(e=!1),e||(at=!0);var r={matrix:null===(i=t.matrix)||void 0===i?void 0:i.value()},n={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var o=0;o<t.mesh.length;o++)e?this.__regionPainter&&(ot("painter"+this.__unique,this.__regionPainter,{geometry:t.mesh[o].geometry,material:{color:{r:this.__regionColor[0],g:this.__regionColor[1],b:this.__regionColor[2],alpha:this.__regionColor[3]}}},r,n),this.__getColor=q(this.__regionPainter)):ot("region"+this.__unique,this.painter,t.mesh[o],r,n)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new n),"region"in t||(t.region="");for(var e=0;e<t.mesh.length;e++){var i=t.mesh[e];i.geometry.attributes.normal&&Array.isArray(i.geometry.attributes.normal.array)&&(i.geometry.attributes.normal.array=new Float32Array(i.geometry.attributes.normal.array)),i.geometry.attributes.position&&Array.isArray(i.geometry.attributes.position.array)&&(i.geometry.attributes.position.array=new Float32Array(i.geometry.attributes.position.array)),i.geometry.attributes.uv&&Array.isArray(i.geometry.attributes.uv.array)&&(i.geometry.attributes.uv.array=new Float32Array(i.geometry.attributes.uv.array)),i.geometry.index&&Array.isArray(i.geometry.index.array)&&(i.geometry.index.array=new Uint8Array(i.geometry.index.array)),i.material.colors&&Array.isArray(i.material.colors.array)&&(i.material.colors.array=new Float32Array(i.material.colors.array))}this.__scene.children.push(t),this.draw(t)},t.prototype.setRegion=function(t){return this.__regionName=t+"",t?(null==this.__regionList[t]&&(this.__regionList[t]=p(p([],this.__regionAssemble(),!0),[1],!1)),this.__regionColor=this.__regionList[t]):this.__regionColor=[0,0,0,1],this},t.prototype.getRegion=function(t,e){var i=this;return at&&this.review(!0),at=!1,new Promise((function(r){var n=i.__getColor(t,e);for(var o in i.__regionList){var s=i.__regionList[o];if("rgba("+255*s[0]+","+255*s[1]+","+255*s[2]+","+255*s[3]+")"==n){r(o);break}}r("")}))},t}(),ht=function(t){function e(e,i){if(void 0===i&&(i={}),!e)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");i=G(i,{region:!0});var r,n=e.clientWidth,o=e.clientHeight,s=null,a=e;a._vislite_canvas_?(r=a._vislite_canvas_[0],s=a._vislite_canvas_[1]):(i.region&&(s=document.createElement("canvas"),e.appendChild(s),s.style.position="absolute",s.style.zIndex="-1",s.style.opacity="0"),r=document.createElement("canvas"),e.appendChild(r),a._vislite_canvas_=[r,s],e.setAttribute("vislite","WebGL"));for(var _=0,h=[r,s];_<h.length;_++){var u=h[_];u&&(u.style.width=n+"px",u.setAttribute("width",n+""),u.style.height=o+"px",u.setAttribute("height",o+""))}return t.call(this,r,s)||this}return l(e,t),e}(_t),ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.compile=function(e,i){return i?t.prototype.compile.call(this,e,i):t.prototype.compile.call(this,{color:Z,colors:J,image:Q,cube:K}[e],{color:tt,colors:et,image:it,cube:rt}[e]),this},e}($),lt=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e*n-i*o,e*o+i*n,r]},pt=function(){function t(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return t.prototype.use=function(t,e){var i,r,n,o,s,a,_=(i=(360-e)/180*Math.PI,r=100*this.__scale,n=0,o=0,s=Math.cos(i),a=Math.sin(i),[o*a+r*s,n,o*s-r*a]);return _=lt(t/180*Math.PI,_[0],_[1],_[2]),_=lt((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e,i*n-r*o,i*o+r*n]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),ct=function(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Mercator";var i=100*t*Math.PI/180,r=i*e[0],n=-1*i*e[1];this.use=function(t,e){return[.8*(i*t-r),-1*i*e-n,0]}},ft=function(t,e){var i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}},dt={},vt=0,gt=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=G(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,i){var r=function(t,e){var i,r,n={},o=e.root(t);i=r=e.id(o),n[i]={data:o,pid:null,id:i,isOpen:!0,show:!0,children:[]};var s=1;return function r(o,a){var _=e.children(o,t);s+=_?_.length:0;for(var h=0;_&&h<_.length;h++)i=e.id(_[h]),n[a].children.push(i),n[i]={data:_[h],pid:a,id:i,isOpen:!0,show:!0,children:[]},r(_[h],i)}(o,i),{rid:r,value:n,num:s}}(t,e),n=r.value,o=r.rid;if(1==r.num)return n[o].left=.5,n[o].top=.5,n[o].show=!0,{deep:1,node:n,root:o,size:1};var s=[],a=0,_=0;for(var h in i[o]?(n[o].left=.5,n[o].top=.5,n[o].show=!0,a=1):function t(e,r){r>_&&(_=r);var o=0;if(!i[e.id])for(o=0;o<e.children.length;o++)t(n[e.children[o]],r+1);if(n[e.id].left=r+.5,0==o?(null==s[r]&&(s[r]=-.5),null==s[r-1]&&(s[r-1]=-.5),n[e.id].top=s[r]+1,s[r]+1+.5*(n[e.pid].children.length-1)-1<s[r-1]&&(n[e.id].top=s[r-1]+1-.5*(n[e.pid].children.length-1))):n[e.id].top=.5*(n[e.children[0]].top+n[e.children[o-1]].top),n[e.id].top<=s[r])var h=s[r]+1-n[e.id].top((function t(e,i){n[e].top+=h,s[i]<n[e].top&&(s[i]=n[e].top);for(var r=0;r<n[e].children.length;r++)t(n[e].children[r],i+1)}))(e.id,r);s[r]=n[e.id].top,n[e.id].top+.5>a&&(a=n[e.id].top+.5)}(n[o],0),i)i[h]&&(n[h].isOpen=!1,function t(e,i,r){for(var o=0;o<n[e].children.length;o++)n[n[e].children[o]].left=i,n[n[e].children[o]].top=r,n[n[e].children[o]].show=!1,t(n[e].children[o],i,r)}(h,n[h].left,n[h].top));return{node:n,root:o,size:a,deep:_+1}}(t,this.__config,e)},t}(),mt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="TreeLayout",e.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},e.__noOpens={},e}return l(e,t),e.prototype.setOption=function(t){return G(t,this.__option),this},e.prototype.use=function(e,i){void 0===i&&(i={});var r=t.prototype.use.call(this,e,i);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var n in r.node)if(!r.node[n].show){var s=0,a=n;do{a=r.node[a].pid,s++}while(!r.node[a].show);r.node[n].left+=this.__option.offsetX*s,r.node[n].top+=this.__option.offsetY*s}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var _=this.__option.height/r.size,h=this.__option.width/(r.deep-1),u=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var n in r.node)1==r.deep?(r.node[n].left=this.__option.x+.5*this.__option.width*l,r.node[n].top=this.__option.y):(r.node[n].left=this.__option.x+(r.node[n].left-.5)*h*l,r.node[n].top=r.node[n].top*_+u)}else if("TB"==this.__option.direction||"BT"==this.__option.direction)for(var n in _=this.__option.width/r.size,h=this.__option.height/(r.deep-1),u=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1,r.node)if(1==r.deep)r.node[n].left=this.__option.x,r.node[n].top=this.__option.y+.5*this.__option.height*l;else{var p=r.node[n].left;r.node[n].left=r.node[n].top*_+u,r.node[n].top=this.__option.y+(p-.5)*h*l}}else if("circle"==this.__option.type){var c=this.__option.x,f=this.__option.y,d=2*Math.PI/r.size,v=this.__option.radius/(r.deep-1);for(var n in r.node)if(.5==r.node[n].left)r.node[n].left=c,r.node[n].top=f;else{var g=o(c,f,d*r.node[n].top,c+(r.node[n].left-.5)*v,f);r.node[n].left=g[0],r.node[n].top=g[1]}}return r},e.prototype.bind=function(t,e,i){return void 0===i&&(i={}),this.__rback=e,this.__oralTree=t,this.__noOpens=i,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},e.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},e.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),i=JSON.parse(JSON.stringify(e));h((function(r){if(t.__preTree)for(var n in i.node)(e.node[n].show||t.__preTree.node[n].show)&&(i.node[n].show=!0,i.node[n].left=t.__preTree.node[n].left+(e.node[n].left-t.__preTree.node[n].left)*r,i.node[n].top=t.__preTree.node[n].top+(e.node[n].top-t.__preTree.node[n].top)*r);t.__rback(i)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)}))},e.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},e.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},e.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},e}(gt),yt=function(t,e){var i=Math.ceil(2*Math.PI/Math.asin(t/e)*2);return isNaN(i)||i<12?12:i};function Et(t,e,i,r,n,s,a){var _,h;if(4==s){var u=n/1.414;_=e+u,h=r+u}else _=e+n,h=r;for(var l=[_,h],p=[],c=2*Math.PI/s,f=0;f<s;f++)p.push(e,i,r),t&&p.push(0,a,0),p.push(l[0],i,l[1]),t&&p.push(0,a,0),l=o(e,r,c*(f+1),_,h),p.push(l[0],i,l[1]),t&&p.push(0,a,0);return p}function xt(t,e,i,r,n,s,a){var _,h=[e,i+n,r],u=2*Math.PI/s;t&&h.push(0,n,0);for(var l=function(){h.push.apply(h,h.slice(h.length-(t?12:6)))},p=1;p<.5*s;p++){_=o(e,i,u*p,e,i+n),p>1&&l();var c=o(e,r,u*a,_[0],r);h.push(c[0],_[1],c[1]),t&&h.push(c[0]-e,_[1]-i,c[1]-r),p>1&&l();var f=o(e,r,u*(a+1),_[0],r);h.push(f[0],_[1],f[1]),t&&h.push(f[0]-e,f[1]-i,f[1]-r)}return l(),h.push(e,i-n,r),t&&h.push(0,-n,0),h}var bt=function(){function t(t){void 0===t&&(t={}),this.name="Geometry",this.__option=G(t,{precision:.1,normal:!1})}return t.prototype.config=function(t){for(var e in t)this.__option[e]=t[e];return this},t.prototype.cylinder=function(t,e,i,r,n,o,s){var a=yt(this.__option.precision,r);return 5==arguments.length?this.prism(t,e,i,r,n,a):this.prism(t,e,i,r,n,o,s,a)},t.prototype.prism=function(t,e,i,r,n,s,a,_){var h,u,l,c,f=null;6==arguments.length?(c=n,_=s):(c=Math.sqrt((n-t)*(n-t)+(s-e)*(s-e)+(a-i)*(a-i)),f=function(t,e,i,r,n,o){return function(s,a,_,h){var u,l,p,c=s-(h?0:t),f=a-(h?0:e),d=_-(h?0:i),v=r-t,g=n-e,m=o-i,y=Math.sqrt(v*v+m*m),E=m*(u=m/y)+v*(l=v/y),x=Math.sqrt(g*g+E*E);return u=E/x,f=(p=[f,c])[0]*(l=g/x)-p[1]*u,c=p[0]*u+p[1]*l,u=m/y,c=(p=[c,d])[0]*(l=v/y)-p[1]*u,d=p[0]*u+p[1]*l,[c+(h?0:t),f+(h?0:e),d+(h?0:i)]}}(t,e,i,n,s,a));var d=[{name:"bottom",points:[],length:0,method:"TRIANGLES"},{name:"top",points:[],length:0,method:"TRIANGLES"},{name:"side",points:[],length:0,method:"TRIANGLES"}];(h=d[0].points).push.apply(h,Et(this.__option.normal,t,e,i,r,_,c>0?-1:1)),(u=d[1].points).push.apply(u,Et(this.__option.normal,t,e+c,i,r,_,c>0?1:-1)),(l=d[2].points).push.apply(l,function(t,e,i,r,n,s,a){var _,h=[];_=4==a?o(e,r,.25*Math.PI,e-n,r):[e+n,r];for(var u,l=2*Math.PI/a,c=2*Math.PI/(2*a),f=[],d=0;d<a;d++){if(u=o.apply(void 0,p([e,r,l],_,!1)),t){var v=o.apply(void 0,p([e,r,c],_,!1));f=[v[0],0,v[1]]}h.push.apply(h,p([_[0],i,_[1]],f,!1)),h.push.apply(h,p([_[0],i+s,_[1]],f,!1)),h.push.apply(h,p([u[0],i+s,u[1]],f,!1)),h.push.apply(h,p([_[0],i,_[1]],f,!1)),h.push.apply(h,p([u[0],i,u[1]],f,!1)),h.push.apply(h,p([u[0],i+s,u[1]],f,!1)),_=u}return h}(this.__option.normal,t,e,i,r,c,_));for(var v=0;v<d.length;v++){if(f){for(var g=[],m=!1,y=0;y<d[v].points.length;y+=3)g.push.apply(g,f(d[v].points[y],d[v].points[y+1],d[v].points[y+2],this.__option.normal&&m)),m=!m;d[v].points=g}d[v].length=d[v].points.length/(this.__option.normal?6:3)}return d},t.prototype.sphere=function(t,e,i,r){for(var n,o=yt(this.__option.precision,r),s=[{name:"surface",points:[],length:0,method:"TRIANGLES"}],a=0;a<o;a++)(n=s[0].points).push.apply(n,xt(this.__option.normal,t,e,i,r,o,a));return s[0].length=s[0].points.length/(this.__option.normal?6:3),s},t}(),wt={Cardinal:e,Hermite:t,Matrix4:n,rotate:o,move:function(t,e,i,r,n){var o=Math.sqrt(t*t+e*e);return[t*i/o+r,e*i/o+n]},scale:function(t,e,i,r,n){return[i*(r-t)+t,i*(n-e)+e]},getLoopColors:function(t,e){void 0===e&&(e=1);var i=["rgba(84,112,198,"+e+")","rgba(145,204,117,"+e+")","rgba(250,200,88,"+e+")","rgba(238,102,102,"+e+")","rgba(115,192,222,"+e+")","rgba(59,162,114,"+e+")","rgba(252,132,82,"+e+")","rgba(154,96,180,"+e+")","rgba(234,124,204,"+e+")"],r=[];if(t<=i.length)return i;if(t%i.length==0)for(var n=0;n<t/i.length;n++)r=r.concat(i);else{for(var o=1;o<t/i.length;o++)r=r.concat(i);if(t%i.length==1)r=r.concat(i[4]);else for(var s=0;s<t%i.length;s++)r=r.concat(i[s])}return r},formatColor:function(t,e){var i=document.getElementsByTagName("head")[0];i.style.color=t;for(var r=(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(i,null):i.currentStyle).getPropertyValue("color").replace(/rgba?\(/,"").replace(")","").split(","),n=0;n<r.length;n++)r[n]=+r[n];switch(r.push(1),e){case"3d":return[r[0]/255,r[1]/255,r[2]/255,r[3]];case"rgba":return"rgba(".concat(r[0],", ").concat(r[1],", ").concat(r[2],", ").concat(r[3],")");case"rgb":return"rgb(".concat(r[0],", ").concat(r[1],", ").concat(r[2],")");case"hexAlpha":return"#".concat(a(r[0])).concat(a(r[1])).concat(a(r[2])).concat(a(+(255*r[3]).toFixed(0)));case"hex":return"#".concat(a(r[0])).concat(a(r[1])).concat(a(r[2]))}throw new Error("Unsupported color format: "+e)},animation:h,ruler:function(t,e,i,r){if(t<e){var n=e;e=t,t=n}else if(t==e)return[t];var o=function(t){for(var e=t<100&&t>-100?10:.1,i=-1,r=t;10==e?r>=-100&&r<=100:r<=-100||r>=100;)i+=1,r*=e;if(10==e)return Math.pow(10,i);for(var n="0.",o=1;o<i;o++)n+="0";return+(n+"1")}(t-e),s=Math.ceil((t-e)*o/i),a=function(i){var r=({3:2,4:5,6:5,7:5,8:10,9:10,11:10,12:10,13:15,14:15,16:15,17:15,18:20,19:20,21:20,22:20,23:25,24:25,26:25,27:25}[s+i]||s+i)/o,n=Math.floor(e/r)*r,a=[];a.push(n);for(var _=1;a[a.length-1]<t;_++)a.push(n+r*_);return a},_=a(0),h=function(){for(var t=[],i=_[_.length-1]-(null==r?void 0:r.max),n=0;n<_.length;n++)n+1<_.length&&_[n+1]-i<e||t.push(_[n]-i);return t},u=function(){for(var e=[],i=_[0]-(null==r?void 0:r.min),n=0;n<_.length&&(e[n]=_[n]-i,!(t<=e[n]));n++);return e};if(r){if("max"in r&&"min"in r&&r.max>=t&&r.min<=e){var l=function(){if(_[0]>=r.min&&_[_.length-1]<=r.max)return!0;var t=h();if(t[0]>=r.min&&t[t.length-1]<=r.max)return _=t,!0;var e=u();return e[0]>=r.min&&e[t.length-1]<=r.max?(_=e,!0):void 0};if(l())return _;for(var p=1;p<100;p++){if(_=a(p),l())return _;if(_=a(-p),l())return _}}"max"in r&&r.max>=t?r.max<_[_.length-1]&&(_=h()):"min"in r&&r.min<=e&&r.min>_[0]&&(_=u())}for(var c=0;c<_.length;c++){var f=_[c]+"";/\./.test(f)&&(/9{7,}$/.test(f)?(f=f.replace(/9{7,}$/,""),_[c]=+(f.substring(0,f.length-1)+(+f[f.length-1]+1))):/0{7,}\d$/.test(f)&&(_[c]=+f.replace(/0{7,}\d$/,"")))}return _},SVG:M,Canvas:D,WebGL:ht,getWebGLContext:function(t,e){if(void 0===e&&(e=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var i,r=t.clientWidth,n=t.clientHeight,o=t;return o._vislite_canvas_?i=o._vislite_canvas_:(i=document.createElement("canvas"),t.appendChild(i),o._vislite_canvas_=i,t.setAttribute("vislite","WebGL")),i.style.width=r+"px",i.setAttribute("width",r+""),i.style.height=n+"px",i.setAttribute("height",n+""),H(i,e)},Shader:ut,Texture:V,Buffer:W,Eoap:pt,Mercator:ct,viewHandler:function(t){var e=document.getElementsByTagName("body")[0];e.addEventListener("keydown",(function(e){var i=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(e);"up"==i?t({type:"lookUp",normal:[],value:.1,event:e}):"down"==i?t({type:"lookDown",normal:[],value:.1,event:e}):"left"==i?t({type:"lookLeft",normal:[],value:.1,event:e}):"right"==i&&t({type:"lookRight",normal:[],value:.1,event:e})}));var i=null,r=function(r){if(null==i)t({type:"hover",normal:[],value:0,event:r});else{var n=ft(e,r),o=[n.x-i.x,n.y-i.y],s=[o[1],o[0],0];if(0==s[0]&&0==s[1])return;t({type:"rotate",normal:s,value:.01*(Math.abs(n.x-i.x)+Math.abs(n.y-i.y)),event:r}),i=n}};e.addEventListener("mousedown",(function(t){i=ft(e,t)})),e.addEventListener("mouseup",(function(){i=null})),e.addEventListener("mousemove",(function(t){r(t)})),e.addEventListener("touchend",(function(){i=null})),e.addEventListener("touchstart",(function(t){i=ft(e,t)})),e.addEventListener("touchmove",(function(t){r(t.touches[0])}));var n=function(e,i){0!=e&&t({type:"scale",value:e<0?.899:1.101,normal:[],event:i})};e.addEventListener("mousewheel",(function(t){n(t.wheelDelta,t)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){n(-1*t.detail,t)}),!1)},resizeObserver:function(t,e){try{return st||(st=new ResizeObserver((function(t){for(var e=0,i=t;e<i.length;e++){var r=i[e];dt[r.target._resize_observer_]()}}))),vt++,t._resize_observer_=vt,dt[vt]=e,st.observe(t),function(){st&&(st.unobserve(t),delete dt[t._resize_observer_])}}catch(t){e(),console.error("ResizeObserver undefined!")}},throttle:function(t,e){void 0===e&&(e={}),e=G(e,{time:200,keep:!1,opportunity:"end"});var i,r=!1,n=!1,o=!1;return function(){var s=this;if(i=arguments,r)n=!0,o=!0;else{"end"!=e.opportunity&&t.apply(s,i),r=!0;var a=setInterval((function(){n?e.keep||t.apply(s,i):("begin"!=e.opportunity&&(o||"end"==e.opportunity)&&t.apply(s,i),r=!1,o=!1,clearInterval(a)),n=!1}),e.time)}}},TreeLayout:mt,Geometry:bt};return wt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=e();
|
package/lib/move/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.7.0
|
|
2
|
+
* VISLite JavaScript Library v0.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sun Jan 14 2024 15:48:51 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.7.0
|
|
2
|
+
* VISLite JavaScript Library v0.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sun Jan 14 2024 15:48:51 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,t;e=this,t=function(){"use strict";return function(e,t,n,o,f){var i=Math.sqrt(e*e+t*t);return[e*n/i+o,t*n/i+f]}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_move=t();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.7.0
|
|
2
|
+
* VISLite JavaScript Library v0.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sun Jan 14 2024 15:48:51 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|