vislite 0.8.0-alpha.0 → 0.8.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 +3 -1
- package/lib/Buffer/index.umd.js +2 -2
- package/lib/Buffer/index.umd.min.js +2 -2
- package/lib/Canvas/index.umd.js +2 -2
- package/lib/Canvas/index.umd.min.js +2 -2
- 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 +36 -2
- 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 +2 -2
- package/lib/OralCanvas/index.es.min.js +2 -2
- package/lib/OralWebGL/index.es.js +2 -2
- package/lib/OralWebGL/index.es.min.js +2 -2
- package/lib/SVG/index.umd.js +2 -2
- package/lib/SVG/index.umd.min.js +2 -2
- package/lib/Shader/index.umd.js +2 -2
- package/lib/Shader/index.umd.min.js +2 -2
- package/lib/Texture/index.umd.js +2 -2
- package/lib/Texture/index.umd.min.js +2 -2
- package/lib/TreeLayout/index.umd.js +2 -2
- package/lib/TreeLayout/index.umd.min.js +2 -2
- package/lib/WebGL/index.umd.js +2 -2
- package/lib/WebGL/index.umd.min.js +2 -2
- 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 +2 -2
- package/lib/getWebGLContext/index.umd.min.js +2 -2
- package/lib/index.umd.js +36 -2
- 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 +2 -2
- package/lib/ruler/index.umd.min.js +2 -2
- 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 +2 -2
- package/src/Canvas.ts +2 -2
- package/src/Geometry.ts +22 -1
- package/src/common/canvas/painter.ts +2 -1
- package/src/common/geometry/tool/triangles.ts +24 -0
- package/types/ui-canvas.d.ts +5 -0
package/lib/index.umd.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
|
-
var t,i;t=this,i=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,i,e,n,r,o){if(!(t<e))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=e;var a=this.__u*r,s=this.__u*o;return i/=e-t,n/=e-t,this.__MR=[2*i-2*n+a+s,3*n-3*i-2*a-s,a,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),e=i*i;return(i*e*this.__MR[0]+e*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),i=function(){function i(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return i.prototype.setP=function(i){this.__HS={x:[],h:[]};var e,n,r=(i[1][1]-i[0][1])/(i[1][0]-i[0][0]);for(this.__HS.x[0]=i[0][0],e=1;e<i.length;e++){if(i[e][0]<=i[e-1][0])throw new Error("The point position should be increamented!");this.__HS.x[e]=i[e][0],n=e<i.length-1?i[e+1][1]>i[e][1]&&i[e-1][1]>i[e][1]||i[e+1][1]<i[e][1]&&i[e-1][1]<i[e][1]||i[e+1][1]==i[e][1]||i[e-1][1]==i[e][1]?0:(i[e+1][1]-i[e-1][1])/(i[e+1][0]-i[e-1][0]):(i[e][1]-i[e-1][1])/(i[e][0]-i[e-1][0]),this.__HS.h[e-1]=new t(.5*(1-this.__t)).setP(i[e-1][0],i[e-1][1],i[e][0],i[e][1],r,n),r=n}return this},i.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!")},i}(),e=function(t,i){for(var e=[],n=0;n<4;n++)for(var r=0;r<i.length/4;r++)e[4*r+n]=t[n]*i[4*r]+t[n+4]*i[4*r+1]+t[n+8]*i[4*r+2]+t[n+12]*i[4*r+3];return e},n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r=function(){function t(t){void 0===t&&(t=n),this.name="Matrix4",this.__matrix4=t}return t.prototype.setValue=function(t){return void 0===t&&(t=n),this.__matrix4=t,this},t.prototype.move=function(t,i,n,r){return void 0===r&&(r=0),this.__matrix4=e(function(t,i,e,n){void 0===n&&(n=0);var r=Math.sqrt(i*i+e*e+n*n);return[1,0,0,0,0,1,0,0,0,0,1,0,i*t/r,e*t/r,n*t/r,1]}(t,i,n,r),this.__matrix4),this},t.prototype.rotate=function(t,i,n,r,o,a,s){var _=function(t,i,e,n,r,o){if("number"==typeof t&&"number"==typeof i){if("number"!=typeof e?(e=0,n=t,r=i,o=1):"number"==typeof n&&"number"==typeof r&&"number"==typeof o||(n=t,r=i,o=e,t=0,i=0,e=0),t==n&&i==r&&e==o)throw new Error("It's not a legitimate ray!");var a=Math.sqrt((n-t)*(n-t)+(r-i)*(r-i)),s=0!=a?(r-i)/a:1,_=0!=a?(n-t)/a:0,h=(n-t)*_+(r-i)*s,u=o-e,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,i*_-t*s,e*c-t*_*p-i*s*p,-t*_*c-i*s*c-e*p,1],[s,-_,0,0,p*_,p*s,-c,0,_*c,s*c,p,0,t,i,e,1]]}throw new Error("a1 and b1 is required!")}(i,n,r,o,a,s);return this.__matrix4=e(e(e(_[1],function(t){var i=Math.sin(t),e=Math.cos(t);return[e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,i,n,r,o,a){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),this.__matrix4=e(function(t,i,e,n,r,o){return void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),[t,0,0,0,0,i,0,0,0,0,e,0,n-n*t,r-r*i,o-o*e,1]}(t,i,n,r,o,a),this.__matrix4),this},t.prototype.multiply=function(t,i){return void 0===i&&(i=!1),this.__matrix4=i?e(this.__matrix4,t):e(t,this.__matrix4),this},t.prototype.use=function(t,i,n,r){return void 0===n&&(n=0),void 0===r&&(r=1),e(this.__matrix4,[t,i,n,r])},t.prototype.value=function(){return this.__matrix4},t}();function o(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[(n-t)*o-(r-i)*a+t,(n-t)*a+(r-i)*o+i]}var a,s=function(t){var i=t.toString(16);return 1==i.length?"0"+i:i},_=[];function h(t,i,e){void 0===i&&(i=400),void 0===e&&(e=function(){});var n={timer:function(t,i,e){if(!t)throw new Error("Tick is required!");var r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return _.push({id:r,createTime:new Date,tick:t,duration:i,callback:e}),n.start(),r},start:function(){a||(a=setInterval(n.tick,13))},tick:function(){var t,i,e,r,o,a,s,h=_;for((_=[]).length=0,i=0;i<h.length;i++)t=(o=h[i]).createTime,e=o.tick,a=o.duration,r=o.callback,e(s=(s=(+(new Date).valueOf()-t.valueOf())/a)>1?1:s),s<1&&o.id?_.push(o):r(s);_.length<=0&&n.stop()},stop:function(){a&&(clearInterval(a),a=null)}},r=n.timer((function(i){t(i)}),i,e);return function(){var t;for(t in _)if(_[t].id==r)return void(_[t].id=void 0)}}var u=function(t,i){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},u(t,i)};function l(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function e(){this.constructor=t}u(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}function p(t,i,e){if(e||2===arguments.length)for(var n,r=0,o=i.length;r<o;r++)!n&&r in i||(n||(n=Array.prototype.slice.call(i,0,r)),n[r]=i[r]);return t.concat(n||Array.prototype.slice.call(i))}"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,i,e){c.indexOf(i)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+i,e+""):t.setAttribute(i,e+"")},v=d;function g(t,i){d(t,"stroke",i.strokeStyle),d(t,"fill",i.fillStyle),d(t,"stroke-dasharray",i.lineDash.join(","))}function m(t,i){d(t,"fill",i.fillStyle)}function y(t,i){d(t,"stroke",i.strokeStyle),d(t,"fill","none"),d(t,"stroke-dasharray",i.lineDash.join(","))}var E=function(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[+((n-t)*o-(r-i)*a+t).toFixed(7),+((n-t)*a+(r-i)*o+i).toFixed(7)]};function x(t,i,e,n,r,o,a){i<0&&(t+=i,i*=-1);var s,_=[];s=E(0,0,t,r,0),_[0]=s[0],_[1]=s[1],s=E(0,0,i,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,i,s[0],s[1]),_[6]=s[0],_[7]=s[1],a(t,t+i,_[0]+e,_[1]+n,_[4]+e,_[5]+n,_[2]+e,_[3]+n,_[6]+e,_[7]+n,.5*(o-r))}var b=function(t){var i=t.getElementsByTagName("defs");if(i.length<=0){var e=f("defs");return t.appendChild(e),e}return i[0]},w=function(t,i,e,n,r){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");v(t,"dy",{top:.5*i.fontSize,middle:0,bottom:.5*-i.fontSize}[i.textBaseline]),function(t,i){for(var e in i)t.style[e]=i[e]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[i.textAlign],"dominant-baseline":"central","font-size":i.fontSize+"px","font-family":i.fontFamily}),v(t,"x",e),v(t,"y",n),"number"==typeof r&&v(t,"transform","rotate("+(r%=360)+","+e+","+n+")")},T=function(t,i,e,n){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");v(t,"cx",i),v(t,"cy",e),v(t,"r",n)},C=function(t,i){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");v(t,"d",i)},P=function(t,i,e,n,r){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");r<0&&(e-=r*=-1),n<0&&(i-=n*=-1),v(t,"x",i),v(t,"y",e),v(t,"width",n),v(t,"height",r)},R=function(t,i,e,n,r,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,r>o){var _=r;r=o,o=_}s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=1.999999*Math.PI:s%=2*Math.PI,x(a,s,e,n,r,o,(function(e,n,a,s,_,h,u,l,p,c,f){var d=n-e>Math.PI?1:0,g="M"+a+" "+s;f<0&&(f=-f),g+="A"+r+" "+r+" 0 "+d+" 1 "+u+" "+l,"round"==i.arcEndCap?g+="A"+f+" "+f+" 0 1 0 "+p+" "+c:"-round"==i.arcEndCap?g+="A"+f+" "+f+" 0 1 1 "+p+" "+c:g+="L"+p+" "+c,g+="A"+o+" "+o+" 0 "+d+" 0 "+_+" "+h,"round"==i.arcStartCap?g+="A"+f+" "+f+" 0 1 0 "+a+" "+s:"-round"==i.arcStartCap?g+="A"+f+" "+f+" 0 1 1 "+a+" "+s:g+="L"+a+" "+s,"butt"==i.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 i in t){var e=S[i]||i;this.__config[e]=t[i]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,i){return i=i||this.__svg,"string"==typeof t&&(t=f(t)),i.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,i){var e=t;if("string"==typeof t&&(e={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==e)throw new Error("Unsupported drawing method:"+t);return this.appendEl(e,i)},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,i){return c.indexOf(i)>-1&&(i="xlink:"+i),t.getAttribute(i)}(this.__useEl,t);for(var i in t)v(this.__useEl,i,t[i]);return this},t.prototype.fillText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,m(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,y(this.__useEl,this.__config),this},t.prototype.fullText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,g(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),m(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),y(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),g(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,i,e){return T(this.__useEl,t,i,e),m(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,i,e){return T(this.__useEl,t,i,e),y(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,i,e){return T(this.__useEl,t,i,e),g(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),m(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),y(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),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,i){return this.__currentPosition=[t,i],this.__path+="M"+t+" "+i,this},t.prototype.lineTo=function(t,i){return this.__currentPosition=[t,i],this.__path+=(""==this.__path?"M":"L")+t+" "+i,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,i,e,n,r){var a=o(t,i,n/180*Math.PI,t+e,i),s=o(t,i,(n+r)/180*Math.PI,t+e,i);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"+e+","+e+" 0 "+(r>180||r<-180?1:0)+","+(r>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__path+="Q"+t+" "+i+","+e+" "+n,this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__path+="C"+t+" "+i+","+e+" "+n+","+r+" "+o,this},t.prototype.bind=function(t,i){return this.__useEl.addEventListener(t,(function(t){i.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=b(t),a="vislite-lg-"+(new Date).valueOf()+"-"+Math.random(),s=f("linearGradient");o.appendChild(s),v(s,"id",a),v(s,"x1",i+"%"),v(s,"y1",e+"%"),v(s,"x2",n+"%"),v(s,"y2",r+"%");var _={value:function(){return"url(#"+a+")"},setColor:function(t,i){var e=f("stop");return s.appendChild(e),v(e,"offset",100*t+"%"),v(e,"style","stop-color:"+i+";"),_}};return _}(this.__svg,t,i,e,n)},t.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=b(t),o="vislite-rg-"+(new Date).valueOf()+"-"+Math.random(),a=f("radialGradient");r.appendChild(a),v(a,"id",o),v(a,"cx",i+"%"),v(a,"cy",e+"%"),v(a,"r",n+"%");var s={value:function(){return"url(#"+o+")"},setColor:function(t,i){var e=f("stop");return a.appendChild(e),v(e,"offset",100*t+"%"),v(e,"style","stop-color:"+i+";"),s}};return s}(this.__svg,t,i,e)},t}(),M=function(t){function i(i){if(!i)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var e=i.clientWidth,n=i.clientHeight,r=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.appendChild(r),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("viewBox","0 0 "+e+" "+n),t.call(this,r)||this}return l(i,t),i}(A),L=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},I=function(t,i,e,n,r,o,a,s){if(r>o){var _=r;r=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,e,n,r,o,(function(a,s,_,h,u,l,p,c,f,d,v){v<0&&(v=-v),t.beginPath(),t.moveTo(_,h),t.arc(e,n,r,a,s,!1),"round"==i.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,s-Math.PI,s,!0):"-round"==i.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,s-Math.PI,s,!1):t.lineTo(f,d),t.arc(e,n,o,s,a,!0),"round"==i.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,a,a-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,a,a-Math.PI,!1):t.lineTo(_,h)})),"butt"==i.arcStartCap&&t.closePath(),t},k=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},z=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function N(t,i,e,n,r){for(var o=0,a="",s=0;s<i.length;s++)t.measureText(a+i[s]).width>e||/\n$/.test(a)?(r(a,((o+=1)-.5)*n),a=i[s]):s==i.length-1?(o+=1,r(a+i[s],(o-.5)*n)):a+=i[s];return o*n}var U=function(){function t(t,i,e,n,r){void 0===i&&(i={}),void 0===n&&(n=!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",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fillText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.strokeText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fullText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.fillText(t,0,i)}));return this.painter.restore(),_},t.prototype.strokeTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.strokeText(t,0,i)}));return this.painter.restore(),_},t.prototype.fullTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.fillText(t,0,i),a.painter.strokeText(t,0,i)}));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,i){return this.__region&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<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,i,e,n){return this.__region&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,n,r,o){return this.__region&&this.__region.fillArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,i,e,n,r,o).fill(),this},t.prototype.strokeArc=function(t,i,e,n,r,o){return this.__region&&this.__region.strokeArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,i,e,n,r,o).stroke(),this},t.prototype.fullArc=function(t,i,e,n,r,o){return this.__region&&this.__region.fullArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||(I(this.painter,this.__specialConfig,t,i,e,n,r,o),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||k(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||k(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(k(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||z(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||z(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(z(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t.prototype.drawImage=function(t,i,e,n,r,o){var a=this;return void 0===o&&(o=!1),new Promise((function(s){if(a.__region&&(a.__region.fillRect(i,e,n,r),s({})),a.__isPainter&&a.__onlyRegion)return a;if("string"!=typeof t||o)a.painter.drawImage(t,i,e,n,r),s({});else{var _=new Image;_.onload=function(){a.painter.drawImage(_,i,e,n,r),s({})},_.src=t}}))},t}();function F(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}var O={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},B=function(t){function i(i,e,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new U(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__regionAssemble=F(0,255,10,3),o.__scaleSize=r,o.setRegion(""),o}return l(i,t),i.prototype.config=function(t){for(var i in t){var e=O[i]||i;this.useConfig(e,t[i])}return this},i.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},i.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[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},i.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,a=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?a():r.then((function(t){o=t,a()}))}))},i.prototype.textWidth=function(t){this.painter.save(),L(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},i.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},i.prototype.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},i.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r),a={value:function(){return o},setColor:function(t,i){return o.addColorStop(t,i),a}};return a}(this.painter,t,i,e,n)},i.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n),o={value:function(){return r},setColor:function(t,i){return r.addColorStop(t,i),o}};return o}(this.painter,t,i,e)},i.prototype.getColor=function(t,i){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},i}(U);function G(t,i){for(var e in t)i[e]=t[e];return i}var D=function(t){function i(i,e){void 0===e&&(e={});var n=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");e=G(e,{region:!0,willReadFrequently:!1});var r,o=i.clientWidth,a=i.clientHeight,s=null,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],s=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(s=document.createElement("canvas")),_._vislite_canvas_=[r,s],i.setAttribute("vislite","Canvas"));for(var h=[s,r],u=0;u<h.length;u++){var l=h[u];l&&(l.style.width=o+"px",l.setAttribute("width",u*o+o+""),l.style.height=a+"px",l.setAttribute("height",u*a+a+""))}return(n=t.call(this,r,s,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=r,n.painter.scale(2,2),n}return l(i,t),i.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},i}(B);function H(t,i,e,n){void 0===e&&(e={}),void 0===n&&(n="scaleToFill");for(var r=["experimental-webgl","webkit-3d","moz-webgl"],o=t.getContext("webgl",e),a=0;a<r.length;a++){try{o=t.getContext(r[a],e)}catch(t){}if(o)break}if(!o)throw new Error("Non canvas or browser does not support webgl.");var s=o.canvas.width,_=o.canvas.height,h=i,u=i;"aspectFit"==n?s>_?h*=_/s:_>s&&(u*=s/_):"aspectFill"==n&&(s>_?u*=s/_:_>s&&(h*=_/s));var l=s*h,p=_*u;return o.viewport(.5*(s-l),.5*(_-p),l,p),o.depthFunc(o.LEQUAL),o.enable(o.DEPTH_TEST),o}function q(t){var i=t.drawingBufferWidth,e=t.drawingBufferHeight,n=new Uint8Array(4*i*e);return t.readPixels(0,0,i,e,t.RGBA,t.UNSIGNED_BYTE,n),function(t,r){return"rgba("+n[4*((r=e-r)*i+t)]+","+n[4*(r*i+t)+1]+","+n[4*(r*i+t)+2]+","+n[4*(r*i+t)+3]+")"}}var V=function(){function t(t,i){void 0===i&&(i=!1),this.__painter=t,this.__isElement=i,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=i?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,i,e,n){var r=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(r,i,n)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,i,e,n){return void 0===n&&(n=0),function(t,i,e,n,r,o,a){t.vertexAttribPointer(i,e,n,a,r,o),t.enableVertexAttribArray(i)}(this.__painter,t,i,this.__painter.FLOAT,e*this.__fsize,n*this.__fsize,!1),this},t}(),W=function(){function t(t,i,e){void 0===e&&(e=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[i],this.__texture=function(t,i,e){var n=t.createTexture();return t.activeTexture(t["TEXTURE"+e]),t.bindTexture(i,n),n}(t,this.__type,e),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,i,e,n,r,o){t.texImage2D(i,e,n,n,r,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,i,e){return function(t,i,e,n,r,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,e,n,a,s,0,n,r,null),t.bindTexture(i,_),t.texImage2D(h,e,n,n,r,o[l]));t.generateMipmap(i)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,i,e,this.__texture),this},t}(),X={};function Y(t,i,e){var n=t+"-"+e;return X[n]||(X[n]=new W(i,e)),X[n]}var j=function(t,i,e){var n=t.createShader(i);if(null==n)throw new Error("Unable to create shader!");if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(n));return n},$=function(){function t(t){this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,i){return this.program=function(t,i,e){var n=j(t,t.VERTEX_SHADER,i),r=j(t,t.FRAGMENT_SHADER,e),o=t.createProgram();if(t.attachShader(o,n),t.attachShader(o,r),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,i),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}",it="precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}",et="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}",nt="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}",rt={};function ot(t,i,e,n,r){var o,a,s,_,h,u,l,p,c,f,d,v,g,m,y,E,x,b,w,T,C,P,R,S,A=function(t,i,e){var n,r,o=t+(e.material.color?"1":"0")+(e.material.colors?"1":"0")+(e.material.image?"1":"0")+(e.material.cube?"1":"0");if(rt[o])return rt[o].use();var a=(n={},n[t+"1000"]=Z,n[t+"0100"]=J,n[t+"0010"]=Q,n[t+"0001"]=K,n)[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=(r={},r[t+"1000"]=tt,r[t+"0100"]=it,r[t+"0010"]=et,r[t+"0001"]=nt,r)[o],_=new $(i).compile(a,s).use();return rt[o]=_,_}(t,i,e);if(new V(i).use().write(e.geometry.attributes.position.array).divide(i.getAttribLocation(A.program,"a_position"),e.geometry.attributes.position.itemSize,e.geometry.attributes.position.itemSize,0),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_world"),!1,r.matrix),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_proporion"),!1,r.proporion),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_mesh"),!1,n.matrix),e.geometry.attributes.normal&&new V(i).use().write(e.geometry.attributes.normal.array).divide(i.getAttribLocation(A.program,"a_normal"),e.geometry.attributes.normal.itemSize,e.geometry.attributes.normal.itemSize,0),"color"in e.material&&i.uniform4f(i.getUniformLocation(A.program,"u_color"),null===(o=e.material.color)||void 0===o?void 0:o.r,null===(a=e.material.color)||void 0===a?void 0:a.g,null===(s=e.material.color)||void 0===s?void 0:s.b,null===(_=e.material.color)||void 0===_?void 0:_.alpha),"colors"in e.material)new V(i).use().write(null===(h=e.material.colors)||void 0===h?void 0:h.array).divide(i.getAttribLocation(A.program,"a_color"),null===(u=e.material.colors)||void 0===u?void 0:u.itemSize,null===(l=e.material.colors)||void 0===l?void 0:l.itemSize,0);else if("cube"in e.material){var M=(null===(c=null===(p=e.material.cube)||void 0===p?void 0:p.right)||void 0===c?void 0:c.image.value).width;i.uniform1i(i.getUniformLocation(A.program,"u_texture"),0),Y(t,i,"cube").useCube([null===(d=null===(f=e.material.cube)||void 0===f?void 0:f.right)||void 0===d?void 0:d.image.value,null===(g=null===(v=e.material.cube)||void 0===v?void 0:v.left)||void 0===g?void 0:g.image.value,null===(y=null===(m=e.material.cube)||void 0===m?void 0:m.top)||void 0===y?void 0:y.image.value,null===(x=null===(E=e.material.cube)||void 0===E?void 0:E.bottom)||void 0===x?void 0:x.image.value,null===(w=null===(b=e.material.cube)||void 0===b?void 0:b.far)||void 0===w?void 0:w.image.value,null===(C=null===(T=e.material.cube)||void 0===T?void 0:T.near)||void 0===C?void 0:C.image.value],M,M)}else"image"in e.material&&(i.uniform1i(i.getUniformLocation(A.program,"u_sampler"),0),new V(i).use().write(null===(P=e.geometry.attributes.uv)||void 0===P?void 0:P.array).divide(i.getAttribLocation(A.program,"a_textcoord"),null===(R=e.geometry.attributes.uv)||void 0===R?void 0:R.itemSize,2,0),Y(t,i,"2d").useImage(null===(S=e.material.image)||void 0===S?void 0:S.value));e.geometry.index?(new V(i,!0).use().write(e.geometry.index.array),i.drawElements(i[e.geometry.type],e.geometry.index.count,i.UNSIGNED_BYTE,0)):i.drawArrays(i[e.geometry.type],0,e.geometry.attributes.position.count)}var at,st=!1,_t=function(){function t(t,i,e){this.name="WebGL",this.__getColor=function(t,i){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=F(0,1,.2,3),this.__regionName="",this.__regionColor=[0,0,0,1],this.__scene={children:[],matrix:new r([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),i&&(this.__regionPainter=H(i,10,{},e));var n=this.painter.canvas.width/this.painter.canvas.height,o=1,a=1;n>1?o=1/n:a=n;var s=Math.min(o,a);this.__proporion=[o,0,0,0,0,a,0,0,0,0,s,0,0,0,0,1]}return t.prototype.matrix=function(t){return new r(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 i=0;i<this.__scene.children.length;i++)this.draw(this.__scene.children[i],t);return this},t.prototype.draw=function(t,i){var e;void 0===i&&(i=!1),i||(st=!0);var n={matrix:null===(e=t.matrix)||void 0===e?void 0:e.value()},r={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var o=0;o<t.mesh.length;o++)i?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]}}},n,r),this.__getColor=q(this.__regionPainter)):ot("region"+this.__unique,this.painter,t.mesh[o],n,r)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new r),"region"in t||(t.region="");for(var i=0;i<t.mesh.length;i++){var e=t.mesh[i];e.geometry.attributes.normal&&Array.isArray(e.geometry.attributes.normal.array)&&(e.geometry.attributes.normal.array=new Float32Array(e.geometry.attributes.normal.array)),e.geometry.attributes.position&&Array.isArray(e.geometry.attributes.position.array)&&(e.geometry.attributes.position.array=new Float32Array(e.geometry.attributes.position.array)),e.geometry.attributes.uv&&Array.isArray(e.geometry.attributes.uv.array)&&(e.geometry.attributes.uv.array=new Float32Array(e.geometry.attributes.uv.array)),e.geometry.index&&Array.isArray(e.geometry.index.array)&&(e.geometry.index.array=new Uint8Array(e.geometry.index.array)),e.material.colors&&Array.isArray(e.material.colors.array)&&(e.material.colors.array=new Float32Array(e.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,i){var e=this;return st&&this.review(!0),st=!1,new Promise((function(n){var r=e.__getColor(t,i);for(var o in e.__regionList){var a=e.__regionList[o];if("rgba("+255*a[0]+","+255*a[1]+","+255*a[2]+","+255*a[3]+")"==r){n(o);break}}n("")}))},t}(),ht=function(t){function i(i,e){if(void 0===e&&(e={}),!i)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");e=G(e,{region:!0});var n,r=i.clientWidth,o=i.clientHeight,a=null,s=i;s._vislite_canvas_?(n=s._vislite_canvas_[0],a=s._vislite_canvas_[1]):(e.region&&(a=document.createElement("canvas"),i.appendChild(a),a.style.position="absolute",a.style.zIndex="-1",a.style.opacity="0"),n=document.createElement("canvas"),i.appendChild(n),s._vislite_canvas_=[n,a],i.setAttribute("vislite","WebGL"));for(var _=0,h=[n,a];_<h.length;_++){var u=h[_];u&&(u.style.width=r+"px",u.setAttribute("width",r+""),u.style.height=o+"px",u.setAttribute("height",o+""))}return t.call(this,n,a,e.mode)||this}return l(i,t),i}(_t),ut=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return l(i,t),i.prototype.compile=function(i,e){return e?t.prototype.compile.call(this,i,e):t.prototype.compile.call(this,{color:Z,colors:J,image:Q,cube:K}[i],{color:tt,colors:it,image:et,cube:nt}[i]),this},i}($),lt=function(t,i,e,n){var r=Math.cos(t),o=Math.sin(t);return[i*r-e*o,i*o+e*r,n]},pt=function(){function t(t,i){void 0===t&&(t=7),void 0===i&&(i=[107,36]),this.name="Eoap",this.__scale=t,this.__center=i}return t.prototype.use=function(t,i){var e,n,r,o,a,s,_=(e=(360-i)/180*Math.PI,n=100*this.__scale,r=0,o=0,a=Math.cos(e),s=Math.sin(e),[o*s+n*a,r,o*a-n*s]);return _=lt(t/180*Math.PI,_[0],_[1],_[2]),_=lt((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,i,e,n){var r=Math.cos(t),o=Math.sin(t);return[i,e*r-n*o,e*o+n*r]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),ct=function(t,i){void 0===t&&(t=7),void 0===i&&(i=[107,36]),this.name="Mercator";var e=100*t*Math.PI/180,n=e*i[0],r=-1*e*i[1];this.use=function(t,i){return[.8*(e*t-n),-1*e*i-r,0]}},ft=function(t,i){var e=t.getBoundingClientRect();return{x:i.clientX-e.left,y:i.clientY-e.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,i){return void 0===i&&(i={}),function(t,i,e){var n=function(t,i){var e,n,r={},o=i.root(t);e=n=i.id(o),r[e]={data:o,pid:null,id:e,isOpen:!0,show:!0,children:[]};var a=1;return function n(o,s){var _=i.children(o,t);a+=_?_.length:0;for(var h=0;_&&h<_.length;h++)e=i.id(_[h]),r[s].children.push(e),r[e]={data:_[h],pid:s,id:e,isOpen:!0,show:!0,children:[]},n(_[h],e)}(o,e),{rid:n,value:r,num:a}}(t,i),r=n.value,o=n.rid;if(1==n.num)return r[o].left=.5,r[o].top=.5,r[o].show=!0,{deep:1,node:r,root:o,size:1};var a=[],s=0,_=0;for(var h in e[o]?(r[o].left=.5,r[o].top=.5,r[o].show=!0,s=1):function t(i,n){n>_&&(_=n);var o=0;if(!e[i.id])for(o=0;o<i.children.length;o++)t(r[i.children[o]],n+1);if(r[i.id].left=n+.5,0==o?(null==a[n]&&(a[n]=-.5),null==a[n-1]&&(a[n-1]=-.5),r[i.id].top=a[n]+1,a[n]+1+.5*(r[i.pid].children.length-1)-1<a[n-1]&&(r[i.id].top=a[n-1]+1-.5*(r[i.pid].children.length-1))):r[i.id].top=.5*(r[i.children[0]].top+r[i.children[o-1]].top),r[i.id].top<=a[n])var h=a[n]+1-r[i.id].top((function t(i,e){r[i].top+=h,a[e]<r[i].top&&(a[e]=r[i].top);for(var n=0;n<r[i].children.length;n++)t(r[i].children[n],e+1)}))(i.id,n);a[n]=r[i.id].top,r[i.id].top+.5>s&&(s=r[i.id].top+.5)}(r[o],0),e)e[h]&&(r[h].isOpen=!1,function t(i,e,n){for(var o=0;o<r[i].children.length;o++)r[r[i].children[o]].left=e,r[r[i].children[o]].top=n,r[r[i].children[o]].show=!1,t(r[i].children[o],e,n)}(h,r[h].left,r[h].top));return{node:r,root:o,size:s,deep:_+1}}(t,this.__config,i)},t}(),mt=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.name="TreeLayout",i.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},i.__noOpens={},i}return l(i,t),i.prototype.setOption=function(t){return G(t,this.__option),this},i.prototype.use=function(i,e){void 0===e&&(e={});var n=t.prototype.use.call(this,i,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var r in n.node)if(!n.node[r].show){var a=0,s=r;do{s=n.node[s].pid,a++}while(!n.node[s].show);n.node[r].left+=this.__option.offsetX*a,n.node[r].top+=this.__option.offsetY*a}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var _=this.__option.height/n.size,h=this.__option.width/(n.deep-1),u=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var r in n.node)1==n.deep?(n.node[r].left=this.__option.x+.5*this.__option.width*l,n.node[r].top=this.__option.y):(n.node[r].left=this.__option.x+(n.node[r].left-.5)*h*l,n.node[r].top=n.node[r].top*_+u)}else if("TB"==this.__option.direction||"BT"==this.__option.direction)for(var r in _=this.__option.width/n.size,h=this.__option.height/(n.deep-1),u=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1,n.node)if(1==n.deep)n.node[r].left=this.__option.x,n.node[r].top=this.__option.y+.5*this.__option.height*l;else{var p=n.node[r].left;n.node[r].left=n.node[r].top*_+u,n.node[r].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/n.size,v=this.__option.radius/(n.deep-1);for(var r in n.node)if(.5==n.node[r].left)n.node[r].left=c,n.node[r].top=f;else{var g=o(c,f,d*n.node[r].top,c+(n.node[r].left-.5)*v,f);n.node[r].left=g[0],n.node[r].top=g[1]}}return n},i.prototype.bind=function(t,i,e){return void 0===e&&(e={}),this.__rback=i,this.__oralTree=t,this.__noOpens=e,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},i.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},i.prototype.doUpdate=function(){var t=this,i=this.use(this.__oralTree,this.__noOpens),e=JSON.parse(JSON.stringify(i));h((function(n){if(t.__preTree)for(var r in e.node)(i.node[r].show||t.__preTree.node[r].show)&&(e.node[r].show=!0,e.node[r].left=t.__preTree.node[r].left+(i.node[r].left-t.__preTree.node[r].left)*n,e.node[r].top=t.__preTree.node[r].top+(i.node[r].top-t.__preTree.node[r].top)*n);t.__rback(e)}),this.__option.duration,(function(){t.__preTree=i,t.__rback(t.__preTree)}))},i.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},i.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},i.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},i}(gt),yt=function(t,i,e){void 0===e&&(e=2*Math.PI);var n=Math.ceil(e/Math.asin(t/i)*2);return isNaN(n)||n<12?12:n};function Et(t,i,e,n,r,a,s,_,h){var u,l;if(void 0===_&&(_=0),void 0===h&&(h=2*Math.PI),4==a){var p=r/1.414;u=i+p,l=n+p}else u=i+r,l=n;var c=[u,l];0!=_&&(c=o(i,n,_,u,l));for(var f=[],d=h/a,v=0;v<a;v++)f.push(i,e,n),t&&f.push(0,s,0),f.push(c[0],e,c[1]),t&&f.push(0,s,0),c=o(i,n,d*(v+1),u,l),f.push(c[0],e,c[1]),t&&f.push(0,s,0);return f}function xt(t,i,e,n,r,a,s,_,h){void 0===_&&(_=0),void 0===h&&(h=2*Math.PI);var u,l=[];u=4==s?o(i,n,.25*Math.PI,i-r,n):[i+r,n],0!=_&&(u=o.apply(void 0,p([i,n,_],u,!1)));for(var c,f=h/s,d=h/(2*s),v=[],g=0;g<s;g++){if(c=o.apply(void 0,p([i,n,f],u,!1)),t){var m=o.apply(void 0,p([i,n,d],u,!1));v=[m[0],0,m[1]]}l.push.apply(l,p([u[0],e,u[1]],v,!1)),l.push.apply(l,p([u[0],e+a,u[1]],v,!1)),l.push.apply(l,p([c[0],e+a,c[1]],v,!1)),l.push.apply(l,p([u[0],e,u[1]],v,!1)),l.push.apply(l,p([c[0],e,c[1]],v,!1)),l.push.apply(l,p([c[0],e+a,c[1]],v,!1)),u=c}return l}function bt(t,i,e,n,r,a,s){var _,h=[i,e+r,n],u=2*Math.PI/a;t&&h.push(0,r,0);for(var l=function(){h.push.apply(h,h.slice(h.length-(t?12:6)))},p=1;p<.5*a;p++){_=o(i,e,u*p,i,e+r),p>1&&l();var c=o(i,n,u*s,_[0],n);h.push(c[0],_[1],c[1]),t&&h.push(c[0]-i,_[1]-e,c[1]-n),p>1&&l();var f=o(i,n,u*(s+1),_[0],n);h.push(f[0],_[1],f[1]),t&&h.push(f[0]-i,f[1]-e,f[1]-n)}return l(),h.push(i,e-r,n),t&&h.push(0,-r,0),h}function wt(t,i,e,n,r,o){return function(a,s,_,h){if(t==n&&e==o)return[a,s,_];var u,l,p,c=a-(h?0:t),f=s-(h?0:i),d=_-(h?0:e),v=n-t,g=r-i,m=o-e,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:i),d+(h?0:e)]}}var Tt=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 i in t)this.__option[i]=t[i];return this},t.prototype.splitNum=function(t,i){return yt(this.__option.precision,t,i)},t.prototype.rotateLine=function(t,i,e,n,r,o){var a=this,s=wt(t,i,e,n,r,o);return function(t,i,e){return s(t,i,e,a.__option.normal)}},t.prototype.prismHorizontal=function(t,i,e,n,r,o,a,s){return Et(this.__option.normal,t,i,e,n,r,o,a,s)},t.prototype.prismVertical=function(t,i,e,n,r,o,a,s){return xt(this.__option.normal,t,i,e,n,r,o,a,s)},t.prototype.sphereFragment=function(t,i,e,n,r,o){return bt(this.__option.normal,t,i,e,n,r,o)},t.prototype.pie=function(t,i,e,n,r,o,a){var s=yt(this.__option.precision,n,a);return[{name:"bottom",points:Et(this.__option.normal,t,i,e,n,s,r>0?-1:1,o,a),length:3*s,method:"TRIANGLES"},{name:"top",points:Et(this.__option.normal,t,i+r,e,n,s,r>0?1:-1,o,a),length:3*s,method:"TRIANGLES"},{name:"side",points:xt(this.__option.normal,t,i,e,n,r,s,o,a),length:6*s,method:"TRIANGLES"}]},t.prototype.cylinder=function(t,i,e,n,r,o,a){var s=yt(this.__option.precision,n);return 5==arguments.length?this.prism(t,i,e,n,r,s):this.prism(t,i,e,n,r,o,a,s)},t.prototype.prism=function(t,i,e,n,r,o,a,s){var _,h,u,l,p=null;6==arguments.length?(l=r,s=o):(l=(i>o?-1:1)*Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-e)*(a-e)),p=wt(t,i,e,r,o,a));var c=[{name:"bottom",points:[],length:0,method:"TRIANGLES"},{name:"top",points:[],length:0,method:"TRIANGLES"},{name:"side",points:[],length:0,method:"TRIANGLES"}];(_=c[0].points).push.apply(_,Et(this.__option.normal,t,i,e,n,s,l>0?-1:1)),(h=c[1].points).push.apply(h,Et(this.__option.normal,t,i+l,e,n,s,l>0?1:-1)),(u=c[2].points).push.apply(u,xt(this.__option.normal,t,i,e,n,l,s));for(var f=0;f<c.length;f++){if(p){for(var d=[],v=!1,g=0;g<c[f].points.length;g+=3)d.push.apply(d,p(c[f].points[g],c[f].points[g+1],c[f].points[g+2],this.__option.normal&&v)),v=!v;c[f].points=d}c[f].length=c[f].points.length/(this.__option.normal?6:3)}return c},t.prototype.sphere=function(t,i,e,n){for(var r,o=yt(this.__option.precision,n),a=[{name:"surface",points:[],length:0,method:"TRIANGLES"}],s=0;s<o;s++)(r=a[0].points).push.apply(r,bt(this.__option.normal,t,i,e,n,o,s));return a[0].length=a[0].points.length/(this.__option.normal?6:3),a},t}(),Ct={Cardinal:i,Hermite:t,Matrix4:r,rotate:o,move:function(t,i,e,n,r){var o=Math.sqrt(t*t+i*i);return[t*e/o+n,i*e/o+r]},scale:function(t,i,e,n,r){return[e*(n-t)+t,e*(r-i)+i]},getLoopColors:function(t,i){void 0===i&&(i=1);var e=["rgba(84,112,198,"+i+")","rgba(145,204,117,"+i+")","rgba(250,200,88,"+i+")","rgba(238,102,102,"+i+")","rgba(115,192,222,"+i+")","rgba(59,162,114,"+i+")","rgba(252,132,82,"+i+")","rgba(154,96,180,"+i+")","rgba(234,124,204,"+i+")"],n=[];if(t<=e.length)return e;if(t%e.length==0)for(var r=0;r<t/e.length;r++)n=n.concat(e);else{for(var o=1;o<t/e.length;o++)n=n.concat(e);if(t%e.length==1)n=n.concat(e[4]);else for(var a=0;a<t%e.length;a++)n=n.concat(e[a])}return n},formatColor:function(t,i){var e=document.getElementsByTagName("head")[0];e.style.color=t;for(var n=(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(e,null):e.currentStyle).getPropertyValue("color").replace(/rgba?\(/,"").replace(")","").split(","),r=0;r<n.length;r++)n[r]=+n[r];switch(n.push(1),i){case"3d":return[n[0]/255,n[1]/255,n[2]/255,n[3]];case"rgba":return"rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(n[3],")");case"rgb":return"rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")");case"hexAlpha":return"#".concat(s(n[0])).concat(s(n[1])).concat(s(n[2])).concat(s(+(255*n[3]).toFixed(0)));case"hex":return"#".concat(s(n[0])).concat(s(n[1])).concat(s(n[2]))}throw new Error("Unsupported color format: "+i)},animation:h,ruler:function(t,i,e,n){if(t<i){var r=i;i=t,t=r}else if(t==i)return[t];var o=function(t){for(var i=t<100&&t>-100?10:.1,e=-1,n=t;10==i?n>=-100&&n<=100:n<=-100||n>=100;)e+=1,n*=i;if(10==i)return Math.pow(10,e);for(var r="0.",o=1;o<e;o++)r+="0";return+(r+"1")}(t-i),a=Math.ceil((t-i)*o/e),s=function(e){var n=({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+e]||a+e)/o,r=Math.floor(i/n)*n,s=[];s.push(r);for(var _=1;s[s.length-1]<t;_++)s.push(r+n*_);return s},_=s(0),h=function(){for(var t=[],e=_[_.length-1]-(null==n?void 0:n.max),r=0;r<_.length;r++)r+1<_.length&&_[r+1]-e<i||t.push(_[r]-e);return t},u=function(){for(var i=[],e=_[0]-(null==n?void 0:n.min),r=0;r<_.length&&(i[r]=_[r]-e,!(t<=i[r]));r++);return i};if(n){if("max"in n&&"min"in n&&n.max>=t&&n.min<=i){var l=function(){if(_[0]>=n.min&&_[_.length-1]<=n.max)return!0;var t=h();if(t[0]>=n.min&&t[t.length-1]<=n.max)return _=t,!0;var i=u();return i[0]>=n.min&&i[t.length-1]<=n.max?(_=i,!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 n&&n.max>=t?n.max<_[_.length-1]&&(_=h()):"min"in n&&n.min<=i&&n.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,i,e){if(void 0===i&&(i=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,r=t.clientWidth,o=t.clientHeight,a=t;return a._vislite_canvas_?n=a._vislite_canvas_:(n=document.createElement("canvas"),t.appendChild(n),a._vislite_canvas_=n,t.setAttribute("vislite","WebGL")),n.style.width=r+"px",n.setAttribute("width",r+""),n.style.height=o+"px",n.setAttribute("height",o+""),H(n,i,{},e)},Shader:ut,Texture:W,Buffer:V,Eoap:pt,Mercator:ct,viewHandler:function(t){var i=document.getElementsByTagName("body")[0];i.addEventListener("keydown",(function(i){var e=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(i);"up"==e?t({type:"lookUp",normal:[],value:.1,event:i}):"down"==e?t({type:"lookDown",normal:[],value:.1,event:i}):"left"==e?t({type:"lookLeft",normal:[],value:.1,event:i}):"right"==e&&t({type:"lookRight",normal:[],value:.1,event:i})}));var e=null,n=function(n){if(null==e)t({type:"hover",normal:[],value:0,event:n});else{var r=ft(i,n),o=[r.x-e.x,r.y-e.y],a=[o[1],o[0],0];if(0==a[0]&&0==a[1])return;t({type:"rotate",normal:a,value:.01*(Math.abs(r.x-e.x)+Math.abs(r.y-e.y)),event:n}),e=r}};i.addEventListener("mousedown",(function(t){e=ft(i,t)})),i.addEventListener("mouseup",(function(){e=null})),i.addEventListener("mousemove",(function(t){n(t)})),i.addEventListener("touchend",(function(){e=null})),i.addEventListener("touchstart",(function(t){e=ft(i,t)})),i.addEventListener("touchmove",(function(t){n(t.touches[0])}));var r=function(i,e){0!=i&&t({type:"scale",value:i<0?.899:1.101,normal:[],event:e})};i.addEventListener("mousewheel",(function(t){r(t.wheelDelta,t)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){r(-1*t.detail,t)}),!1)},resizeObserver:function(t,i){try{return at||(at=new ResizeObserver((function(t){for(var i=0,e=t;i<e.length;i++){var n=e[i];dt[n.target._resize_observer_]()}}))),vt++,t._resize_observer_=vt,dt[vt]=i,at.observe(t),function(){at&&(at.unobserve(t),delete dt[t._resize_observer_])}}catch(t){i(),console.error("ResizeObserver undefined!")}},throttle:function(t,i){void 0===i&&(i={}),i=G(i,{time:200,keep:!1,opportunity:"end"});var e,n=!1,r=!1,o=!1;return function(){var a=this;if(e=arguments,n)r=!0,o=!0;else{"end"!=i.opportunity&&t.apply(a,e),n=!0;var s=setInterval((function(){r?i.keep||t.apply(a,e):("begin"!=i.opportunity&&(o||"end"==i.opportunity)&&t.apply(a,e),n=!1,o=!1,clearInterval(s)),r=!1}),i.time)}}},TreeLayout:mt,Geometry:Tt};return Ct},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=i();
|
|
11
|
+
var t,i;t=this,i=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,i,e,n,r,o){if(!(t<e))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=e;var a=this.__u*r,s=this.__u*o;return i/=e-t,n/=e-t,this.__MR=[2*i-2*n+a+s,3*n-3*i-2*a-s,a,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),e=i*i;return(i*e*this.__MR[0]+e*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),i=function(){function i(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return i.prototype.setP=function(i){this.__HS={x:[],h:[]};var e,n,r=(i[1][1]-i[0][1])/(i[1][0]-i[0][0]);for(this.__HS.x[0]=i[0][0],e=1;e<i.length;e++){if(i[e][0]<=i[e-1][0])throw new Error("The point position should be increamented!");this.__HS.x[e]=i[e][0],n=e<i.length-1?i[e+1][1]>i[e][1]&&i[e-1][1]>i[e][1]||i[e+1][1]<i[e][1]&&i[e-1][1]<i[e][1]||i[e+1][1]==i[e][1]||i[e-1][1]==i[e][1]?0:(i[e+1][1]-i[e-1][1])/(i[e+1][0]-i[e-1][0]):(i[e][1]-i[e-1][1])/(i[e][0]-i[e-1][0]),this.__HS.h[e-1]=new t(.5*(1-this.__t)).setP(i[e-1][0],i[e-1][1],i[e][0],i[e][1],r,n),r=n}return this},i.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!")},i}(),e=function(t,i){for(var e=[],n=0;n<4;n++)for(var r=0;r<i.length/4;r++)e[4*r+n]=t[n]*i[4*r]+t[n+4]*i[4*r+1]+t[n+8]*i[4*r+2]+t[n+12]*i[4*r+3];return e},n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r=function(){function t(t){void 0===t&&(t=n),this.name="Matrix4",this.__matrix4=t}return t.prototype.setValue=function(t){return void 0===t&&(t=n),this.__matrix4=t,this},t.prototype.move=function(t,i,n,r){return void 0===r&&(r=0),this.__matrix4=e(function(t,i,e,n){void 0===n&&(n=0);var r=Math.sqrt(i*i+e*e+n*n);return[1,0,0,0,0,1,0,0,0,0,1,0,i*t/r,e*t/r,n*t/r,1]}(t,i,n,r),this.__matrix4),this},t.prototype.rotate=function(t,i,n,r,o,a,s){var _=function(t,i,e,n,r,o){if("number"==typeof t&&"number"==typeof i){if("number"!=typeof e?(e=0,n=t,r=i,o=1):"number"==typeof n&&"number"==typeof r&&"number"==typeof o||(n=t,r=i,o=e,t=0,i=0,e=0),t==n&&i==r&&e==o)throw new Error("It's not a legitimate ray!");var a=Math.sqrt((n-t)*(n-t)+(r-i)*(r-i)),s=0!=a?(r-i)/a:1,_=0!=a?(n-t)/a:0,h=(n-t)*_+(r-i)*s,u=o-e,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,i*_-t*s,e*c-t*_*p-i*s*p,-t*_*c-i*s*c-e*p,1],[s,-_,0,0,p*_,p*s,-c,0,_*c,s*c,p,0,t,i,e,1]]}throw new Error("a1 and b1 is required!")}(i,n,r,o,a,s);return this.__matrix4=e(e(e(_[1],function(t){var i=Math.sin(t),e=Math.cos(t);return[e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,i,n,r,o,a){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),this.__matrix4=e(function(t,i,e,n,r,o){return void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),[t,0,0,0,0,i,0,0,0,0,e,0,n-n*t,r-r*i,o-o*e,1]}(t,i,n,r,o,a),this.__matrix4),this},t.prototype.multiply=function(t,i){return void 0===i&&(i=!1),this.__matrix4=i?e(this.__matrix4,t):e(t,this.__matrix4),this},t.prototype.use=function(t,i,n,r){return void 0===n&&(n=0),void 0===r&&(r=1),e(this.__matrix4,[t,i,n,r])},t.prototype.value=function(){return this.__matrix4},t}();function o(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[(n-t)*o-(r-i)*a+t,(n-t)*a+(r-i)*o+i]}var a,s=function(t){var i=t.toString(16);return 1==i.length?"0"+i:i},_=[];function h(t,i,e){void 0===i&&(i=400),void 0===e&&(e=function(){});var n={timer:function(t,i,e){if(!t)throw new Error("Tick is required!");var r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return _.push({id:r,createTime:new Date,tick:t,duration:i,callback:e}),n.start(),r},start:function(){a||(a=setInterval(n.tick,13))},tick:function(){var t,i,e,r,o,a,s,h=_;for((_=[]).length=0,i=0;i<h.length;i++)t=(o=h[i]).createTime,e=o.tick,a=o.duration,r=o.callback,e(s=(s=(+(new Date).valueOf()-t.valueOf())/a)>1?1:s),s<1&&o.id?_.push(o):r(s);_.length<=0&&n.stop()},stop:function(){a&&(clearInterval(a),a=null)}},r=n.timer((function(i){t(i)}),i,e);return function(){var t;for(t in _)if(_[t].id==r)return void(_[t].id=void 0)}}var u=function(t,i){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},u(t,i)};function l(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function e(){this.constructor=t}u(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}function p(t,i,e){if(e||2===arguments.length)for(var n,r=0,o=i.length;r<o;r++)!n&&r in i||(n||(n=Array.prototype.slice.call(i,0,r)),n[r]=i[r]);return t.concat(n||Array.prototype.slice.call(i))}"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,i,e){c.indexOf(i)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+i,e+""):t.setAttribute(i,e+"")},v=d;function g(t,i){d(t,"stroke",i.strokeStyle),d(t,"fill",i.fillStyle),d(t,"stroke-dasharray",i.lineDash.join(","))}function m(t,i){d(t,"fill",i.fillStyle)}function y(t,i){d(t,"stroke",i.strokeStyle),d(t,"fill","none"),d(t,"stroke-dasharray",i.lineDash.join(","))}var E=function(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[+((n-t)*o-(r-i)*a+t).toFixed(7),+((n-t)*a+(r-i)*o+i).toFixed(7)]};function x(t,i,e,n,r,o,a){i<0&&(t+=i,i*=-1);var s,_=[];s=E(0,0,t,r,0),_[0]=s[0],_[1]=s[1],s=E(0,0,i,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,i,s[0],s[1]),_[6]=s[0],_[7]=s[1],a(t,t+i,_[0]+e,_[1]+n,_[4]+e,_[5]+n,_[2]+e,_[3]+n,_[6]+e,_[7]+n,.5*(o-r))}var b=function(t){var i=t.getElementsByTagName("defs");if(i.length<=0){var e=f("defs");return t.appendChild(e),e}return i[0]},w=function(t,i,e,n,r){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");v(t,"dy",{top:.5*i.fontSize,middle:0,bottom:.5*-i.fontSize}[i.textBaseline]),function(t,i){for(var e in i)t.style[e]=i[e]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[i.textAlign],"dominant-baseline":"central","font-size":i.fontSize+"px","font-family":i.fontFamily}),v(t,"x",e),v(t,"y",n),"number"==typeof r&&v(t,"transform","rotate("+(r%=360)+","+e+","+n+")")},T=function(t,i,e,n){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");v(t,"cx",i),v(t,"cy",e),v(t,"r",n)},C=function(t,i){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");v(t,"d",i)},P=function(t,i,e,n,r){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");r<0&&(e-=r*=-1),n<0&&(i-=n*=-1),v(t,"x",i),v(t,"y",e),v(t,"width",n),v(t,"height",r)},R=function(t,i,e,n,r,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,r>o){var _=r;r=o,o=_}s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=1.999999*Math.PI:s%=2*Math.PI,x(a,s,e,n,r,o,(function(e,n,a,s,_,h,u,l,p,c,f){var d=n-e>Math.PI?1:0,g="M"+a+" "+s;f<0&&(f=-f),g+="A"+r+" "+r+" 0 "+d+" 1 "+u+" "+l,"round"==i.arcEndCap?g+="A"+f+" "+f+" 0 1 0 "+p+" "+c:"-round"==i.arcEndCap?g+="A"+f+" "+f+" 0 1 1 "+p+" "+c:g+="L"+p+" "+c,g+="A"+o+" "+o+" 0 "+d+" 0 "+_+" "+h,"round"==i.arcStartCap?g+="A"+f+" "+f+" 0 1 0 "+a+" "+s:"-round"==i.arcStartCap?g+="A"+f+" "+f+" 0 1 1 "+a+" "+s:g+="L"+a+" "+s,"butt"==i.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 i in t){var e=S[i]||i;this.__config[e]=t[i]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,i){return i=i||this.__svg,"string"==typeof t&&(t=f(t)),i.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,i){var e=t;if("string"==typeof t&&(e={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==e)throw new Error("Unsupported drawing method:"+t);return this.appendEl(e,i)},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,i){return c.indexOf(i)>-1&&(i="xlink:"+i),t.getAttribute(i)}(this.__useEl,t);for(var i in t)v(this.__useEl,i,t[i]);return this},t.prototype.fillText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,m(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,y(this.__useEl,this.__config),this},t.prototype.fullText=function(t,i,e,n){return void 0===n&&(n=0),w(this.__useEl,this.__config,i,e,n),this.__useEl.textContent=t,g(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),m(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),y(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,i,e,n,r,o){return R(this.__useEl,this.__config,t,i,e,n,r,o),g(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,i,e){return T(this.__useEl,t,i,e),m(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,i,e){return T(this.__useEl,t,i,e),y(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,i,e){return T(this.__useEl,t,i,e),g(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),m(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),y(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,i,e,n){return P(this.__useEl,t,i,e,n),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,i){return this.__currentPosition=[t,i],this.__path+="M"+t+" "+i,this},t.prototype.lineTo=function(t,i){return this.__currentPosition=[t,i],this.__path+=(""==this.__path?"M":"L")+t+" "+i,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,i,e,n,r){var a=o(t,i,n/180*Math.PI,t+e,i),s=o(t,i,(n+r)/180*Math.PI,t+e,i);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"+e+","+e+" 0 "+(r>180||r<-180?1:0)+","+(r>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__path+="Q"+t+" "+i+","+e+" "+n,this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__path+="C"+t+" "+i+","+e+" "+n+","+r+" "+o,this},t.prototype.bind=function(t,i){return this.__useEl.addEventListener(t,(function(t){i.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=b(t),a="vislite-lg-"+(new Date).valueOf()+"-"+Math.random(),s=f("linearGradient");o.appendChild(s),v(s,"id",a),v(s,"x1",i+"%"),v(s,"y1",e+"%"),v(s,"x2",n+"%"),v(s,"y2",r+"%");var _={value:function(){return"url(#"+a+")"},setColor:function(t,i){var e=f("stop");return s.appendChild(e),v(e,"offset",100*t+"%"),v(e,"style","stop-color:"+i+";"),_}};return _}(this.__svg,t,i,e,n)},t.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=b(t),o="vislite-rg-"+(new Date).valueOf()+"-"+Math.random(),a=f("radialGradient");r.appendChild(a),v(a,"id",o),v(a,"cx",i+"%"),v(a,"cy",e+"%"),v(a,"r",n+"%");var s={value:function(){return"url(#"+o+")"},setColor:function(t,i){var e=f("stop");return a.appendChild(e),v(e,"offset",100*t+"%"),v(e,"style","stop-color:"+i+";"),s}};return s}(this.__svg,t,i,e)},t}(),M=function(t){function i(i){if(!i)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var e=i.clientWidth,n=i.clientHeight,r=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.appendChild(r),r.setAttribute("width",e+""),r.setAttribute("height",n+""),r.setAttribute("viewBox","0 0 "+e+" "+n),t.call(this,r)||this}return l(i,t),i}(A),L=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},I=function(t,i,e,n,r,o,a,s){if(r>o){var _=r;r=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,e,n,r,o,(function(a,s,_,h,u,l,p,c,f,d,v){v<0&&(v=-v),t.beginPath(),t.moveTo(_,h),t.arc(e,n,r,a,s,!1),"round"==i.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,s-Math.PI,s,!0):"-round"==i.arcEndCap?t.arc(.5*(p+f),.5*(c+d),v,s-Math.PI,s,!1):t.lineTo(f,d),t.arc(e,n,o,s,a,!0),"round"==i.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,a,a-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(_+u),.5*(h+l),v,a,a-Math.PI,!1):t.lineTo(_,h)})),"butt"==i.arcStartCap&&t.closePath(),t},k=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},z=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function N(t,i,e,n,r){for(var o=0,a="",s=0;s<i.length;s++)t.measureText(a+i[s]).width>e||/\n$/.test(a)?(r(a,((o+=1)-.5)*n),a=i[s]):s==i.length-1?(o+=1,r(a+i[s],(o-.5)*n)):a+=i[s];return o*n}var U=function(){function t(t,i,e,n,r){void 0===i&&(i={}),void 0===n&&(n=!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",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fillText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.strokeText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fullText(t,i,e,n),this.__isPainter&&this.__onlyRegion||(this.painter.save(),L(this.painter,this.__specialConfig,i,e,n),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.fillText(t,0,i)}));return this.painter.restore(),_},t.prototype.strokeTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.strokeText(t,0,i)}));return this.painter.restore(),_},t.prototype.fullTexts=function(t,i,e,n,r,o){var a=this;void 0===r&&(r=1.2),void 0===o&&(o=0);var s=0;if(this.__region&&(s=this.__region.fillTexts(t,i,e,n,r)),this.__isPainter&&this.__onlyRegion)return s;this.painter.save(),L(this.painter,this.__specialConfig,i,e,o);var _=N(this.painter,t,n,this.__specialConfig.fontSize*r,(function(t,i){a.painter.fillText(t,0,i),a.painter.strokeText(t,0,i)}));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,i){return this.__region&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<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,i,e,n){return this.__region&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,n,r,o){return this.__region&&this.__region.fillArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,i,e,n,r,o).fill(),this},t.prototype.strokeArc=function(t,i,e,n,r,o){return this.__region&&this.__region.strokeArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||I(this.painter,this.__specialConfig,t,i,e,n,r,o).stroke(),this},t.prototype.fullArc=function(t,i,e,n,r,o){return this.__region&&this.__region.fullArc(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||(I(this.painter,this.__specialConfig,t,i,e,n,r,o),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||k(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||k(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(k(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||z(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||z(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(z(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t.prototype.drawImage=function(t,i,e,n,r,o){var a=this;return void 0===o&&(o=!1),new Promise((function(s){if(a.__region&&(a.__region.fillRect(i,e,n,r),s({})),a.__isPainter&&a.__onlyRegion)return a;if("string"!=typeof t||o)a.painter.drawImage(t,i,e,n,r),s({});else{var _=new Image;_.onload=function(){a.painter.drawImage(_,i,e,n,r),s({})},_.src=t}}))},t}();function F(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}var O={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},G=function(t){function i(i,e,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new U(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__regionAssemble=F(0,255,10,3),o.__scaleSize=r,o.setRegion(""),o}return l(i,t),i.prototype.config=function(t){for(var i in t){var e=O[i]||i;this.useConfig(e,t[i])}return this},i.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},i.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[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},i.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,a=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?a():r.then((function(t){o=t,a()}))}))},i.prototype.textWidth=function(t){this.painter.save(),L(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},i.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},i.prototype.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},i.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r),a={value:function(){return o},setColor:function(t,i){return o.addColorStop(t,i),a}};return a}(this.painter,t,i,e,n)},i.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n),o={value:function(){return r},setColor:function(t,i){return r.addColorStop(t,i),o}};return o}(this.painter,t,i,e)},i.prototype.getColor=function(t,i){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},i}(U);function B(t,i){for(var e in t)i[e]=t[e];return i}var D=function(t){function i(i,e){void 0===e&&(e={});var n=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");e=B(e,{region:!0,willReadFrequently:!1});var r,o=i.clientWidth,a=i.clientHeight,s=null,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],s=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(s=document.createElement("canvas")),_._vislite_canvas_=[r,s],i.setAttribute("vislite","Canvas"));for(var h=[s,r],u=0;u<h.length;u++){var l=h[u];l&&(l.style.width=o+"px",l.setAttribute("width",u*o+o+""),l.style.height=a+"px",l.setAttribute("height",u*a+a+""))}return(n=t.call(this,r,s,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=r,n.painter.scale(2,2),n}return l(i,t),i.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},i}(G);function H(t,i,e,n){void 0===e&&(e={}),void 0===n&&(n="scaleToFill");for(var r=["experimental-webgl","webkit-3d","moz-webgl"],o=t.getContext("webgl",e),a=0;a<r.length;a++){try{o=t.getContext(r[a],e)}catch(t){}if(o)break}if(!o)throw new Error("Non canvas or browser does not support webgl.");var s=o.canvas.width,_=o.canvas.height,h=i,u=i;"aspectFit"==n?s>_?h*=_/s:_>s&&(u*=s/_):"aspectFill"==n&&(s>_?u*=s/_:_>s&&(h*=_/s));var l=s*h,p=_*u;return o.viewport(.5*(s-l),.5*(_-p),l,p),o.depthFunc(o.LEQUAL),o.enable(o.DEPTH_TEST),o}function q(t){var i=t.drawingBufferWidth,e=t.drawingBufferHeight,n=new Uint8Array(4*i*e);return t.readPixels(0,0,i,e,t.RGBA,t.UNSIGNED_BYTE,n),function(t,r){return"rgba("+n[4*((r=e-r)*i+t)]+","+n[4*(r*i+t)+1]+","+n[4*(r*i+t)+2]+","+n[4*(r*i+t)+3]+")"}}var V=function(){function t(t,i){void 0===i&&(i=!1),this.__painter=t,this.__isElement=i,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=i?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,i,e,n){var r=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(r,i,n)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,i,e,n){return void 0===n&&(n=0),function(t,i,e,n,r,o,a){t.vertexAttribPointer(i,e,n,a,r,o),t.enableVertexAttribArray(i)}(this.__painter,t,i,this.__painter.FLOAT,e*this.__fsize,n*this.__fsize,!1),this},t}(),W=function(){function t(t,i,e){void 0===e&&(e=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[i],this.__texture=function(t,i,e){var n=t.createTexture();return t.activeTexture(t["TEXTURE"+e]),t.bindTexture(i,n),n}(t,this.__type,e),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,i,e,n,r,o){t.texImage2D(i,e,n,n,r,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,i,e){return function(t,i,e,n,r,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,e,n,a,s,0,n,r,null),t.bindTexture(i,_),t.texImage2D(h,e,n,n,r,o[l]));t.generateMipmap(i)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,i,e,this.__texture),this},t}(),X={};function Y(t,i,e){var n=t+"-"+e;return X[n]||(X[n]=new W(i,e)),X[n]}var j=function(t,i,e){var n=t.createShader(i);if(null==n)throw new Error("Unable to create shader!");if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(n));return n},$=function(){function t(t){this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,i){return this.program=function(t,i,e){var n=j(t,t.VERTEX_SHADER,i),r=j(t,t.FRAGMENT_SHADER,e),o=t.createProgram();if(t.attachShader(o,n),t.attachShader(o,r),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,i),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}",it="precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}",et="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}",nt="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}",rt={};function ot(t,i,e,n,r){var o,a,s,_,h,u,l,p,c,f,d,v,g,m,y,E,x,b,w,T,C,P,R,S,A=function(t,i,e){var n,r,o=t+(e.material.color?"1":"0")+(e.material.colors?"1":"0")+(e.material.image?"1":"0")+(e.material.cube?"1":"0");if(rt[o])return rt[o].use();var a=(n={},n[t+"1000"]=Z,n[t+"0100"]=J,n[t+"0010"]=Q,n[t+"0001"]=K,n)[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=(r={},r[t+"1000"]=tt,r[t+"0100"]=it,r[t+"0010"]=et,r[t+"0001"]=nt,r)[o],_=new $(i).compile(a,s).use();return rt[o]=_,_}(t,i,e);if(new V(i).use().write(e.geometry.attributes.position.array).divide(i.getAttribLocation(A.program,"a_position"),e.geometry.attributes.position.itemSize,e.geometry.attributes.position.itemSize,0),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_world"),!1,r.matrix),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_proporion"),!1,r.proporion),i.uniformMatrix4fv(i.getUniformLocation(A.program,"u_matrix_mesh"),!1,n.matrix),e.geometry.attributes.normal&&new V(i).use().write(e.geometry.attributes.normal.array).divide(i.getAttribLocation(A.program,"a_normal"),e.geometry.attributes.normal.itemSize,e.geometry.attributes.normal.itemSize,0),"color"in e.material&&i.uniform4f(i.getUniformLocation(A.program,"u_color"),null===(o=e.material.color)||void 0===o?void 0:o.r,null===(a=e.material.color)||void 0===a?void 0:a.g,null===(s=e.material.color)||void 0===s?void 0:s.b,null===(_=e.material.color)||void 0===_?void 0:_.alpha),"colors"in e.material)new V(i).use().write(null===(h=e.material.colors)||void 0===h?void 0:h.array).divide(i.getAttribLocation(A.program,"a_color"),null===(u=e.material.colors)||void 0===u?void 0:u.itemSize,null===(l=e.material.colors)||void 0===l?void 0:l.itemSize,0);else if("cube"in e.material){var M=(null===(c=null===(p=e.material.cube)||void 0===p?void 0:p.right)||void 0===c?void 0:c.image.value).width;i.uniform1i(i.getUniformLocation(A.program,"u_texture"),0),Y(t,i,"cube").useCube([null===(d=null===(f=e.material.cube)||void 0===f?void 0:f.right)||void 0===d?void 0:d.image.value,null===(g=null===(v=e.material.cube)||void 0===v?void 0:v.left)||void 0===g?void 0:g.image.value,null===(y=null===(m=e.material.cube)||void 0===m?void 0:m.top)||void 0===y?void 0:y.image.value,null===(x=null===(E=e.material.cube)||void 0===E?void 0:E.bottom)||void 0===x?void 0:x.image.value,null===(w=null===(b=e.material.cube)||void 0===b?void 0:b.far)||void 0===w?void 0:w.image.value,null===(C=null===(T=e.material.cube)||void 0===T?void 0:T.near)||void 0===C?void 0:C.image.value],M,M)}else"image"in e.material&&(i.uniform1i(i.getUniformLocation(A.program,"u_sampler"),0),new V(i).use().write(null===(P=e.geometry.attributes.uv)||void 0===P?void 0:P.array).divide(i.getAttribLocation(A.program,"a_textcoord"),null===(R=e.geometry.attributes.uv)||void 0===R?void 0:R.itemSize,2,0),Y(t,i,"2d").useImage(null===(S=e.material.image)||void 0===S?void 0:S.value));e.geometry.index?(new V(i,!0).use().write(e.geometry.index.array),i.drawElements(i[e.geometry.type],e.geometry.index.count,i.UNSIGNED_BYTE,0)):i.drawArrays(i[e.geometry.type],0,e.geometry.attributes.position.count)}var at,st=!1,_t=function(){function t(t,i,e){this.name="WebGL",this.__getColor=function(t,i){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=F(0,1,.2,3),this.__regionName="",this.__regionColor=[0,0,0,1],this.__scene={children:[],matrix:new r([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),i&&(this.__regionPainter=H(i,10,{},e));var n=this.painter.canvas.width/this.painter.canvas.height,o=1,a=1;n>1?o=1/n:a=n;var s=Math.min(o,a);this.__proporion=[o,0,0,0,0,a,0,0,0,0,s,0,0,0,0,1]}return t.prototype.matrix=function(t){return new r(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 i=0;i<this.__scene.children.length;i++)this.draw(this.__scene.children[i],t);return this},t.prototype.draw=function(t,i){var e;void 0===i&&(i=!1),i||(st=!0);var n={matrix:null===(e=t.matrix)||void 0===e?void 0:e.value()},r={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var o=0;o<t.mesh.length;o++)i?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]}}},n,r),this.__getColor=q(this.__regionPainter)):ot("region"+this.__unique,this.painter,t.mesh[o],n,r)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new r),"region"in t||(t.region="");for(var i=0;i<t.mesh.length;i++){var e=t.mesh[i];e.geometry.attributes.normal&&Array.isArray(e.geometry.attributes.normal.array)&&(e.geometry.attributes.normal.array=new Float32Array(e.geometry.attributes.normal.array)),e.geometry.attributes.position&&Array.isArray(e.geometry.attributes.position.array)&&(e.geometry.attributes.position.array=new Float32Array(e.geometry.attributes.position.array)),e.geometry.attributes.uv&&Array.isArray(e.geometry.attributes.uv.array)&&(e.geometry.attributes.uv.array=new Float32Array(e.geometry.attributes.uv.array)),e.geometry.index&&Array.isArray(e.geometry.index.array)&&(e.geometry.index.array=new Uint8Array(e.geometry.index.array)),e.material.colors&&Array.isArray(e.material.colors.array)&&(e.material.colors.array=new Float32Array(e.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,i){var e=this;return st&&this.review(!0),st=!1,new Promise((function(n){var r=e.__getColor(t,i);for(var o in e.__regionList){var a=e.__regionList[o];if("rgba("+255*a[0]+","+255*a[1]+","+255*a[2]+","+255*a[3]+")"==r){n(o);break}}n("")}))},t}(),ht=function(t){function i(i,e){if(void 0===e&&(e={}),!i)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");e=B(e,{region:!0});var n,r=i.clientWidth,o=i.clientHeight,a=null,s=i;s._vislite_canvas_?(n=s._vislite_canvas_[0],a=s._vislite_canvas_[1]):(e.region&&(a=document.createElement("canvas"),i.appendChild(a),a.style.position="absolute",a.style.zIndex="-1",a.style.opacity="0"),n=document.createElement("canvas"),i.appendChild(n),s._vislite_canvas_=[n,a],i.setAttribute("vislite","WebGL"));for(var _=0,h=[n,a];_<h.length;_++){var u=h[_];u&&(u.style.width=r+"px",u.setAttribute("width",r+""),u.style.height=o+"px",u.setAttribute("height",o+""))}return t.call(this,n,a,e.mode)||this}return l(i,t),i}(_t),ut=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return l(i,t),i.prototype.compile=function(i,e){return e?t.prototype.compile.call(this,i,e):t.prototype.compile.call(this,{color:Z,colors:J,image:Q,cube:K}[i],{color:tt,colors:it,image:et,cube:nt}[i]),this},i}($),lt=function(t,i,e,n){var r=Math.cos(t),o=Math.sin(t);return[i*r-e*o,i*o+e*r,n]},pt=function(){function t(t,i){void 0===t&&(t=7),void 0===i&&(i=[107,36]),this.name="Eoap",this.__scale=t,this.__center=i}return t.prototype.use=function(t,i){var e,n,r,o,a,s,_=(e=(360-i)/180*Math.PI,n=100*this.__scale,r=0,o=0,a=Math.cos(e),s=Math.sin(e),[o*s+n*a,r,o*a-n*s]);return _=lt(t/180*Math.PI,_[0],_[1],_[2]),_=lt((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,i,e,n){var r=Math.cos(t),o=Math.sin(t);return[i,e*r-n*o,e*o+n*r]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),ct=function(t,i){void 0===t&&(t=7),void 0===i&&(i=[107,36]),this.name="Mercator";var e=100*t*Math.PI/180,n=e*i[0],r=-1*e*i[1];this.use=function(t,i){return[.8*(e*t-n),-1*e*i-r,0]}},ft=function(t,i){var e=t.getBoundingClientRect();return{x:i.clientX-e.left,y:i.clientY-e.top}},dt={},vt=0,gt=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=B(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,i){return void 0===i&&(i={}),function(t,i,e){var n=function(t,i){var e,n,r={},o=i.root(t);e=n=i.id(o),r[e]={data:o,pid:null,id:e,isOpen:!0,show:!0,children:[]};var a=1;return function n(o,s){var _=i.children(o,t);a+=_?_.length:0;for(var h=0;_&&h<_.length;h++)e=i.id(_[h]),r[s].children.push(e),r[e]={data:_[h],pid:s,id:e,isOpen:!0,show:!0,children:[]},n(_[h],e)}(o,e),{rid:n,value:r,num:a}}(t,i),r=n.value,o=n.rid;if(1==n.num)return r[o].left=.5,r[o].top=.5,r[o].show=!0,{deep:1,node:r,root:o,size:1};var a=[],s=0,_=0;for(var h in e[o]?(r[o].left=.5,r[o].top=.5,r[o].show=!0,s=1):function t(i,n){n>_&&(_=n);var o=0;if(!e[i.id])for(o=0;o<i.children.length;o++)t(r[i.children[o]],n+1);if(r[i.id].left=n+.5,0==o?(null==a[n]&&(a[n]=-.5),null==a[n-1]&&(a[n-1]=-.5),r[i.id].top=a[n]+1,a[n]+1+.5*(r[i.pid].children.length-1)-1<a[n-1]&&(r[i.id].top=a[n-1]+1-.5*(r[i.pid].children.length-1))):r[i.id].top=.5*(r[i.children[0]].top+r[i.children[o-1]].top),r[i.id].top<=a[n])var h=a[n]+1-r[i.id].top((function t(i,e){r[i].top+=h,a[e]<r[i].top&&(a[e]=r[i].top);for(var n=0;n<r[i].children.length;n++)t(r[i].children[n],e+1)}))(i.id,n);a[n]=r[i.id].top,r[i.id].top+.5>s&&(s=r[i.id].top+.5)}(r[o],0),e)e[h]&&(r[h].isOpen=!1,function t(i,e,n){for(var o=0;o<r[i].children.length;o++)r[r[i].children[o]].left=e,r[r[i].children[o]].top=n,r[r[i].children[o]].show=!1,t(r[i].children[o],e,n)}(h,r[h].left,r[h].top));return{node:r,root:o,size:s,deep:_+1}}(t,this.__config,i)},t}(),mt=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.name="TreeLayout",i.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},i.__noOpens={},i}return l(i,t),i.prototype.setOption=function(t){return B(t,this.__option),this},i.prototype.use=function(i,e){void 0===e&&(e={});var n=t.prototype.use.call(this,i,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var r in n.node)if(!n.node[r].show){var a=0,s=r;do{s=n.node[s].pid,a++}while(!n.node[s].show);n.node[r].left+=this.__option.offsetX*a,n.node[r].top+=this.__option.offsetY*a}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var _=this.__option.height/n.size,h=this.__option.width/(n.deep-1),u=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var r in n.node)1==n.deep?(n.node[r].left=this.__option.x+.5*this.__option.width*l,n.node[r].top=this.__option.y):(n.node[r].left=this.__option.x+(n.node[r].left-.5)*h*l,n.node[r].top=n.node[r].top*_+u)}else if("TB"==this.__option.direction||"BT"==this.__option.direction)for(var r in _=this.__option.width/n.size,h=this.__option.height/(n.deep-1),u=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1,n.node)if(1==n.deep)n.node[r].left=this.__option.x,n.node[r].top=this.__option.y+.5*this.__option.height*l;else{var p=n.node[r].left;n.node[r].left=n.node[r].top*_+u,n.node[r].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/n.size,v=this.__option.radius/(n.deep-1);for(var r in n.node)if(.5==n.node[r].left)n.node[r].left=c,n.node[r].top=f;else{var g=o(c,f,d*n.node[r].top,c+(n.node[r].left-.5)*v,f);n.node[r].left=g[0],n.node[r].top=g[1]}}return n},i.prototype.bind=function(t,i,e){return void 0===e&&(e={}),this.__rback=i,this.__oralTree=t,this.__noOpens=e,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},i.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},i.prototype.doUpdate=function(){var t=this,i=this.use(this.__oralTree,this.__noOpens),e=JSON.parse(JSON.stringify(i));h((function(n){if(t.__preTree)for(var r in e.node)(i.node[r].show||t.__preTree.node[r].show)&&(e.node[r].show=!0,e.node[r].left=t.__preTree.node[r].left+(i.node[r].left-t.__preTree.node[r].left)*n,e.node[r].top=t.__preTree.node[r].top+(i.node[r].top-t.__preTree.node[r].top)*n);t.__rback(e)}),this.__option.duration,(function(){t.__preTree=i,t.__rback(t.__preTree)}))},i.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},i.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},i.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},i}(gt),yt=function(t,i,e){void 0===e&&(e=2*Math.PI);var n=Math.ceil(e/Math.asin(t/i)*2);return isNaN(n)||n<12?12:n};function Et(t,i,e,n,r,a,s,_,h){var u,l;if(void 0===_&&(_=0),void 0===h&&(h=2*Math.PI),4==a){var p=r/1.414;u=i+p,l=n+p}else u=i+r,l=n;var c=[u,l];0!=_&&(c=o(i,n,_,u,l));for(var f=[],d=h/a,v=0;v<a;v++)f.push(i,e,n),t&&f.push(0,s,0),f.push(c[0],e,c[1]),t&&f.push(0,s,0),c=o(i,n,d*(v+1),u,l),f.push(c[0],e,c[1]),t&&f.push(0,s,0);return f}function xt(t,i,e,n,r,a,s,_,h){void 0===_&&(_=0),void 0===h&&(h=2*Math.PI);var u,l=[];u=4==s?o(i,n,.25*Math.PI,i-r,n):[i+r,n],0!=_&&(u=o.apply(void 0,p([i,n,_],u,!1)));for(var c,f=h/s,d=h/(2*s),v=[],g=0;g<s;g++){if(c=o.apply(void 0,p([i,n,f],u,!1)),t){var m=o.apply(void 0,p([i,n,d],u,!1));v=[m[0],0,m[1]]}l.push.apply(l,p([u[0],e,u[1]],v,!1)),l.push.apply(l,p([u[0],e+a,u[1]],v,!1)),l.push.apply(l,p([c[0],e+a,c[1]],v,!1)),l.push.apply(l,p([u[0],e,u[1]],v,!1)),l.push.apply(l,p([c[0],e,c[1]],v,!1)),l.push.apply(l,p([c[0],e+a,c[1]],v,!1)),u=c}return l}function bt(t,i,e,n,r,a,s){var _,h=[i,e+r,n],u=2*Math.PI/a;t&&h.push(0,r,0);for(var l=function(){h.push.apply(h,h.slice(h.length-(t?12:6)))},p=1;p<.5*a;p++){_=o(i,e,u*p,i,e+r),p>1&&l();var c=o(i,n,u*s,_[0],n);h.push(c[0],_[1],c[1]),t&&h.push(c[0]-i,_[1]-e,c[1]-n),p>1&&l();var f=o(i,n,u*(s+1),_[0],n);h.push(f[0],_[1],f[1]),t&&h.push(f[0]-i,f[1]-e,f[1]-n)}return l(),h.push(i,e-r,n),t&&h.push(0,-r,0),h}function wt(t,i,e,n,r,o){return function(a,s,_,h){if(t==n&&e==o)return[a,s,_];var u,l,p,c=a-(h?0:t),f=s-(h?0:i),d=_-(h?0:e),v=n-t,g=r-i,m=o-e,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:i),d+(h?0:e)]}}function Tt(t,i){if(t){for(var e=[],n=0;n<i.length;n+=9){var r=[i[n+3]-i[n],i[n+4]-i[n+1],i[n+5]-i[n+2]],o=[i[n+6]-i[n],i[n+7]-i[n+1],i[n+8]-i[n+2]],a=[r[1]*o[2]-o[1]*r[2],r[2]*o[0]-r[0]*o[2],r[0]*o[1]-r[1]*o[2]];e.push.apply(e,p(p(p(p(p([i[n],i[n+1],i[n+2]],a,!1),[i[n+3],i[n+4],i[n+5]],!1),a,!1),[i[n+6],i[n+7],i[n+8]],!1),a,!1))}return e}return i}var Ct=function(){function t(t){void 0===t&&(t={}),this.name="Geometry",this.__option=B(t,{precision:.1,normal:!1})}return t.prototype.config=function(t){for(var i in t)this.__option[i]=t[i];return this},t.prototype.splitNum=function(t,i){return yt(this.__option.precision,t,i)},t.prototype.rotateLine=function(t,i,e,n,r,o){var a=this,s=wt(t,i,e,n,r,o);return function(t,i,e){return s(t,i,e,a.__option.normal)}},t.prototype.prismHorizontal=function(t,i,e,n,r,o,a,s){return Et(this.__option.normal,t,i,e,n,r,o,a,s)},t.prototype.prismVertical=function(t,i,e,n,r,o,a,s){return xt(this.__option.normal,t,i,e,n,r,o,a,s)},t.prototype.sphereFragment=function(t,i,e,n,r,o){return bt(this.__option.normal,t,i,e,n,r,o)},t.prototype.pie=function(t,i,e,n,r,a,s){var _=yt(this.__option.precision,n,s),h=o(t,e,a,t+n,e),u=o(t,e,a+s,t+n,e);return[{name:"bottom",points:Et(this.__option.normal,t,i,e,n,_,r>0?-1:1,a,s),length:3*_,method:"TRIANGLES"},{name:"top",points:Et(this.__option.normal,t,i+r,e,n,_,r>0?1:-1,a,s),length:3*_,method:"TRIANGLES"},{name:"side",points:xt(this.__option.normal,t,i,e,n,r,_,a,s),length:6*_,method:"TRIANGLES"},{name:"begin",points:Tt(this.__option.normal,[t,i,e,t,i+r,e,h[0],i,h[1],h[0],i+r,h[1],h[0],i,h[1],t,i+r,e]),length:6,method:"TRIANGLES"},{name:"end",points:Tt(this.__option.normal,[t,i,e,u[0],i,u[1],t,i+r,e,u[0],i+r,u[1],t,i+r,e,u[0],i,u[1]]),length:6,method:"TRIANGLES"}]},t.prototype.cylinder=function(t,i,e,n,r,o,a){var s=yt(this.__option.precision,n);return 5==arguments.length?this.prism(t,i,e,n,r,s):this.prism(t,i,e,n,r,o,a,s)},t.prototype.prism=function(t,i,e,n,r,o,a,s){var _,h,u,l,p=null;6==arguments.length?(l=r,s=o):(l=(i>o?-1:1)*Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-e)*(a-e)),p=wt(t,i,e,r,o,a));var c=[{name:"bottom",points:[],length:0,method:"TRIANGLES"},{name:"top",points:[],length:0,method:"TRIANGLES"},{name:"side",points:[],length:0,method:"TRIANGLES"}];(_=c[0].points).push.apply(_,Et(this.__option.normal,t,i,e,n,s,l>0?-1:1)),(h=c[1].points).push.apply(h,Et(this.__option.normal,t,i+l,e,n,s,l>0?1:-1)),(u=c[2].points).push.apply(u,xt(this.__option.normal,t,i,e,n,l,s));for(var f=0;f<c.length;f++){if(p){for(var d=[],v=!1,g=0;g<c[f].points.length;g+=3)d.push.apply(d,p(c[f].points[g],c[f].points[g+1],c[f].points[g+2],this.__option.normal&&v)),v=!v;c[f].points=d}c[f].length=c[f].points.length/(this.__option.normal?6:3)}return c},t.prototype.sphere=function(t,i,e,n){for(var r,o=yt(this.__option.precision,n),a=[{name:"surface",points:[],length:0,method:"TRIANGLES"}],s=0;s<o;s++)(r=a[0].points).push.apply(r,bt(this.__option.normal,t,i,e,n,o,s));return a[0].length=a[0].points.length/(this.__option.normal?6:3),a},t}(),Pt={Cardinal:i,Hermite:t,Matrix4:r,rotate:o,move:function(t,i,e,n,r){var o=Math.sqrt(t*t+i*i);return[t*e/o+n,i*e/o+r]},scale:function(t,i,e,n,r){return[e*(n-t)+t,e*(r-i)+i]},getLoopColors:function(t,i){void 0===i&&(i=1);var e=["rgba(84,112,198,"+i+")","rgba(145,204,117,"+i+")","rgba(250,200,88,"+i+")","rgba(238,102,102,"+i+")","rgba(115,192,222,"+i+")","rgba(59,162,114,"+i+")","rgba(252,132,82,"+i+")","rgba(154,96,180,"+i+")","rgba(234,124,204,"+i+")"],n=[];if(t<=e.length)return e;if(t%e.length==0)for(var r=0;r<t/e.length;r++)n=n.concat(e);else{for(var o=1;o<t/e.length;o++)n=n.concat(e);if(t%e.length==1)n=n.concat(e[4]);else for(var a=0;a<t%e.length;a++)n=n.concat(e[a])}return n},formatColor:function(t,i){var e=document.getElementsByTagName("head")[0];e.style.color=t;for(var n=(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(e,null):e.currentStyle).getPropertyValue("color").replace(/rgba?\(/,"").replace(")","").split(","),r=0;r<n.length;r++)n[r]=+n[r];switch(n.push(1),i){case"3d":return[n[0]/255,n[1]/255,n[2]/255,n[3]];case"rgba":return"rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(n[3],")");case"rgb":return"rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")");case"hexAlpha":return"#".concat(s(n[0])).concat(s(n[1])).concat(s(n[2])).concat(s(+(255*n[3]).toFixed(0)));case"hex":return"#".concat(s(n[0])).concat(s(n[1])).concat(s(n[2]))}throw new Error("Unsupported color format: "+i)},animation:h,ruler:function(t,i,e,n){if(t<i){var r=i;i=t,t=r}else if(t==i)return[t];var o=function(t){for(var i=t<100&&t>-100?10:.1,e=-1,n=t;10==i?n>=-100&&n<=100:n<=-100||n>=100;)e+=1,n*=i;if(10==i)return Math.pow(10,e);for(var r="0.",o=1;o<e;o++)r+="0";return+(r+"1")}(t-i),a=Math.ceil((t-i)*o/e),s=function(e){var n=({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+e]||a+e)/o,r=Math.floor(i/n)*n,s=[];s.push(r);for(var _=1;s[s.length-1]<t;_++)s.push(r+n*_);return s},_=s(0),h=function(){for(var t=[],e=_[_.length-1]-(null==n?void 0:n.max),r=0;r<_.length;r++)r+1<_.length&&_[r+1]-e<i||t.push(_[r]-e);return t},u=function(){for(var i=[],e=_[0]-(null==n?void 0:n.min),r=0;r<_.length&&(i[r]=_[r]-e,!(t<=i[r]));r++);return i};if(n){if("max"in n&&"min"in n&&n.max>=t&&n.min<=i){var l=function(){if(_[0]>=n.min&&_[_.length-1]<=n.max)return!0;var t=h();if(t[0]>=n.min&&t[t.length-1]<=n.max)return _=t,!0;var i=u();return i[0]>=n.min&&i[t.length-1]<=n.max?(_=i,!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 n&&n.max>=t?n.max<_[_.length-1]&&(_=h()):"min"in n&&n.min<=i&&n.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,i,e){if(void 0===i&&(i=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,r=t.clientWidth,o=t.clientHeight,a=t;return a._vislite_canvas_?n=a._vislite_canvas_:(n=document.createElement("canvas"),t.appendChild(n),a._vislite_canvas_=n,t.setAttribute("vislite","WebGL")),n.style.width=r+"px",n.setAttribute("width",r+""),n.style.height=o+"px",n.setAttribute("height",o+""),H(n,i,{},e)},Shader:ut,Texture:W,Buffer:V,Eoap:pt,Mercator:ct,viewHandler:function(t){var i=document.getElementsByTagName("body")[0];i.addEventListener("keydown",(function(i){var e=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(i);"up"==e?t({type:"lookUp",normal:[],value:.1,event:i}):"down"==e?t({type:"lookDown",normal:[],value:.1,event:i}):"left"==e?t({type:"lookLeft",normal:[],value:.1,event:i}):"right"==e&&t({type:"lookRight",normal:[],value:.1,event:i})}));var e=null,n=function(n){if(null==e)t({type:"hover",normal:[],value:0,event:n});else{var r=ft(i,n),o=[r.x-e.x,r.y-e.y],a=[o[1],o[0],0];if(0==a[0]&&0==a[1])return;t({type:"rotate",normal:a,value:.01*(Math.abs(r.x-e.x)+Math.abs(r.y-e.y)),event:n}),e=r}};i.addEventListener("mousedown",(function(t){e=ft(i,t)})),i.addEventListener("mouseup",(function(){e=null})),i.addEventListener("mousemove",(function(t){n(t)})),i.addEventListener("touchend",(function(){e=null})),i.addEventListener("touchstart",(function(t){e=ft(i,t)})),i.addEventListener("touchmove",(function(t){n(t.touches[0])}));var r=function(i,e){0!=i&&t({type:"scale",value:i<0?.899:1.101,normal:[],event:e})};i.addEventListener("mousewheel",(function(t){r(t.wheelDelta,t)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){r(-1*t.detail,t)}),!1)},resizeObserver:function(t,i){try{return at||(at=new ResizeObserver((function(t){for(var i=0,e=t;i<e.length;i++){var n=e[i];dt[n.target._resize_observer_]()}}))),vt++,t._resize_observer_=vt,dt[vt]=i,at.observe(t),function(){at&&(at.unobserve(t),delete dt[t._resize_observer_])}}catch(t){i(),console.error("ResizeObserver undefined!")}},throttle:function(t,i){void 0===i&&(i={}),i=B(i,{time:200,keep:!1,opportunity:"end"});var e,n=!1,r=!1,o=!1;return function(){var a=this;if(e=arguments,n)r=!0,o=!0;else{"end"!=i.opportunity&&t.apply(a,e),n=!0;var s=setInterval((function(){r?i.keep||t.apply(a,e):("begin"!=i.opportunity&&(o||"end"==i.opportunity)&&t.apply(a,e),n=!1,o=!1,clearInterval(s)),r=!1}),i.time)}}},TreeLayout:mt,Geometry:Ct};return Pt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=i();
|
package/lib/move/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,r;e=this,r=function(){"use strict";var e,r={},n=0;return function(o,t){try{return e||(e=new ResizeObserver((function(e){for(var n=0,o=e;n<o.length;n++){var t=o[n];r[t.target._resize_observer_]()}}))),n++,o._resize_observer_=n,r[n]=t,e.observe(o),function(){e&&(e.unobserve(o),delete r[o._resize_observer_])}}catch(e){t(),console.error("ResizeObserver undefined!")}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_resizeObserver=r();
|
package/lib/rotate/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,t;e=this,t=function(){"use strict";return function(e,t,n,o,i){var f=Math.cos(n),d=Math.sin(n);return[(o-e)*f-(i-t)*d+e,(o-e)*d+(i-t)*f+t]}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_rotate=t();
|
package/lib/ruler/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var n,e;n=this,e=function(){"use strict";return function(n,e,r,t){if(n<e){var i=e;e=n,n=i}else if(n==e)return[n];var f=function(n){for(var e=n<100&&n>-100?10:.1,r=-1,t=n;10==e?t>=-100&&t<=100:t<=-100||t>=100;)r+=1,t*=e;if(10==e)return Math.pow(10,r);for(var i="0.",f=1;f<r;f++)i+="0";return+(i+"1")}(n-e),u=Math.ceil((n-e)*f/r),a=function(r){var t=({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}[u+r]||u+r)/f,i=Math.floor(e/t)*t,a=[];a.push(i);for(var o=1;a[a.length-1]<n;o++)a.push(i+t*o);return a},o=a(0),l=function(){for(var n=[],r=o[o.length-1]-(null==t?void 0:t.max),i=0;i<o.length;i++)i+1<o.length&&o[i+1]-r<e||n.push(o[i]-r);return n},h=function(){for(var e=[],r=o[0]-(null==t?void 0:t.min),i=0;i<o.length&&(e[i]=o[i]-r,!(n<=e[i]));i++);return e};if(t){if("max"in t&&"min"in t&&t.max>=n&&t.min<=e){var m=function(){if(o[0]>=t.min&&o[o.length-1]<=t.max)return!0;var n=l();if(n[0]>=t.min&&n[n.length-1]<=t.max)return o=n,!0;var e=h();return e[0]>=t.min&&e[n.length-1]<=t.max?(o=e,!0):void 0};if(m())return o;for(var v=1;v<100;v++){if(o=a(v),m())return o;if(o=a(-v),m())return o}}"max"in t&&t.max>=n?t.max<o[o.length-1]&&(o=l()):"min"in t&&t.min<=e&&t.min>o[0]&&(o=h())}for(var s=0;s<o.length;s++){var d=o[s]+"";/\./.test(d)&&(/9{7,}$/.test(d)?(d=d.replace(/9{7,}$/,""),o[s]=+(d.substring(0,d.length-1)+(+d[d.length-1]+1))):/0{7,}\d$/.test(d)&&(o[s]=+d.replace(/0{7,}\d$/,"")))}return o}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).VISLite_ruler=e();
|
package/lib/scale/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,t;e=this,t=function(){"use strict";return function(e,t,n,o,f){return[n*(o-e)+e,n*(f-t)+t]}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_scale=t();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,t;e=this,t=function(){"use strict";return function(e,t){void 0===t&&(t={}),t=function(e,t){for(var n in e)t[n]=e[n];return t}(t,{time:200,keep:!1,opportunity:"end"});var n,o=!1,i=!1,r=!1;return function(){var p=this;if(n=arguments,o)i=!0,r=!0;else{"end"!=t.opportunity&&e.apply(p,n),o=!0;var f=setInterval((function(){i?t.keep||e.apply(p,n):("begin"!=t.opportunity&&(r||"end"==t.opportunity)&&e.apply(p,n),o=!1,r=!1,clearInterval(f)),i=!1}),t.time)}}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_throttle=t();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 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.8.0
|
|
2
|
+
* VISLite JavaScript Library v0.8.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: Sat Mar 02 2024 12:41:38 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,n;e=this,n=function(){"use strict";var e=function(e,n){var t=e.getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}};return function(n){var t=document.getElementsByTagName("body")[0];t.addEventListener("keydown",(function(e){var t=function(e){return{37:"left",38:"up",39:"right",40:"down"}[e.keyCode||e.which]}(e);"up"==t?n({type:"lookUp",normal:[],value:.1,event:e}):"down"==t?n({type:"lookDown",normal:[],value:.1,event:e}):"left"==t?n({type:"lookLeft",normal:[],value:.1,event:e}):"right"==t&&n({type:"lookRight",normal:[],value:.1,event:e})}));var o=null,i=function(i){if(null==o)n({type:"hover",normal:[],value:0,event:i});else{var u=e(t,i),l=[u.x-o.x,u.y-o.y],a=[l[1],l[0],0];if(0==a[0]&&0==a[1])return;n({type:"rotate",normal:a,value:.01*(Math.abs(u.x-o.x)+Math.abs(u.y-o.y)),event:i}),o=u}};t.addEventListener("mousedown",(function(n){o=e(t,n)})),t.addEventListener("mouseup",(function(){o=null})),t.addEventListener("mousemove",(function(e){i(e)})),t.addEventListener("touchend",(function(){o=null})),t.addEventListener("touchstart",(function(n){o=e(t,n)})),t.addEventListener("touchmove",(function(e){i(e.touches[0])}));var u=function(e,t){0!=e&&n({type:"scale",value:e<0?.899:1.101,normal:[],event:t})};t.addEventListener("mousewheel",(function(e){u(e.wheelDelta,e)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(e){u(-1*e.detail,e)}),!1)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_viewHandler=n();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vislite",
|
|
3
|
-
"version": "0.8.0
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "灵活、快速、简单的数据可视化交互式跨端前端库",
|
|
5
5
|
"main": "./lib/index.umd.min.js",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dev": "webpack serve --config ./build/webpack.config.js",
|
|
11
11
|
"build": "devby --delete ./lib && node ./build/pkg.js",
|
|
12
12
|
"test": "karma start ./build/karma.config.js",
|
|
13
|
-
"lint": "eslint src/**/*.
|
|
13
|
+
"lint": "eslint src/**/*.ts --fix"
|
|
14
14
|
},
|
|
15
15
|
"miniprogram": ".",
|
|
16
16
|
"repository": {
|
package/src/Canvas.ts
CHANGED
|
@@ -43,9 +43,9 @@ class Canvas extends OralCanvas implements CanvasType {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// 设置画布大小
|
|
46
|
-
|
|
46
|
+
const canvasArray = [RegionCanvas, ViewCanvas]
|
|
47
47
|
for (let index = 0; index < canvasArray.length; index++) {
|
|
48
|
-
|
|
48
|
+
const canvas = canvasArray[index]
|
|
49
49
|
if (canvas) {
|
|
50
50
|
canvas.style.width = width + "px"
|
|
51
51
|
canvas.setAttribute('width', (index * width + width) + "")
|
package/src/Geometry.ts
CHANGED
|
@@ -10,6 +10,8 @@ import prismVertical from './common/geometry/prism-vertical'
|
|
|
10
10
|
import sphereFragment from './common/geometry/sphere-fragment'
|
|
11
11
|
import mergeOption from './common/mergeOption'
|
|
12
12
|
import rotateLineFactory from "./common/geometry/tool/rotateLine"
|
|
13
|
+
import triangles from "./common/geometry/tool/triangles"
|
|
14
|
+
import rotate from "./rotate"
|
|
13
15
|
|
|
14
16
|
class Geometry implements GeometryType {
|
|
15
17
|
readonly name: string = 'Geometry'
|
|
@@ -41,7 +43,7 @@ class Geometry implements GeometryType {
|
|
|
41
43
|
|
|
42
44
|
// 物体方向转换
|
|
43
45
|
rotateLine(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number) {
|
|
44
|
-
|
|
46
|
+
const rotateLine = rotateLineFactory(x1, y1, z1, x2, y2, z2)
|
|
45
47
|
return (x: number, y: number, z: number) => rotateLine(x, y, z, this.__option.normal as boolean)
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -74,6 +76,9 @@ class Geometry implements GeometryType {
|
|
|
74
76
|
// 求解出需要切割多少份比较合理
|
|
75
77
|
const num = splitNum(this.__option.precision as number, radius, deg)
|
|
76
78
|
|
|
79
|
+
const beginXZ = rotate(x, z, beginDeg, x + radius, z)
|
|
80
|
+
const endXZ = rotate(x, z, beginDeg + deg, x + radius, z)
|
|
81
|
+
|
|
77
82
|
const result = [{
|
|
78
83
|
name: "bottom",
|
|
79
84
|
points: prismHorizontal(this.__option.normal as boolean, x, y, z, radius, num as number, height > 0 ? -1 : 1, beginDeg, deg),
|
|
@@ -89,6 +94,22 @@ class Geometry implements GeometryType {
|
|
|
89
94
|
points: prismVertical(this.__option.normal as boolean, x, y, z, radius, height, num as number, beginDeg, deg),
|
|
90
95
|
length: 6 * num,
|
|
91
96
|
method: "TRIANGLES" as const
|
|
97
|
+
}, {
|
|
98
|
+
name: "begin",
|
|
99
|
+
points: triangles(this.__option.normal as boolean, [
|
|
100
|
+
x, y, z, x, y + height, z, beginXZ[0], y, beginXZ[1],
|
|
101
|
+
beginXZ[0], y + height, beginXZ[1], beginXZ[0], y, beginXZ[1], x, y + height, z
|
|
102
|
+
]),
|
|
103
|
+
length: 6,
|
|
104
|
+
method: "TRIANGLES" as const
|
|
105
|
+
}, {
|
|
106
|
+
name: "end",
|
|
107
|
+
points: triangles(this.__option.normal as boolean, [
|
|
108
|
+
x, y, z, endXZ[0], y, endXZ[1], x, y + height, z,
|
|
109
|
+
endXZ[0], y + height, endXZ[1], x, y + height, z, endXZ[0], y, endXZ[1]
|
|
110
|
+
]),
|
|
111
|
+
length: 6,
|
|
112
|
+
method: "TRIANGLES" as const
|
|
92
113
|
}]
|
|
93
114
|
|
|
94
115
|
return result
|