vislite 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +7 -1
  3. package/LICENSE +20 -20
  4. package/README.md +53 -53
  5. package/lib/Buffer/index.umd.js +2 -2
  6. package/lib/Buffer/index.umd.min.js +2 -2
  7. package/lib/Canvas/index.umd.js +11 -6
  8. package/lib/Canvas/index.umd.min.js +3 -3
  9. package/lib/Cardinal/index.umd.js +2 -2
  10. package/lib/Cardinal/index.umd.min.js +2 -2
  11. package/lib/Eoap/index.umd.js +2 -2
  12. package/lib/Eoap/index.umd.min.js +2 -2
  13. package/lib/Hermite/index.umd.js +2 -2
  14. package/lib/Hermite/index.umd.min.js +2 -2
  15. package/lib/Matrix4/index.umd.js +2 -2
  16. package/lib/Matrix4/index.umd.min.js +2 -2
  17. package/lib/Mercator/index.umd.js +2 -2
  18. package/lib/Mercator/index.umd.min.js +2 -2
  19. package/lib/OralCanvas/index.es.js +11 -6
  20. package/lib/OralCanvas/index.es.min.js +3 -3
  21. package/lib/OralWebGL/index.es.js +10 -5
  22. package/lib/OralWebGL/index.es.min.js +3 -3
  23. package/lib/SVG/index.umd.js +9 -4
  24. package/lib/SVG/index.umd.min.js +3 -3
  25. package/lib/Shader/index.umd.js +2 -2
  26. package/lib/Shader/index.umd.min.js +2 -2
  27. package/lib/Texture/index.umd.js +2 -2
  28. package/lib/Texture/index.umd.min.js +2 -2
  29. package/lib/WebGL/index.umd.js +10 -5
  30. package/lib/WebGL/index.umd.min.js +3 -3
  31. package/lib/animation/index.umd.js +2 -2
  32. package/lib/animation/index.umd.min.js +2 -2
  33. package/lib/getLoopColors/index.umd.js +2 -2
  34. package/lib/getLoopColors/index.umd.min.js +2 -2
  35. package/lib/getWebGLContext/index.umd.js +2 -2
  36. package/lib/getWebGLContext/index.umd.min.js +2 -2
  37. package/lib/index.umd.js +11 -6
  38. package/lib/index.umd.min.js +3 -3
  39. package/lib/rotate/index.umd.js +2 -2
  40. package/lib/rotate/index.umd.min.js +2 -2
  41. package/lib/ruler/index.umd.js +2 -2
  42. package/lib/ruler/index.umd.min.js +2 -2
  43. package/lib/viewHandler/index.umd.js +2 -2
  44. package/lib/viewHandler/index.umd.min.js +2 -2
  45. package/miniprogram/ui-canvas/index.js +99 -99
  46. package/miniprogram/ui-canvas/index.json +4 -4
  47. package/miniprogram/ui-canvas/index.wxml +4 -4
  48. package/miniprogram/ui-canvas/index.wxss +5 -5
  49. package/package/Buffer/index.ts +1 -1
  50. package/package/Canvas/index.ts +1 -1
  51. package/package/Cardinal/index.ts +2 -2
  52. package/package/Eoap/index.ts +2 -2
  53. package/package/Hermite/index.ts +2 -2
  54. package/package/Matrix4/index.ts +2 -2
  55. package/package/Mercator/index.ts +2 -2
  56. package/package/OralCanvas/index.ts +1 -1
  57. package/package/OralWebGL/index.ts +1 -1
  58. package/package/SVG/index.ts +2 -2
  59. package/package/Shader/index.ts +1 -1
  60. package/package/Texture/index.ts +1 -1
  61. package/package/WebGL/index.ts +1 -1
  62. package/package/animation/index.ts +2 -2
  63. package/package/getLoopColors/index.ts +2 -2
  64. package/package/getWebGLContext/index.ts +39 -39
  65. package/package/index.ts +56 -56
  66. package/package/rotate/index.ts +2 -2
  67. package/package/ruler/index.ts +2 -2
  68. package/package/viewHandler/index.ts +2 -2
  69. package/package.json +1 -1
  70. package/src/Canvas.ts +56 -56
  71. package/src/Eoap.ts +66 -66
  72. package/src/Matrix4/index.ts +76 -76
  73. package/src/Matrix4/move.ts +12 -12
  74. package/src/Matrix4/rotate.ts +15 -15
  75. package/src/Matrix4/scale.ts +11 -11
  76. package/src/Matrix4/transform.ts +64 -64
  77. package/src/Mercator.ts +26 -26
  78. package/src/SVG.ts +23 -23
  79. package/src/WebGL.ts +52 -52
  80. package/src/animation.ts +99 -99
  81. package/src/common/assemble.ts +1 -1
  82. package/src/common/canvas/arc.ts +50 -50
  83. package/src/common/canvas/config.ts +157 -157
  84. package/src/common/canvas/gradient.ts +29 -29
  85. package/src/common/canvas/index.ts +10 -7
  86. package/src/common/canvas/painter.ts +355 -355
  87. package/src/common/canvas/texts.ts +18 -18
  88. package/src/common/setStyle.ts +5 -5
  89. package/src/common/svg/config.ts +173 -173
  90. package/src/common/svg/index.ts +334 -334
  91. package/src/common/svg/tool.ts +43 -43
  92. package/src/common/webgl/buffer.ts +79 -79
  93. package/src/common/webgl/doDraw.ts +106 -106
  94. package/src/common/webgl/getColorFactory.ts +26 -26
  95. package/src/common/webgl/getShader.ts +75 -75
  96. package/src/common/webgl/getTexture.ts +11 -11
  97. package/src/common/webgl/getWebGLContext.ts +27 -27
  98. package/src/common/webgl/index.ts +216 -216
  99. package/src/common/webgl/shader.ts +75 -75
  100. package/src/common/webgl/texture.ts +99 -99
  101. package/src/getLoopColors.ts +42 -42
  102. package/src/interpolation/Cardinal.ts +109 -109
  103. package/src/interpolation/Hermite.ts +65 -65
  104. package/src/rotate.ts +7 -7
  105. package/src/ruler.ts +99 -99
  106. package/src/viewHandler.ts +139 -139
  107. package/types/Buffer.d.ts +23 -23
  108. package/types/Canvas.d.ts +282 -282
  109. package/types/CanvasConfig.d.ts +80 -80
  110. package/types/Cardinal.d.ts +13 -13
  111. package/types/Gradient.d.ts +14 -14
  112. package/types/Hermite.d.ts +18 -18
  113. package/types/Map.d.ts +9 -9
  114. package/types/Matrix4.d.ts +42 -42
  115. package/types/Object3D.d.ts +113 -113
  116. package/types/SVG.d.ts +210 -210
  117. package/types/SVGConfig.d.ts +58 -58
  118. package/types/Scene3D.d.ts +6 -6
  119. package/types/Shader.d.ts +15 -15
  120. package/types/Texture.d.ts +16 -16
  121. package/types/WebGL.d.ts +38 -38
  122. package/types/animation.d.ts +6 -6
  123. package/types/getLoopColors.d.ts +2 -2
  124. package/types/getWebGLContext.d.ts +2 -2
  125. package/types/index.d.ts +129 -129
  126. package/types/rotate.d.ts +2 -2
  127. package/types/ruler.d.ts +2 -2
  128. package/types/viewHandler.d.ts +12 -12
  129. package/uni-app/ui-canvas.vue +212 -212
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12:38 GMT+0800 (中国标准时间)
10
10
  */
11
- var t,e;t=this,e=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,e,i,r,n,o){if(!(t<i))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=i;var a=this.__u*n,s=this.__u*o;return e/=i-t,r/=i-t,this.__MR=[2*e-2*r+a+s,3*r-3*e-2*a-s,a,e],this},t.prototype.use=function(t){if(this.__MR){var e=(t-this.__a)/(this.__b-this.__a),i=e*e;return(e*i*this.__MR[0]+i*this.__MR[1]+e*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),e=function(){function e(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return e.prototype.setP=function(e){this.__HS={x:[],h:[]};var i,r,n=(e[1][1]-e[0][1])/(e[1][0]-e[0][0]);for(this.__HS.x[0]=e[0][0],i=1;i<e.length;i++){if(e[i][0]<=e[i-1][0])throw new Error("The point position should be increamented!");this.__HS.x[i]=e[i][0],r=i<e.length-1?e[i+1][1]>e[i][1]&&e[i-1][1]>e[i][1]||e[i+1][1]<e[i][1]&&e[i-1][1]<e[i][1]||e[i+1][1]==e[i][1]||e[i-1][1]==e[i][1]?0:(e[i+1][1]-e[i-1][1])/(e[i+1][0]-e[i-1][0]):(e[i][1]-e[i-1][1])/(e[i][0]-e[i-1][0]),this.__HS.h[i-1]=new t(.5*(1-this.__t)).setP(e[i-1][0],e[i-1][1],e[i][0],e[i][1],n,r),n=r}return this},e.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},e}(),i=function(t,e){for(var i=[],r=0;r<4;r++)for(var n=0;n<e.length/4;n++)i[4*n+r]=t[r]*e[4*n]+t[r+4]*e[4*n+1]+t[r+8]*e[4*n+2]+t[r+12]*e[4*n+3];return i},r=function(){function t(t){void 0===t&&(t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.name="Matrix4",this.__matrix4=t}return t.prototype.move=function(t,e,r,n){return void 0===n&&(n=0),this.__matrix4=i(function(t,e,i,r){void 0===r&&(r=0);var n=Math.sqrt(e*e+i*i+r*r);return[1,0,0,0,0,1,0,0,0,0,1,0,e*t/n,i*t/n,r*t/n,1]}(t,e,r,n),this.__matrix4),this},t.prototype.rotate=function(t,e,r,n,o,a,s){var _=function(t,e,i,r,n,o){if("number"==typeof t&&"number"==typeof e){if("number"!=typeof i?(i=0,r=t,n=e,o=1):"number"==typeof r&&"number"==typeof n&&"number"==typeof o||(r=t,n=e,o=i,t=0,e=0,i=0),t==r&&e==n&&i==o)throw new Error("It's not a legitimate ray!");var a=Math.sqrt((r-t)*(r-t)+(n-e)*(n-e)),s=0!=a?(n-e)/a:1,_=0!=a?(r-t)/a:0,h=(r-t)*_+(n-e)*s,u=o-i,l=Math.sqrt(h*h+u*u),c=0!=l?u/l:1,f=0!=l?h/l:0;return[[s,c*_,_*f,0,-_,s*c,s*f,0,0,-f,c,0,e*_-t*s,i*f-t*_*c-e*s*c,-t*_*f-e*s*f-i*c,1],[s,-_,0,0,c*_,c*s,-f,0,_*f,s*f,c,0,t,e,i,1]]}throw new Error("a1 and b1 is required!")}(e,r,n,o,a,s);return this.__matrix4=i(i(i(_[1],function(t){var e=Math.sin(t),i=Math.cos(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,e,r,n,o,a){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),this.__matrix4=i(function(t,e,i,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),[t,0,0,0,0,e,0,0,0,0,i,0,r-r*t,n-n*e,o-o*i,1]}(t,e,r,n,o,a),this.__matrix4),this},t.prototype.multiply=function(t,e){return void 0===e&&(e=!1),this.__matrix4=e?i(this.__matrix4,t):i(t,this.__matrix4),this},t.prototype.use=function(t,e,r,n){return void 0===r&&(r=0),void 0===n&&(n=1),i(this.__matrix4,[t,e,r,n])},t.prototype.value=function(){return this.__matrix4},t}();function n(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[(r-t)*o-(n-e)*a+t,(r-t)*a+(n-e)*o+e]}var o,a=[],s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)};function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function h(t,e,i){if(i||2===arguments.length)for(var r,n=0,o=e.length;n<o;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}var u=["href","title","show","type","role","actuate"],l=function(t,e,i){u.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,i+""):t.setAttribute(e,i+"")},c=l;function f(t,e){l(t,"stroke",e.strokeStyle),l(t,"fill",e.fillStyle),l(t,"stroke-dasharray",e.lineDash.join(","))}function p(t,e){l(t,"fill",e.fillStyle)}function g(t,e){l(t,"stroke",e.strokeStyle),l(t,"fill","none"),l(t,"stroke-dasharray",e.lineDash.join(","))}var m=function(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[+((r-t)*o-(n-e)*a+t).toFixed(7),+((r-t)*a+(n-e)*o+e).toFixed(7)]};function v(t,e,i,r,n,o,a){e<0&&(t+=e,e*=-1);var s,_=[];s=m(0,0,t,n,0),_[0]=s[0],_[1]=s[1],s=m(0,0,e,s[0],s[1]),_[2]=s[0],_[3]=s[1],s=m(0,0,t,o,0),_[4]=s[0],_[5]=s[1],s=m(0,0,e,s[0],s[1]),_[6]=s[0],_[7]=s[1],a(t,t+e,_[0]+i,_[1]+r,_[4]+i,_[5]+r,_[2]+i,_[3]+r,_[6]+i,_[7]+r,.5*(o-n))}var d=function(t,e,i,r,n){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");c(t,"dy",{top:.5*e.fontSize,middle:0,bottom:.5*-e.fontSize}[e.textBaseline]),function(t,e){for(var i in e)t.style[i]=e[i]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[e.textAlign],"dominant-baseline":"central","font-size":e.fontSize+"px","font-family":e.fontFamily}),c(t,"x",i),c(t,"y",r),"number"==typeof n&&c(t,"transform","rotate("+(n%=360)+","+i+","+r+")")},y=function(t,e,i,r){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");c(t,"cx",e),c(t,"cy",i),c(t,"r",r)},E=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");c(t,"d",e)},b=function(t,e,i,r,n){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");n<0&&(i-=n*=-1),r<0&&(e-=r*=-1),c(t,"x",e),c(t,"y",i),c(t,"width",r),c(t,"height",n)},x=function(t,e,i,r,n,o,a,s){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(a=a/180*Math.PI,s=s/180*Math.PI,a%=2*Math.PI,n>o){var _=n;n=o,o=_}s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=1.999999*Math.PI:s%=2*Math.PI,v(a,s,i,r,n,o,(function(i,r,a,s,_,h,u,l,f,p,g){var m=r-i>Math.PI?1:0,v="M"+a+" "+s;g<0&&(g=-g),v+="A"+n+" "+n+" 0 "+m+" 1 "+u+" "+l,"round"==e.arcEndCap?v+="A"+g+" "+g+" 0 1 0 "+f+" "+p:"-round"==e.arcEndCap?v+="A"+g+" "+g+" 0 1 1 "+f+" "+p:v+="L"+f+" "+p,v+="A"+o+" "+o+" 0 "+m+" 0 "+_+" "+h,"round"==e.arcStartCap?v+="A"+g+" "+g+" 0 1 0 "+a+" "+s:"-round"==e.arcStartCap?v+="A"+g+" "+g+" 0 1 1 "+a+" "+s:v+="L"+a+" "+s,"butt"==e.arcStartCap&&(v+="Z"),c(t,"d",v)}))},w={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},C=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle","font-size":16,"font-family":"sans-serif","arc-start-cap":"butt","arc-end-cap":"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[w[t]||t];for(var e in t){var i=w[e]||e;this.__config[i]=t[e]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,e){var i;return e=e||this.__svg,"string"==typeof t&&(i=t,t=document.createElementNS("http://www.w3.org/2000/svg",i)),e.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,e){var i=t;if("string"==typeof t&&(i={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==i)throw new Error("Unsupported drawing method:"+t);return this.appendEl(i,e)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return u.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)c(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,p(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,g(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,f(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),p(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),g(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),f(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return y(this.__useEl,t,e,i),p(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return y(this.__useEl,t,e,i),g(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return y(this.__useEl,t,e,i),f(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),p(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),g(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),f(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return E(this.__useEl,this.__path),p(this.__useEl,this.__config),this},t.prototype.stroke=function(){return E(this.__useEl,this.__path),g(this.__useEl,this.__config),this},t.prototype.full=function(){return E(this.__useEl,this.__path),f(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,r,o){var a=n(t,e,r/180*Math.PI,t+i,e),s=n(t,e,(r+o)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+a[0]+","+a[1]:a[0]==this.__currentPosition[0]&&a[1]==this.__currentPosition[1]||(this.__path+="L"+a[0]+","+a[1]),this.__path+="A"+i+","+i+" 0 "+(o>180||o<-180?1:0)+","+(o>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__path+="Q"+t+" "+e+","+i+" "+r,this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__path+="C"+t+" "+e+","+i+" "+r+","+n+" "+o,this},t}(),T=function(t){function e(e){if(!e)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=e.clientWidth,r=e.clientHeight,n=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.appendChild(n),n.setAttribute("width",i+""),n.setAttribute("height",r+""),n.setAttribute("viewBox","0 0 "+i+" "+r),t.call(this,n)||this}return _(e,t),e}(C),A=function(t,e,i,r,n){return t.beginPath(),t.translate(i,r),t.rotate(n),t.font=e.fontStyle+" "+e.fontWeight+" "+e.fontSize+"px "+e.fontFamily,t},S=function(t,e,i,r,n,o,a,s){if(n>o){var _=n;n=o,o=_}return a%=2*Math.PI,s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=2*Math.PI:s%=2*Math.PI,v(a,s,i,r,n,o,(function(a,s,_,h,u,l,c,f,p,g,m){m<0&&(m=-m),t.beginPath(),t.moveTo(_,h),t.arc(i,r,n,a,s,!1),"round"==e.arcEndCap?t.arc(.5*(c+p),.5*(f+g),m,s-Math.PI,s,!0):"-round"==e.arcEndCap?t.arc(.5*(c+p),.5*(f+g),m,s-Math.PI,s,!1):t.lineTo(p,g),t.arc(i,r,o,s,a,!0),"round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),m,a,a-Math.PI,!0):"-round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),m,a,a-Math.PI,!1):t.lineTo(_,h)})),"butt"==e.arcStartCap&&t.closePath(),t},M=function(t,e,i,r){return t.beginPath(),t.moveTo(e+r,i),t.arc(e,i,r,0,2*Math.PI),t},P=function(t,e,i,r,n){return t.beginPath(),t.rect(e,i,r,n),t};function L(t,e,i,r,n){for(var o=0,a="",s=0;s<e.length;s++)t.measureText(a+e[s]).width>i?(n(a,((o+=1)-.5)*r),a=e[s]):s==e.length-1?(o+=1,n(a+e[s],(o-.5)*r)):a+=e[s];return o*r}var R=function(){function t(t,e,i){void 0===e&&(e={}),this.__region=null,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",e),this.__region=i,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,e){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,e),"lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(e);else if(t in this.__specialConfig)"fontSize"==t&&(e=Math.round(e)),this.__specialConfig[t]=e;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=e}return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,e,i,r),this.painter.save(),A(this.painter,this.__specialConfig,e,i,r).fillText(t,0,0),this.painter.restore(),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,e,i,r),this.painter.save(),A(this.painter,this.__specialConfig,e,i,r).strokeText(t,0,0),this.painter.restore(),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,e,i,r),this.painter.save(),A(this.painter,this.__specialConfig,e,i,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore(),this},t.prototype.fillTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),A(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e)}));return this.painter.restore(),s},t.prototype.strokeTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),A(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.strokeText(t,0,e)}));return this.painter.restore(),s},t.prototype.fullTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),A(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e),a.painter.strokeText(t,0,e)}));return this.painter.restore(),s},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.painter.closePath(),this},t.prototype.moveTo=function(t,e){return this.__region&&this.__region.moveTo(t,e),this.painter.moveTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.lineTo=function(t,e){return this.__region&&this.__region.lineTo(t,e),this.painter.lineTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.arc=function(t,e,i,r,n){return this.__region&&this.__region.arc(t,e,i,r,n),this.painter.arc(t,e,i,r,r+n,n<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.painter.fill(),this.painter.stroke(),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__region&&this.__region.quadraticCurveTo(t,e,i,r),this.painter.quadraticCurveTo(t,e,i,r),this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__region&&this.__region.bezierCurveTo(t,e,i,r,n,o),this.painter.bezierCurveTo(t,e,i,r,n,o),this},t.prototype.clearRect=function(t,e,i,r){return this.__region&&this.__region.clearRect(t,e,i,r),this.painter.clearRect(t,e,i,r),this},t.prototype.fillArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fillArc(t,e,i,r,n,o),S(this.painter,this.__specialConfig,t,e,i,r,n,o).fill(),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return this.__region&&this.__region.strokeArc(t,e,i,r,n,o),S(this.painter,this.__specialConfig,t,e,i,r,n,o).stroke(),this},t.prototype.fullArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fullArc(t,e,i,r,n,o),S(this.painter,this.__specialConfig,t,e,i,r,n,o),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillCircle=function(t,e,i){return this.__region&&this.__region.fillCircle(t,e,i),M(this.painter,t,e,i).fill(),this},t.prototype.strokeCircle=function(t,e,i){return this.__region&&this.__region.strokeCircle(t,e,i),M(this.painter,t,e,i).stroke(),this},t.prototype.fullCircle=function(t,e,i){return this.__region&&this.__region.fullCircle(t,e,i),M(this.painter,t,e,i),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillRect=function(t,e,i,r){return this.__region&&this.__region.fillRect(t,e,i,r),P(this.painter,t,e,i,r).fill(),this},t.prototype.strokeRect=function(t,e,i,r){return this.__region&&this.__region.strokeRect(t,e,i,r),P(this.painter,t,e,i,r).stroke(),this},t.prototype.fullRect=function(t,e,i,r){return this.__region&&this.__region.fullRect(t,e,i,r),P(this.painter,t,e,i,r),this.painter.fill(),this.painter.stroke(),this},t}();function k(t,e,i,r){for(var n=[],o=0;o<r;o++)n[o]=t;return function(){for(var o=0;o<r;o++){if(n[o]<e){n[o]=+(n[o]+i).toFixed(7);break}o<r-1&&(n[o]=t)}return n}}var I={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},U=function(t){function e(e,i){var r=t.call(this,e,{},new R(i,{willReadFrequently:!0}))||this;return r.name="Canvas",r.__regionList={},r.__regionAssemble=k(0,255,1,3),r.setRegion(""),r}return _(e,t),e.prototype.config=function(t){for(var e in t){var i=I[e]||e;this.useConfig(i,t[e])}return this},e.prototype.setRegion=function(t){if(t){if(null==this.__regionList[t]){var e=this.__regionAssemble();this.__regionList[t]="rgb("+e[0]+","+e[1]+","+e[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,e){var i=this;return new Promise((function(r,n){var o=i.__region.painter.getImageData(t-.5,e-.5,1,1),a=o.data,s=function(){for(var t in i.__regionList)if("rgb("+a[0]+","+a[1]+","+a[2]+")"==i.__regionList[t]){r(t);break}r("")};a?s():o.then((function(t){a=t,s()}))}))},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region.painter:this.painter},e.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=t.createLinearGradient(e,i,r,n),a={value:function(){return o},setColor:function(t,e){return o.addColorStop(t,e),a}};return a}(this.painter,t,e,i,r)},e.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=t.createRadialGradient(e,i,0,e,i,r),o={value:function(){return n},setColor:function(t,e){return n.addColorStop(t,e),o}};return o}(this.painter,t,e,i)},e.prototype.getColor=function(t,e){var i=this.painter.getImageData(t-.5,e-.5,1,1).data;return"rgba("+i[0]+","+i[1]+","+i[2]+","+i[3]+")"},e}(R),z=function(t){function e(e){var i=this;if(!e)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");var r,n,o=e.clientWidth,a=e.clientHeight,s=e;s._vislite_canvas_?(r=s._vislite_canvas_[0],n=s._vislite_canvas_[1]):(r=document.createElement("canvas"),e.appendChild(r),n=document.createElement("canvas"),s._vislite_canvas_=[r,n],e.setAttribute("vislite","Canvas"));for(var _=0,h=[r,n];_<h.length;_++){var u=h[_];u.style.width=o+"px",u.setAttribute("width",o+""),u.style.height=a+"px",u.setAttribute("height",a+"")}return(i=t.call(this,r,n)||this).__canvas=r,i}return _(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(e){e(t.__canvas.toDataURL())}))},e}(U);function B(t,e,i){void 0===i&&(i={});for(var r=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,o=0;o<r.length;o++){try{n=t.getContext(r[o],i)}catch(t){}if(n)break}if(!n)throw new Error("Non canvas or browser does not support webgl.");var a=n.canvas.width,s=n.canvas.height,_=a*e,h=s*e;return n.viewport(.5*(a-_),.5*(s-h),_,h),n.depthFunc(n.LEQUAL),n.enable(n.DEPTH_TEST),n}function D(t){var e=t.drawingBufferWidth,i=t.drawingBufferHeight,r=new Uint8Array(4*e*i);return t.readPixels(0,0,e,i,t.RGBA,t.UNSIGNED_BYTE,r),function(t,n){return"rgba("+r[4*((n=i-n)*e+t)]+","+r[4*(n*e+t)+1]+","+r[4*(n*e+t)+2]+","+r[4*(n*e+t)+3]+")"}}var F=function(){function t(t,e){void 0===e&&(e=!1),this.__painter=t,this.__isElement=e,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,e,i,r){var n=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(n,e,r)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,e,i,r){return void 0===r&&(r=0),function(t,e,i,r,n,o,a){t.vertexAttribPointer(e,i,r,a,n,o),t.enableVertexAttribArray(e)}(this.__painter,t,e,this.__painter.FLOAT,i*this.__fsize,r*this.__fsize,!1),this},t}(),N=function(){function t(t,e,i){void 0===i&&(i=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[e],this.__texture=function(t,e,i){var r=t.createTexture();return e==t.TEXTURE_2D&&t.activeTexture(t["TEXTURE"+i]),t.bindTexture(e,r),r}(t,this.__type,i),t.texParameteri(this.__type,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(this.__type,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}return t.prototype.useImage=function(t){return function(t,e,i,r,n,o){t.texImage2D(e,i,r,r,n,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,e,i){return function(t,e,i,r,n,o,a,s,_){for(var h,u=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],l=0;l<u.length;l++)o[l]&&(h=u[l],t.texImage2D(h,i,r,a,s,0,r,n,null),t.bindTexture(e,_),t.texImage2D(h,i,r,r,n,o[l]));t.generateMipmap(e)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,e,i,this.__texture),this},t}(),H={};function G(t,e,i){var r=t+"-"+i;return H[r]||(H[r]=new N(e,i)),H[r]}var O=function(t,e,i){var r=t.createShader(e);if(null==r)throw new Error("Unable to create shader!");if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(r));return r},W=function(){function t(t){this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,e){return this.program=function(t,e,i){var r=O(t,t.VERTEX_SHADER,e),n=O(t,t.FRAGMENT_SHADER,i),o=t.createProgram();if(t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,e),this},t}(),X={};function q(t,e,i,r,n){var o=function(t,e,i){var r=t+(i.geometry.attributes.normal?"1":"0")+(i.material.image?"1":"0")+(i.material.color?"1":"0")+(i.material.colors?"1":"0")+(i.material.cube?"1":"0");if(X[r])return X[r].use();var n="\n attribute vec4 a_position;\n\n ".concat(i.geometry.attributes.normal?"attribute vec4 a_normal;varying vec3 v_normal;":"","\n\n uniform mat4 u_matrix_world;\n uniform mat4 u_matrix_mesh;\n uniform mat4 u_matrix_proporion;\n\n ").concat(i.material.image?"attribute vec2 a_textcoord;varying vec2 v_textcoord;":"","\n\n ").concat(i.material.colors?"attribute vec4 a_color;varying vec4 v_color;":"","\n\n void main(){\n vec4 temp = a_position;\n\n // 应用变换矩阵:屏幕比调平矩阵、世界矩阵、物体矩阵\n temp = u_matrix_proporion * u_matrix_world * u_matrix_mesh * temp;\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\n ").concat(i.geometry.attributes.normal?"v_normal = normalize(vec3(a_normal));":"","\n ").concat(i.material.image?"v_textcoord = a_textcoord;":"","\n ").concat(i.material.colors?"v_color=a_color;":"","\n }\n "),o="\n precision mediump float;\n\n ".concat(i.geometry.attributes.normal?"varying vec3 v_normal;":"","\n ").concat(i.material.color?"uniform vec4 u_color;":"","\n ").concat(i.material.cube?"uniform samplerCube u_texture;":"","\n ").concat(i.material.image?"uniform sampler2D u_sampler;varying vec2 v_textcoord;":"","\n ").concat(i.material.colors?"varying vec4 v_color;":"","\n\n void main(){\n ").concat(i.material.color?"gl_FragColor = u_color;":"","\n ").concat(i.material.cube?"gl_FragColor = textureCube(u_texture,normalize(v_normal));":"","\n ").concat(i.material.image?"gl_FragColor = texture2D(u_sampler,v_textcoord);":"","\n ").concat(i.material.colors?"gl_FragColor=v_color;":"","\n }\n "),a=new W(e).compile(n,o).use();return X[r]=a,a}(t,e,i);if(new F(e).use().write(i.geometry.attributes.position.array).divide(e.getAttribLocation(o.program,"a_position"),i.geometry.attributes.position.itemSize,i.geometry.attributes.position.itemSize,0),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_world"),!1,n.matrix),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_proporion"),!1,n.proporion),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_mesh"),!1,r.matrix),i.geometry.attributes.normal&&new F(e).use().write(i.geometry.attributes.normal.array).divide(e.getAttribLocation(o.program,"a_normal"),i.geometry.attributes.normal.itemSize,i.geometry.attributes.normal.itemSize,0),"color"in i.material&&e.uniform4f(e.getUniformLocation(o.program,"u_color"),i.material.color.r,i.material.color.g,i.material.color.b,i.material.color.alpha),"colors"in i.material)new F(e).use().write(i.material.colors.array).divide(e.getAttribLocation(o.program,"a_color"),i.material.colors.itemSize,i.material.colors.itemSize,0);else if("cube"in i.material){var a=i.material.cube.right.image.value.width;G(t,e,"cube").useCube([i.material.cube.right.image.value,i.material.cube.left.image.value,i.material.cube.top.image.value,i.material.cube.bottom.image.value,i.material.cube.far.image.value,i.material.cube.near.image.value],a,a)}else"image"in i.material&&(e.uniform1i(e.getUniformLocation(o.program,"u_sampler"),0),new F(e).use().write(i.geometry.attributes.uv.array).divide(e.getAttribLocation(o.program,"a_textcoord"),i.geometry.attributes.uv.itemSize,2,0),G(t,e,"2d").useImage(i.material.image.value));i.geometry.index?(new F(e,!0).use().write(i.geometry.index.array),e.drawElements(e[i.geometry.type],i.geometry.index.count,e.UNSIGNED_BYTE,0)):e.drawArrays(e[i.geometry.type],0,i.geometry.attributes.position.count)}var V=!1,Y=function(){function t(t,e){this.name="WebGL",this.__getColor=function(t,e){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=k(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=B(t,10),this.__regionPainter=B(e,10,{});var i=this.painter.canvas.width/this.painter.canvas.height,n=1,o=1;i>1?n=1/i:o=i;var a=Math.min(n,o);this.__proporion=[n,0,0,0,0,o,0,0,0,0,a,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.clearColor(1,1,1,1),this.__regionPainter.clear(this.__regionPainter.COLOR_BUFFER_BIT)):(this.painter.clearColor(1,1,1,1),this.painter.clear(this.painter.COLOR_BUFFER_BIT));for(var e=0;e<this.__scene.children.length;e++)this.draw(this.__scene.children[e],t);return this},t.prototype.draw=function(t,e){void 0===e&&(e=!1),e||(V=!0);var i={matrix:t.matrix.value()},r={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var n=0;n<t.mesh.length;n++)e?(q("painter"+this.__unique,this.__regionPainter,{geometry:t.mesh[n].geometry,material:{color:{r:this.__regionColor[0],g:this.__regionColor[1],b:this.__regionColor[2],alpha:this.__regionColor[3]}}},i,r),this.__getColor=D(this.__regionPainter)):q("region"+this.__unique,this.painter,t.mesh[n],i,r)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new r),"region"in t||(t.region="");for(var e=0;e<t.mesh.length;e++){var i=t.mesh[e];i.geometry.attributes.normal&&Array.isArray(i.geometry.attributes.normal.array)&&(i.geometry.attributes.normal.array=new Float32Array(i.geometry.attributes.normal.array)),i.geometry.attributes.position&&Array.isArray(i.geometry.attributes.position.array)&&(i.geometry.attributes.position.array=new Float32Array(i.geometry.attributes.position.array)),i.geometry.attributes.uv&&Array.isArray(i.geometry.attributes.uv.array)&&(i.geometry.attributes.uv.array=new Float32Array(i.geometry.attributes.uv.array)),i.geometry.index&&Array.isArray(i.geometry.index.array)&&(i.geometry.index.array=new Uint8Array(i.geometry.index.array)),i.material.colors&&Array.isArray(i.material.colors.array)&&(i.material.colors.array=new Float32Array(i.material.colors.array))}this.__scene.children.push(t),this.draw(t)},t.prototype.setRegion=function(t){return this.__regionName=t+"",t?(null==this.__regionList[t]&&(this.__regionList[t]=h(h([],this.__regionAssemble(),!0),[1],!1)),this.__regionColor=this.__regionList[t]):this.__regionColor=[0,0,0,1],this},t.prototype.getRegion=function(t,e){var i=this;return V&&this.review(!0),V=!1,new Promise((function(r,n){var o=i.__getColor(t,e);for(var a in i.__regionList){var s=i.__regionList[a];if("rgba("+255*s[0]+","+255*s[1]+","+255*s[2]+","+255*s[3]+")"==o){r(a);break}}r("")}))},t}(),j=function(t){function e(e){if(!e)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");var i,r,n=e.clientWidth,o=e.clientHeight,a=e;a._vislite_canvas_?(i=a._vislite_canvas_[0],r=a._vislite_canvas_[1]):(r=document.createElement("canvas"),e.appendChild(r),r.style.position="absolute",r.style.zIndex="-1",i=document.createElement("canvas"),e.appendChild(i),a._vislite_canvas_=[i,r],e.setAttribute("vislite","WebGL"));for(var s=0,_=[i,r];s<_.length;s++){var h=_[s];h.style.width=n+"px",h.setAttribute("width",n+""),h.style.height=o+"px",h.setAttribute("height",o+"")}return t.call(this,i,r)||this}return _(e,t),e}(Y),Z=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e*n-i*o,e*o+i*n,r]},Q=function(){function t(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return t.prototype.use=function(t,e){var i,r,n,o,a,s,_=(i=(360-e)/180*Math.PI,r=100*this.__scale,n=0,o=0,a=Math.cos(i),s=Math.sin(i),[o*s+r*a,n,o*a-r*s]);return _=Z(t/180*Math.PI,_[0],_[1],_[2]),_=Z((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e,i*n-r*o,i*o+r*n]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),K=function(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Mercator";var i=100*t*Math.PI/180,r=i*e[0],n=-1*i*e[1];this.use=function(t,e){return[.8*(i*t-r),-1*i*e-n]}},J=function(t,e){var i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}},$={Cardinal:e,Hermite:t,Matrix4:r,rotate:n,getLoopColors:function(t,e){void 0===e&&(e=1);var i=["rgba(84,112,198,"+e+")","rgba(145,204,117,"+e+")","rgba(250,200,88,"+e+")","rgba(238,102,102,"+e+")","rgba(115,192,222,"+e+")","rgba(59,162,114,"+e+")","rgba(252,132,82,"+e+")","rgba(154,96,180,"+e+")","rgba(234,124,204,"+e+")"],r=[];if(t<=i.length)return i;if(t%i.length==0)for(var n=0;n<t/i.length;n++)r=r.concat(i);else{for(var o=1;o<t/i.length;o++)r=r.concat(i);if(t%i.length==1)r=r.concat(i[4]);else for(var a=0;a<t%i.length;a++)r=r.concat(i[a])}return r},animation:function(t,e,i){void 0===e&&(e=400),void 0===i&&(i=function(){});var r={timer:function(t,e,i){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return a.push({id:n,createTime:new Date,tick:t,duration:e,callback:i}),r.start(),n},start:function(){o||(o=setInterval(r.tick,13))},tick:function(){var t,e,i,n,o,s,_,h=a;for((a=[]).length=0,e=0;e<h.length;e++)t=(o=h[e]).createTime,i=o.tick,s=o.duration,n=o.callback,i(_=(_=(+(new Date).valueOf()-t.valueOf())/s)>1?1:_),_<1&&o.id?a.push(o):n(_);a.length<=0&&r.stop()},stop:function(){o&&(clearInterval(o),o=null)}},n=r.timer((function(e){t(e)}),e,i);return function(){var t;for(t in a)if(a[t].id==n)return void(a[t].id=void 0)}},ruler:function(t,e,i){if(t<e){var r=e;e=t,t=r}else if(t==e)return[t];var n=function(t){for(var e=t<100&&t>-100?10:.1,i=-1,r=t;10==e?r>=-100&&r<=100:r<=-100||r>=100;)i+=1,r*=e;if(10==e)return Math.pow(10,i);for(var n="0.",o=1;o<i;o++)n+="0";return+(n+"1")}(t-e),o=Math.ceil((t-e)*n/i),a=(o={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}[o]||o)/n,s=Math.floor(e/a)*a,_=[];_.push(s);for(var h=1;_[_.length-1]<t;h++)_.push(s+a*h);return _},SVG:T,Canvas:z,WebGL:j,getWebGLContext:function(t,e){if(void 0===e&&(e=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var i,r=t.clientWidth,n=t.clientHeight,o=t;return o._vislite_canvas_?i=o._vislite_canvas_:(i=document.createElement("canvas"),t.appendChild(i),o._vislite_canvas_=i,t.setAttribute("vislite","WebGL")),i.style.width=r+"px",i.setAttribute("width",r+""),i.style.height=n+"px",i.setAttribute("height",n+""),B(i,e)},Shader:W,Texture:N,Buffer:F,Eoap:Q,Mercator:K,viewHandler:function(t){var e=document.getElementsByTagName("body")[0];e.addEventListener("keydown",(function(e){var i=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(e);"up"==i?t({type:"lookUp",normal:[],value:.1}):"down"==i?t({type:"lookDown",normal:[],value:.1}):"left"==i?t({type:"lookLeft",normal:[],value:.1}):"right"==i&&t({type:"lookRight",normal:[],value:.1})}));var i=null,r=function(r){if(null!=i){var n=J(e,r),o=[n.x-i.x,n.y-i.y],a=[o[1],o[0],0];0==a[0]&&0==a[1]||(t({type:"rotate",normal:a,value:.01*(Math.abs(n.x-i.x)+Math.abs(n.y-i.y))}),i=n)}};e.addEventListener("mousedown",(function(t){i=J(e,t)})),e.addEventListener("mouseup",(function(t){i=null})),e.addEventListener("mousemove",(function(t){r(t)})),e.addEventListener("touchend",(function(t){i=null})),e.addEventListener("touchstart",(function(t){i=J(e,t)})),e.addEventListener("touchmove",(function(t){r(t.touches[0])}));var n=function(e){0!=e&&t({type:"scale",value:e<0?.899:1.101,normal:[]})};e.addEventListener("mousewheel",(function(t){n(t.wheelDelta)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){n(-1*t.detail)}),!1)}};return $},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=e();
11
+ var t,e;t=this,e=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,e,i,r,n,o){if(!(t<i))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=i;var a=this.__u*n,s=this.__u*o;return e/=i-t,r/=i-t,this.__MR=[2*e-2*r+a+s,3*r-3*e-2*a-s,a,e],this},t.prototype.use=function(t){if(this.__MR){var e=(t-this.__a)/(this.__b-this.__a),i=e*e;return(e*i*this.__MR[0]+i*this.__MR[1]+e*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),e=function(){function e(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return e.prototype.setP=function(e){this.__HS={x:[],h:[]};var i,r,n=(e[1][1]-e[0][1])/(e[1][0]-e[0][0]);for(this.__HS.x[0]=e[0][0],i=1;i<e.length;i++){if(e[i][0]<=e[i-1][0])throw new Error("The point position should be increamented!");this.__HS.x[i]=e[i][0],r=i<e.length-1?e[i+1][1]>e[i][1]&&e[i-1][1]>e[i][1]||e[i+1][1]<e[i][1]&&e[i-1][1]<e[i][1]||e[i+1][1]==e[i][1]||e[i-1][1]==e[i][1]?0:(e[i+1][1]-e[i-1][1])/(e[i+1][0]-e[i-1][0]):(e[i][1]-e[i-1][1])/(e[i][0]-e[i-1][0]),this.__HS.h[i-1]=new t(.5*(1-this.__t)).setP(e[i-1][0],e[i-1][1],e[i][0],e[i][1],n,r),n=r}return this},e.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},e}(),i=function(t,e){for(var i=[],r=0;r<4;r++)for(var n=0;n<e.length/4;n++)i[4*n+r]=t[r]*e[4*n]+t[r+4]*e[4*n+1]+t[r+8]*e[4*n+2]+t[r+12]*e[4*n+3];return i},r=function(){function t(t){void 0===t&&(t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.name="Matrix4",this.__matrix4=t}return t.prototype.move=function(t,e,r,n){return void 0===n&&(n=0),this.__matrix4=i(function(t,e,i,r){void 0===r&&(r=0);var n=Math.sqrt(e*e+i*i+r*r);return[1,0,0,0,0,1,0,0,0,0,1,0,e*t/n,i*t/n,r*t/n,1]}(t,e,r,n),this.__matrix4),this},t.prototype.rotate=function(t,e,r,n,o,a,s){var _=function(t,e,i,r,n,o){if("number"==typeof t&&"number"==typeof e){if("number"!=typeof i?(i=0,r=t,n=e,o=1):"number"==typeof r&&"number"==typeof n&&"number"==typeof o||(r=t,n=e,o=i,t=0,e=0,i=0),t==r&&e==n&&i==o)throw new Error("It's not a legitimate ray!");var a=Math.sqrt((r-t)*(r-t)+(n-e)*(n-e)),s=0!=a?(n-e)/a:1,_=0!=a?(r-t)/a:0,h=(r-t)*_+(n-e)*s,u=o-i,l=Math.sqrt(h*h+u*u),c=0!=l?u/l:1,f=0!=l?h/l:0;return[[s,c*_,_*f,0,-_,s*c,s*f,0,0,-f,c,0,e*_-t*s,i*f-t*_*c-e*s*c,-t*_*f-e*s*f-i*c,1],[s,-_,0,0,c*_,c*s,-f,0,_*f,s*f,c,0,t,e,i,1]]}throw new Error("a1 and b1 is required!")}(e,r,n,o,a,s);return this.__matrix4=i(i(i(_[1],function(t){var e=Math.sin(t),i=Math.cos(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]}(t)),_[0]),this.__matrix4),this},t.prototype.scale=function(t,e,r,n,o,a){return void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=0),this.__matrix4=i(function(t,e,i,r,n,o){return void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),[t,0,0,0,0,e,0,0,0,0,i,0,r-r*t,n-n*e,o-o*i,1]}(t,e,r,n,o,a),this.__matrix4),this},t.prototype.multiply=function(t,e){return void 0===e&&(e=!1),this.__matrix4=e?i(this.__matrix4,t):i(t,this.__matrix4),this},t.prototype.use=function(t,e,r,n){return void 0===r&&(r=0),void 0===n&&(n=1),i(this.__matrix4,[t,e,r,n])},t.prototype.value=function(){return this.__matrix4},t}();function n(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[(r-t)*o-(n-e)*a+t,(r-t)*a+(n-e)*o+e]}var o,a=[],s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)};function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function h(t,e,i){if(i||2===arguments.length)for(var r,n=0,o=e.length;n<o;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var u=["href","title","show","type","role","actuate"],l=function(t,e,i){u.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,i+""):t.setAttribute(e,i+"")},c=l;function f(t,e){l(t,"stroke",e.strokeStyle),l(t,"fill",e.fillStyle),l(t,"stroke-dasharray",e.lineDash.join(","))}function p(t,e){l(t,"fill",e.fillStyle)}function g(t,e){l(t,"stroke",e.strokeStyle),l(t,"fill","none"),l(t,"stroke-dasharray",e.lineDash.join(","))}var m=function(t,e,i,r,n){var o=Math.cos(i),a=Math.sin(i);return[+((r-t)*o-(n-e)*a+t).toFixed(7),+((r-t)*a+(n-e)*o+e).toFixed(7)]};function v(t,e,i,r,n,o,a){e<0&&(t+=e,e*=-1);var s,_=[];s=m(0,0,t,n,0),_[0]=s[0],_[1]=s[1],s=m(0,0,e,s[0],s[1]),_[2]=s[0],_[3]=s[1],s=m(0,0,t,o,0),_[4]=s[0],_[5]=s[1],s=m(0,0,e,s[0],s[1]),_[6]=s[0],_[7]=s[1],a(t,t+e,_[0]+i,_[1]+r,_[4]+i,_[5]+r,_[2]+i,_[3]+r,_[6]+i,_[7]+r,.5*(o-n))}var d=function(t,e,i,r,n){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");c(t,"dy",{top:.5*e.fontSize,middle:0,bottom:.5*-e.fontSize}[e.textBaseline]),function(t,e){for(var i in e)t.style[i]=e[i]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[e.textAlign],"dominant-baseline":"central","font-size":e.fontSize+"px","font-family":e.fontFamily}),c(t,"x",i),c(t,"y",r),"number"==typeof n&&c(t,"transform","rotate("+(n%=360)+","+i+","+r+")")},y=function(t,e,i,r){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");c(t,"cx",e),c(t,"cy",i),c(t,"r",r)},E=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");c(t,"d",e)},b=function(t,e,i,r,n){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");n<0&&(i-=n*=-1),r<0&&(e-=r*=-1),c(t,"x",e),c(t,"y",i),c(t,"width",r),c(t,"height",n)},x=function(t,e,i,r,n,o,a,s){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(a=a/180*Math.PI,s=s/180*Math.PI,a%=2*Math.PI,n>o){var _=n;n=o,o=_}s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=1.999999*Math.PI:s%=2*Math.PI,v(a,s,i,r,n,o,(function(i,r,a,s,_,h,u,l,f,p,g){var m=r-i>Math.PI?1:0,v="M"+a+" "+s;g<0&&(g=-g),v+="A"+n+" "+n+" 0 "+m+" 1 "+u+" "+l,"round"==e.arcEndCap?v+="A"+g+" "+g+" 0 1 0 "+f+" "+p:"-round"==e.arcEndCap?v+="A"+g+" "+g+" 0 1 1 "+f+" "+p:v+="L"+f+" "+p,v+="A"+o+" "+o+" 0 "+m+" 0 "+_+" "+h,"round"==e.arcStartCap?v+="A"+g+" "+g+" 0 1 0 "+a+" "+s:"-round"==e.arcStartCap?v+="A"+g+" "+g+" 0 1 1 "+a+" "+s:v+="L"+a+" "+s,"butt"==e.arcStartCap&&(v+="Z"),c(t,"d",v)}))},w={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},C=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle","font-size":16,"font-family":"sans-serif","arc-start-cap":"butt","arc-end-cap":"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[w[t]||t];for(var e in t){var i=w[e]||e;this.__config[i]=t[e]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,e){var i;return e=e||this.__svg,"string"==typeof t&&(i=t,t=document.createElementNS("http://www.w3.org/2000/svg",i)),e.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,e){var i=t;if("string"==typeof t&&(i={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==i)throw new Error("Unsupported drawing method:"+t);return this.appendEl(i,e)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return u.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)c(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,p(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,g(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),d(this.__useEl,this.__config,e,i,r),this.__useEl.textContent=t,f(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),p(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),g(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,r,n,o){return x(this.__useEl,this.__config,t,e,i,r,n,o),f(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return y(this.__useEl,t,e,i),p(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return y(this.__useEl,t,e,i),g(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return y(this.__useEl,t,e,i),f(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),p(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),g(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,r){return b(this.__useEl,t,e,i,r),f(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return E(this.__useEl,this.__path),p(this.__useEl,this.__config),this},t.prototype.stroke=function(){return E(this.__useEl,this.__path),g(this.__useEl,this.__config),this},t.prototype.full=function(){return E(this.__useEl,this.__path),f(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,r,o){var a=n(t,e,r/180*Math.PI,t+i,e),s=n(t,e,(r+o)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+a[0]+","+a[1]:a[0]==this.__currentPosition[0]&&a[1]==this.__currentPosition[1]||(this.__path+="L"+a[0]+","+a[1]),this.__path+="A"+i+","+i+" 0 "+(o>180||o<-180?1:0)+","+(o>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__path+="Q"+t+" "+e+","+i+" "+r,this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__path+="C"+t+" "+e+","+i+" "+r+","+n+" "+o,this},t}(),T=function(t){function e(e){if(!e)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=e.clientWidth,r=e.clientHeight,n=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.appendChild(n),n.setAttribute("width",i+""),n.setAttribute("height",r+""),n.setAttribute("viewBox","0 0 "+i+" "+r),t.call(this,n)||this}return _(e,t),e}(C),S=function(t,e,i,r,n){return t.beginPath(),t.translate(i,r),t.rotate(n),t.font=e.fontStyle+" "+e.fontWeight+" "+e.fontSize+"px "+e.fontFamily,t},A=function(t,e,i,r,n,o,a,s){if(n>o){var _=n;n=o,o=_}return a%=2*Math.PI,s>=1.999999*Math.PI||s<=1.999999*-Math.PI?s=2*Math.PI:s%=2*Math.PI,v(a,s,i,r,n,o,(function(a,s,_,h,u,l,c,f,p,g,m){m<0&&(m=-m),t.beginPath(),t.moveTo(_,h),t.arc(i,r,n,a,s,!1),"round"==e.arcEndCap?t.arc(.5*(c+p),.5*(f+g),m,s-Math.PI,s,!0):"-round"==e.arcEndCap?t.arc(.5*(c+p),.5*(f+g),m,s-Math.PI,s,!1):t.lineTo(p,g),t.arc(i,r,o,s,a,!0),"round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),m,a,a-Math.PI,!0):"-round"==e.arcStartCap?t.arc(.5*(_+u),.5*(h+l),m,a,a-Math.PI,!1):t.lineTo(_,h)})),"butt"==e.arcStartCap&&t.closePath(),t},M=function(t,e,i,r){return t.beginPath(),t.moveTo(e+r,i),t.arc(e,i,r,0,2*Math.PI),t},P=function(t,e,i,r,n){return t.beginPath(),t.rect(e,i,r,n),t};function L(t,e,i,r,n){for(var o=0,a="",s=0;s<e.length;s++)t.measureText(a+e[s]).width>i?(n(a,((o+=1)-.5)*r),a=e[s]):s==e.length-1?(o+=1,n(a+e[s],(o-.5)*r)):a+=e[s];return o*r}var R=function(){function t(t,e,i){void 0===e&&(e={}),this.__region=null,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",e),this.__region=i,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,e){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,e),"lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(e);else if(t in this.__specialConfig)"fontSize"==t&&(e=Math.round(e)),this.__specialConfig[t]=e;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=e}return this},t.prototype.fillText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,e,i,r),this.painter.save(),S(this.painter,this.__specialConfig,e,i,r).fillText(t,0,0),this.painter.restore(),this},t.prototype.strokeText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,e,i,r),this.painter.save(),S(this.painter,this.__specialConfig,e,i,r).strokeText(t,0,0),this.painter.restore(),this},t.prototype.fullText=function(t,e,i,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,e,i,r),this.painter.save(),S(this.painter,this.__specialConfig,e,i,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore(),this},t.prototype.fillTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),S(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e)}));return this.painter.restore(),s},t.prototype.strokeTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),S(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.strokeText(t,0,e)}));return this.painter.restore(),s},t.prototype.fullTexts=function(t,e,i,r,n,o){var a=this;void 0===n&&(n=1.2),void 0===o&&(o=0),this.__region&&this.__region.fillTexts(t,e,i,r,n),this.painter.save(),S(this.painter,this.__specialConfig,e,i,o);var s=L(this.painter,t,r,this.__specialConfig.fontSize*n,(function(t,e){a.painter.fillText(t,0,e),a.painter.strokeText(t,0,e)}));return this.painter.restore(),s},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.painter.closePath(),this},t.prototype.moveTo=function(t,e){return this.__region&&this.__region.moveTo(t,e),this.painter.moveTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.lineTo=function(t,e){return this.__region&&this.__region.lineTo(t,e),this.painter.lineTo(Math.round(t)+.5,Math.round(e)+.5),this},t.prototype.arc=function(t,e,i,r,n){return this.__region&&this.__region.arc(t,e,i,r,n),this.painter.arc(t,e,i,r,r+n,n<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.painter.fill(),this.painter.stroke(),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,e,i,r){return this.__region&&this.__region.quadraticCurveTo(t,e,i,r),this.painter.quadraticCurveTo(t,e,i,r),this},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){return this.__region&&this.__region.bezierCurveTo(t,e,i,r,n,o),this.painter.bezierCurveTo(t,e,i,r,n,o),this},t.prototype.clearRect=function(t,e,i,r){return this.__region&&this.__region.clearRect(t,e,i,r),this.painter.clearRect(t,e,i,r),this},t.prototype.fillArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fillArc(t,e,i,r,n,o),A(this.painter,this.__specialConfig,t,e,i,r,n,o).fill(),this},t.prototype.strokeArc=function(t,e,i,r,n,o){return this.__region&&this.__region.strokeArc(t,e,i,r,n,o),A(this.painter,this.__specialConfig,t,e,i,r,n,o).stroke(),this},t.prototype.fullArc=function(t,e,i,r,n,o){return this.__region&&this.__region.fullArc(t,e,i,r,n,o),A(this.painter,this.__specialConfig,t,e,i,r,n,o),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillCircle=function(t,e,i){return this.__region&&this.__region.fillCircle(t,e,i),M(this.painter,t,e,i).fill(),this},t.prototype.strokeCircle=function(t,e,i){return this.__region&&this.__region.strokeCircle(t,e,i),M(this.painter,t,e,i).stroke(),this},t.prototype.fullCircle=function(t,e,i){return this.__region&&this.__region.fullCircle(t,e,i),M(this.painter,t,e,i),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillRect=function(t,e,i,r){return this.__region&&this.__region.fillRect(t,e,i,r),P(this.painter,t,e,i,r).fill(),this},t.prototype.strokeRect=function(t,e,i,r){return this.__region&&this.__region.strokeRect(t,e,i,r),P(this.painter,t,e,i,r).stroke(),this},t.prototype.fullRect=function(t,e,i,r){return this.__region&&this.__region.fullRect(t,e,i,r),P(this.painter,t,e,i,r),this.painter.fill(),this.painter.stroke(),this},t}();function k(t,e,i,r){for(var n=[],o=0;o<r;o++)n[o]=t;return function(){for(var o=0;o<r;o++){if(n[o]+i<e){n[o]=+(n[o]+i).toFixed(7);break}o<r-1&&(n[o]=t)}return n}}var I={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},U=function(t){function e(e,i){var r=t.call(this,e,{},new R(i,{willReadFrequently:!0}))||this;return r.name="Canvas",r.__regionList={},r.__regionAssemble=k(0,255,10,3),r.setRegion(""),r}return _(e,t),e.prototype.config=function(t){for(var e in t){var i=I[e]||e;this.useConfig(i,t[e])}return this},e.prototype.setRegion=function(t){if(t){if(null==this.__regionList[t]){var e=this.__regionAssemble();this.__regionList[t]="rgb("+e[0]+","+e[1]+","+e[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,e){var i=this;return new Promise((function(r,n){var o=i.__region.painter.getImageData(t-.5,e-.5,1,1),a=o.data,s=function(){for(var t in i.__regionList)if("rgb("+a[0]+","+a[1]+","+a[2]+")"==i.__regionList[t]){r(t);break}r("")};a?s():o.then((function(t){a=t,s()}))}))},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region.painter:this.painter},e.prototype.createLinearGradient=function(t,e,i,r){return function(t,e,i,r,n){var o=t.createLinearGradient(e,i,r,n),a={value:function(){return o},setColor:function(t,e){return o.addColorStop(t,e),a}};return a}(this.painter,t,e,i,r)},e.prototype.createRadialGradient=function(t,e,i){return function(t,e,i,r){var n=t.createRadialGradient(e,i,0,e,i,r),o={value:function(){return n},setColor:function(t,e){return n.addColorStop(t,e),o}};return o}(this.painter,t,e,i)},e.prototype.getColor=function(t,e){var i=this.painter.getImageData(t-.5,e-.5,1,1).data;return"rgba("+i[0]+","+i[1]+","+i[2]+","+i[3]+")"},e}(R),z=function(t){function e(e){var i=this;if(!e)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");var r,n,o=e.clientWidth,a=e.clientHeight,s=e;s._vislite_canvas_?(r=s._vislite_canvas_[0],n=s._vislite_canvas_[1]):(r=document.createElement("canvas"),e.appendChild(r),n=document.createElement("canvas"),s._vislite_canvas_=[r,n],e.setAttribute("vislite","Canvas"));for(var _=0,h=[r,n];_<h.length;_++){var u=h[_];u.style.width=o+"px",u.setAttribute("width",o+""),u.style.height=a+"px",u.setAttribute("height",a+"")}return(i=t.call(this,r,n)||this).__canvas=r,i}return _(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(e){e(t.__canvas.toDataURL())}))},e}(U);function B(t,e,i){void 0===i&&(i={});for(var r=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,o=0;o<r.length;o++){try{n=t.getContext(r[o],i)}catch(t){}if(n)break}if(!n)throw new Error("Non canvas or browser does not support webgl.");var a=n.canvas.width,s=n.canvas.height,_=a*e,h=s*e;return n.viewport(.5*(a-_),.5*(s-h),_,h),n.depthFunc(n.LEQUAL),n.enable(n.DEPTH_TEST),n}function D(t){var e=t.drawingBufferWidth,i=t.drawingBufferHeight,r=new Uint8Array(4*e*i);return t.readPixels(0,0,e,i,t.RGBA,t.UNSIGNED_BYTE,r),function(t,n){return"rgba("+r[4*((n=i-n)*e+t)]+","+r[4*(n*e+t)+1]+","+r[4*(n*e+t)+2]+","+r[4*(n*e+t)+3]+")"}}var F=function(){function t(t,e){void 0===e&&(e=!1),this.__painter=t,this.__isElement=e,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,e,i,r){var n=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(n,e,r)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,e,i,r){return void 0===r&&(r=0),function(t,e,i,r,n,o,a){t.vertexAttribPointer(e,i,r,a,n,o),t.enableVertexAttribArray(e)}(this.__painter,t,e,this.__painter.FLOAT,i*this.__fsize,r*this.__fsize,!1),this},t}(),N=function(){function t(t,e,i){void 0===i&&(i=0),this.__painter=t,this.__type={"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP}[e],this.__texture=function(t,e,i){var r=t.createTexture();return e==t.TEXTURE_2D&&t.activeTexture(t["TEXTURE"+i]),t.bindTexture(e,r),r}(t,this.__type,i),t.texParameteri(this.__type,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(this.__type,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(this.__type,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}return t.prototype.useImage=function(t){return function(t,e,i,r,n,o){t.texImage2D(e,i,r,r,n,o)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t),this},t.prototype.useCube=function(t,e,i){return function(t,e,i,r,n,o,a,s,_){for(var h,u=[t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z],l=0;l<u.length;l++)o[l]&&(h=u[l],t.texImage2D(h,i,r,a,s,0,r,n,null),t.bindTexture(e,_),t.texImage2D(h,i,r,r,n,o[l]));t.generateMipmap(e)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,t,e,i,this.__texture),this},t}(),H={};function G(t,e,i){var r=t+"-"+i;return H[r]||(H[r]=new N(e,i)),H[r]}var O=function(t,e,i){var r=t.createShader(e);if(null==r)throw new Error("Unable to create shader!");if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(r));return r},W=function(){function t(t){this.__painter=t}return t.prototype.use=function(){return this.__painter.useProgram(this.program),this},t.prototype.compile=function(t,e){return this.program=function(t,e,i){var r=O(t,t.VERTEX_SHADER,e),n=O(t,t.FRAGMENT_SHADER,i),o=t.createProgram();if(t.attachShader(o,r),t.attachShader(o,n),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(o));return o}(this.__painter,t,e),this},t}(),X={};function q(t,e,i,r,n){var o=function(t,e,i){var r=t+(i.geometry.attributes.normal?"1":"0")+(i.material.image?"1":"0")+(i.material.color?"1":"0")+(i.material.colors?"1":"0")+(i.material.cube?"1":"0");if(X[r])return X[r].use();var n="\n attribute vec4 a_position;\n\n ".concat(i.geometry.attributes.normal?"attribute vec4 a_normal;varying vec3 v_normal;":"","\n\n uniform mat4 u_matrix_world;\n uniform mat4 u_matrix_mesh;\n uniform mat4 u_matrix_proporion;\n\n ").concat(i.material.image?"attribute vec2 a_textcoord;varying vec2 v_textcoord;":"","\n\n ").concat(i.material.colors?"attribute vec4 a_color;varying vec4 v_color;":"","\n\n void main(){\n vec4 temp = a_position;\n\n // 应用变换矩阵:屏幕比调平矩阵、世界矩阵、物体矩阵\n temp = u_matrix_proporion * u_matrix_world * u_matrix_mesh * temp;\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\n ").concat(i.geometry.attributes.normal?"v_normal = normalize(vec3(a_normal));":"","\n ").concat(i.material.image?"v_textcoord = a_textcoord;":"","\n ").concat(i.material.colors?"v_color=a_color;":"","\n }\n "),o="\n precision mediump float;\n\n ".concat(i.geometry.attributes.normal?"varying vec3 v_normal;":"","\n ").concat(i.material.color?"uniform vec4 u_color;":"","\n ").concat(i.material.cube?"uniform samplerCube u_texture;":"","\n ").concat(i.material.image?"uniform sampler2D u_sampler;varying vec2 v_textcoord;":"","\n ").concat(i.material.colors?"varying vec4 v_color;":"","\n\n void main(){\n ").concat(i.material.color?"gl_FragColor = u_color;":"","\n ").concat(i.material.cube?"gl_FragColor = textureCube(u_texture,normalize(v_normal));":"","\n ").concat(i.material.image?"gl_FragColor = texture2D(u_sampler,v_textcoord);":"","\n ").concat(i.material.colors?"gl_FragColor=v_color;":"","\n }\n "),a=new W(e).compile(n,o).use();return X[r]=a,a}(t,e,i);if(new F(e).use().write(i.geometry.attributes.position.array).divide(e.getAttribLocation(o.program,"a_position"),i.geometry.attributes.position.itemSize,i.geometry.attributes.position.itemSize,0),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_world"),!1,n.matrix),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_proporion"),!1,n.proporion),e.uniformMatrix4fv(e.getUniformLocation(o.program,"u_matrix_mesh"),!1,r.matrix),i.geometry.attributes.normal&&new F(e).use().write(i.geometry.attributes.normal.array).divide(e.getAttribLocation(o.program,"a_normal"),i.geometry.attributes.normal.itemSize,i.geometry.attributes.normal.itemSize,0),"color"in i.material&&e.uniform4f(e.getUniformLocation(o.program,"u_color"),i.material.color.r,i.material.color.g,i.material.color.b,i.material.color.alpha),"colors"in i.material)new F(e).use().write(i.material.colors.array).divide(e.getAttribLocation(o.program,"a_color"),i.material.colors.itemSize,i.material.colors.itemSize,0);else if("cube"in i.material){var a=i.material.cube.right.image.value.width;G(t,e,"cube").useCube([i.material.cube.right.image.value,i.material.cube.left.image.value,i.material.cube.top.image.value,i.material.cube.bottom.image.value,i.material.cube.far.image.value,i.material.cube.near.image.value],a,a)}else"image"in i.material&&(e.uniform1i(e.getUniformLocation(o.program,"u_sampler"),0),new F(e).use().write(i.geometry.attributes.uv.array).divide(e.getAttribLocation(o.program,"a_textcoord"),i.geometry.attributes.uv.itemSize,2,0),G(t,e,"2d").useImage(i.material.image.value));i.geometry.index?(new F(e,!0).use().write(i.geometry.index.array),e.drawElements(e[i.geometry.type],i.geometry.index.count,e.UNSIGNED_BYTE,0)):e.drawArrays(e[i.geometry.type],0,i.geometry.attributes.position.count)}var V=!1,Y=function(){function t(t,e){this.name="WebGL",this.__getColor=function(t,e){return"rgba(0,0,0,1)"},this.__regionList={},this.__regionAssemble=k(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=B(t,10),this.__regionPainter=B(e,10,{});var i=this.painter.canvas.width/this.painter.canvas.height,n=1,o=1;i>1?n=1/i:o=i;var a=Math.min(n,o);this.__proporion=[n,0,0,0,0,o,0,0,0,0,a,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.clearColor(1,1,1,1),this.__regionPainter.clear(this.__regionPainter.COLOR_BUFFER_BIT)):(this.painter.clearColor(1,1,1,1),this.painter.clear(this.painter.COLOR_BUFFER_BIT));for(var e=0;e<this.__scene.children.length;e++)this.draw(this.__scene.children[e],t);return this},t.prototype.draw=function(t,e){void 0===e&&(e=!1),e||(V=!0);var i={matrix:t.matrix.value()},r={matrix:this.__scene.matrix.value(),proporion:this.__proporion};this.setRegion(t.region);for(var n=0;n<t.mesh.length;n++)e?(q("painter"+this.__unique,this.__regionPainter,{geometry:t.mesh[n].geometry,material:{color:{r:this.__regionColor[0],g:this.__regionColor[1],b:this.__regionColor[2],alpha:this.__regionColor[3]}}},i,r),this.__getColor=D(this.__regionPainter)):q("region"+this.__unique,this.painter,t.mesh[n],i,r)},t.prototype.render=function(t){"matrix"in t||(t.matrix=new r),"region"in t||(t.region="");for(var e=0;e<t.mesh.length;e++){var i=t.mesh[e];i.geometry.attributes.normal&&Array.isArray(i.geometry.attributes.normal.array)&&(i.geometry.attributes.normal.array=new Float32Array(i.geometry.attributes.normal.array)),i.geometry.attributes.position&&Array.isArray(i.geometry.attributes.position.array)&&(i.geometry.attributes.position.array=new Float32Array(i.geometry.attributes.position.array)),i.geometry.attributes.uv&&Array.isArray(i.geometry.attributes.uv.array)&&(i.geometry.attributes.uv.array=new Float32Array(i.geometry.attributes.uv.array)),i.geometry.index&&Array.isArray(i.geometry.index.array)&&(i.geometry.index.array=new Uint8Array(i.geometry.index.array)),i.material.colors&&Array.isArray(i.material.colors.array)&&(i.material.colors.array=new Float32Array(i.material.colors.array))}this.__scene.children.push(t),this.draw(t)},t.prototype.setRegion=function(t){return this.__regionName=t+"",t?(null==this.__regionList[t]&&(this.__regionList[t]=h(h([],this.__regionAssemble(),!0),[1],!1)),this.__regionColor=this.__regionList[t]):this.__regionColor=[0,0,0,1],this},t.prototype.getRegion=function(t,e){var i=this;return V&&this.review(!0),V=!1,new Promise((function(r,n){var o=i.__getColor(t,e);for(var a in i.__regionList){var s=i.__regionList[a];if("rgba("+255*s[0]+","+255*s[1]+","+255*s[2]+","+255*s[3]+")"==o){r(a);break}}r("")}))},t}(),j=function(t){function e(e){if(!e)throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");var i,r,n=e.clientWidth,o=e.clientHeight,a=e;a._vislite_canvas_?(i=a._vislite_canvas_[0],r=a._vislite_canvas_[1]):(r=document.createElement("canvas"),e.appendChild(r),r.style.position="absolute",r.style.zIndex="-1",i=document.createElement("canvas"),e.appendChild(i),a._vislite_canvas_=[i,r],e.setAttribute("vislite","WebGL"));for(var s=0,_=[i,r];s<_.length;s++){var h=_[s];h.style.width=n+"px",h.setAttribute("width",n+""),h.style.height=o+"px",h.setAttribute("height",o+"")}return t.call(this,i,r)||this}return _(e,t),e}(Y),Z=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e*n-i*o,e*o+i*n,r]},Q=function(){function t(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return t.prototype.use=function(t,e){var i,r,n,o,a,s,_=(i=(360-e)/180*Math.PI,r=100*this.__scale,n=0,o=0,a=Math.cos(i),s=Math.sin(i),[o*s+r*a,n,o*a-r*s]);return _=Z(t/180*Math.PI,_[0],_[1],_[2]),_=Z((90-this.__center[0])/180*Math.PI,_[0],_[1],_[2]),_=function(t,e,i,r){var n=Math.cos(t),o=Math.sin(t);return[e,i*n-r*o,i*o+r*n]}((90-this.__center[1])/180*Math.PI,_[0],_[1],_[2]),[-_[0],_[1],_[2]]},t}(),K=function(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Mercator";var i=100*t*Math.PI/180,r=i*e[0],n=-1*i*e[1];this.use=function(t,e){return[.8*(i*t-r),-1*i*e-n]}},J=function(t,e){var i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}},$={Cardinal:e,Hermite:t,Matrix4:r,rotate:n,getLoopColors:function(t,e){void 0===e&&(e=1);var i=["rgba(84,112,198,"+e+")","rgba(145,204,117,"+e+")","rgba(250,200,88,"+e+")","rgba(238,102,102,"+e+")","rgba(115,192,222,"+e+")","rgba(59,162,114,"+e+")","rgba(252,132,82,"+e+")","rgba(154,96,180,"+e+")","rgba(234,124,204,"+e+")"],r=[];if(t<=i.length)return i;if(t%i.length==0)for(var n=0;n<t/i.length;n++)r=r.concat(i);else{for(var o=1;o<t/i.length;o++)r=r.concat(i);if(t%i.length==1)r=r.concat(i[4]);else for(var a=0;a<t%i.length;a++)r=r.concat(i[a])}return r},animation:function(t,e,i){void 0===e&&(e=400),void 0===i&&(i=function(){});var r={timer:function(t,e,i){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return a.push({id:n,createTime:new Date,tick:t,duration:e,callback:i}),r.start(),n},start:function(){o||(o=setInterval(r.tick,13))},tick:function(){var t,e,i,n,o,s,_,h=a;for((a=[]).length=0,e=0;e<h.length;e++)t=(o=h[e]).createTime,i=o.tick,s=o.duration,n=o.callback,i(_=(_=(+(new Date).valueOf()-t.valueOf())/s)>1?1:_),_<1&&o.id?a.push(o):n(_);a.length<=0&&r.stop()},stop:function(){o&&(clearInterval(o),o=null)}},n=r.timer((function(e){t(e)}),e,i);return function(){var t;for(t in a)if(a[t].id==n)return void(a[t].id=void 0)}},ruler:function(t,e,i){if(t<e){var r=e;e=t,t=r}else if(t==e)return[t];var n=function(t){for(var e=t<100&&t>-100?10:.1,i=-1,r=t;10==e?r>=-100&&r<=100:r<=-100||r>=100;)i+=1,r*=e;if(10==e)return Math.pow(10,i);for(var n="0.",o=1;o<i;o++)n+="0";return+(n+"1")}(t-e),o=Math.ceil((t-e)*n/i),a=(o={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}[o]||o)/n,s=Math.floor(e/a)*a,_=[];_.push(s);for(var h=1;_[_.length-1]<t;h++)_.push(s+a*h);return _},SVG:T,Canvas:z,WebGL:j,getWebGLContext:function(t,e){if(void 0===e&&(e=1),!t)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var i,r=t.clientWidth,n=t.clientHeight,o=t;return o._vislite_canvas_?i=o._vislite_canvas_:(i=document.createElement("canvas"),t.appendChild(i),o._vislite_canvas_=i,t.setAttribute("vislite","WebGL")),i.style.width=r+"px",i.setAttribute("width",r+""),i.style.height=n+"px",i.setAttribute("height",n+""),B(i,e)},Shader:W,Texture:N,Buffer:F,Eoap:Q,Mercator:K,viewHandler:function(t){var e=document.getElementsByTagName("body")[0];e.addEventListener("keydown",(function(e){var i=function(t){return{37:"left",38:"up",39:"right",40:"down"}[t.keyCode||t.which]}(e);"up"==i?t({type:"lookUp",normal:[],value:.1}):"down"==i?t({type:"lookDown",normal:[],value:.1}):"left"==i?t({type:"lookLeft",normal:[],value:.1}):"right"==i&&t({type:"lookRight",normal:[],value:.1})}));var i=null,r=function(r){if(null!=i){var n=J(e,r),o=[n.x-i.x,n.y-i.y],a=[o[1],o[0],0];0==a[0]&&0==a[1]||(t({type:"rotate",normal:a,value:.01*(Math.abs(n.x-i.x)+Math.abs(n.y-i.y))}),i=n)}};e.addEventListener("mousedown",(function(t){i=J(e,t)})),e.addEventListener("mouseup",(function(t){i=null})),e.addEventListener("mousemove",(function(t){r(t)})),e.addEventListener("touchend",(function(t){i=null})),e.addEventListener("touchstart",(function(t){i=J(e,t)})),e.addEventListener("touchmove",(function(t){r(t.touches[0])}));var n=function(e){0!=e&&t({type:"scale",value:e<0?.899:1.101,normal:[]})};e.addEventListener("mousewheel",(function(t){n(t.wheelDelta)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(t){n(-1*t.detail)}),!1)}};return $},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite=e();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12: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.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12: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();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12: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.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12:38 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,r;e=this,r=function(){"use strict";return function(e,r,t){if(e<r){var f=r;r=e,e=f}else if(e==r)return[e];var n=function(e){for(var r=e<100&&e>-100?10:.1,t=-1,f=e;10==r?f>=-100&&f<=100:f<=-100||f>=100;)t+=1,f*=r;if(10==r)return Math.pow(10,t);for(var n="0.",o=1;o<t;o++)n+="0";return+(n+"1")}(e-r),o=Math.ceil((e-r)*n/t),i=(o={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}[o]||o)/n,u=Math.floor(r/i)*i,a=[];a.push(u);for(var l=1;a[a.length-1]<e;l++)a.push(u+i*l);return a}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_ruler=r();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12: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.3.0
2
+ * VISLite JavaScript Library v0.3.1
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: Sat Jul 01 2023 00:50:20 GMT+0800 (中国标准时间)
9
+ * Publish Date: Fri Jul 07 2023 23:12: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}):"down"==t?n({type:"lookDown",normal:[],value:.1}):"left"==t?n({type:"lookLeft",normal:[],value:.1}):"right"==t&&n({type:"lookRight",normal:[],value:.1})}));var o=null,i=function(i){if(null!=o){var u=e(t,i),l=[u.x-o.x,u.y-o.y],a=[l[1],l[0],0];0==a[0]&&0==a[1]||(n({type:"rotate",normal:a,value:.01*(Math.abs(u.x-o.x)+Math.abs(u.y-o.y))}),o=u)}};t.addEventListener("mousedown",(function(n){o=e(t,n)})),t.addEventListener("mouseup",(function(e){o=null})),t.addEventListener("mousemove",(function(e){i(e)})),t.addEventListener("touchend",(function(e){o=null})),t.addEventListener("touchstart",(function(n){o=e(t,n)})),t.addEventListener("touchmove",(function(e){i(e.touches[0])}));var u=function(e){0!=e&&n({type:"scale",value:e<0?.899:1.101,normal:[]})};t.addEventListener("mousewheel",(function(e){u(e.wheelDelta)})),window.addEventListener&&window.addEventListener("DOMMouseScroll",(function(e){u(-1*e.detail)}),!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();
@@ -1,99 +1,99 @@
1
- import OralCanvas from "../../lib/OralCanvas/index.es.js";
2
-
3
- let dpr = wx.getSystemInfoSync().pixelRatio;
4
-
5
- Component({
6
- properties: {
7
- width: {
8
- type: Number,
9
- default: 300
10
- },
11
- height: {
12
- type: Number,
13
- default: 150
14
- },
15
- touchstart: {
16
- type: Function,
17
- default: () => { }
18
- }
19
- },
20
- data: {
21
- help: {}
22
- },
23
- lifetimes: {
24
- ready() {
25
-
26
- }
27
- },
28
- methods: {
29
- fetch() {
30
- return new Promise((resolve, reject) => {
31
-
32
- let getCanvasContext = (idName, doback) => {
33
- const query = wx.createSelectorQuery().in(this);
34
- query.select('#' + idName)
35
- .fields({ node: true, size: true })
36
- .exec((res) => {
37
- const canvas = res[0].node;
38
- const ctx = canvas.getContext('2d');
39
-
40
- canvas.width = res[0].width * (idName == "region" ? 1 : dpr);
41
- canvas.height = res[0].height * (idName == "region" ? 1 : dpr);
42
-
43
- if (idName != "region") {
44
- ctx.scale(dpr, dpr);
45
- }
46
-
47
- doback(ctx);
48
- });
49
- };
50
-
51
- getCanvasContext("painter", painter => {
52
- getCanvasContext("region", region => {
53
- this.data.help.instance = new OralCanvas({
54
- getContext() {
55
- return painter;
56
- }
57
- }, {
58
- getContext() {
59
- return region;
60
- }
61
- });
62
-
63
- this.data.help.instance.toDataURL = () => {
64
- return new Promise((resolveUrl) => {
65
- wx.canvasToTempFilePath({
66
- canvasId: "painter",
67
- success: function (e) {
68
- resolveUrl(e.tempFilePath);
69
- },
70
- }, this);
71
- })
72
- };
73
- resolve(this.data.help.instance);
74
- });
75
- });
76
-
77
- });
78
- },
79
- doit(event, doback) {
80
- let x = event.touches[0].x;
81
- let y = event.touches[0].y;
82
-
83
- this.data.help.instance.getRegion(x, y).then((regionName) => {
84
- // 兼容旧语法
85
- if (doback) doback(regionName);
86
-
87
- this.triggerEvent('dotouchstart', {
88
- name: regionName,
89
- x: x,
90
- y: y
91
- })
92
- });
93
- },
94
- doitstart(event) {
95
- this.doit(event, this.data.touchstart);
96
- }
97
- }
98
-
99
- });
1
+ import OralCanvas from "../../lib/OralCanvas/index.es.js";
2
+
3
+ let dpr = wx.getSystemInfoSync().pixelRatio;
4
+
5
+ Component({
6
+ properties: {
7
+ width: {
8
+ type: Number,
9
+ default: 300
10
+ },
11
+ height: {
12
+ type: Number,
13
+ default: 150
14
+ },
15
+ touchstart: {
16
+ type: Function,
17
+ default: () => { }
18
+ }
19
+ },
20
+ data: {
21
+ help: {}
22
+ },
23
+ lifetimes: {
24
+ ready() {
25
+
26
+ }
27
+ },
28
+ methods: {
29
+ fetch() {
30
+ return new Promise((resolve, reject) => {
31
+
32
+ let getCanvasContext = (idName, doback) => {
33
+ const query = wx.createSelectorQuery().in(this);
34
+ query.select('#' + idName)
35
+ .fields({ node: true, size: true })
36
+ .exec((res) => {
37
+ const canvas = res[0].node;
38
+ const ctx = canvas.getContext('2d');
39
+
40
+ canvas.width = res[0].width * (idName == "region" ? 1 : dpr);
41
+ canvas.height = res[0].height * (idName == "region" ? 1 : dpr);
42
+
43
+ if (idName != "region") {
44
+ ctx.scale(dpr, dpr);
45
+ }
46
+
47
+ doback(ctx);
48
+ });
49
+ };
50
+
51
+ getCanvasContext("painter", painter => {
52
+ getCanvasContext("region", region => {
53
+ this.data.help.instance = new OralCanvas({
54
+ getContext() {
55
+ return painter;
56
+ }
57
+ }, {
58
+ getContext() {
59
+ return region;
60
+ }
61
+ });
62
+
63
+ this.data.help.instance.toDataURL = () => {
64
+ return new Promise((resolveUrl) => {
65
+ wx.canvasToTempFilePath({
66
+ canvasId: "painter",
67
+ success: function (e) {
68
+ resolveUrl(e.tempFilePath);
69
+ },
70
+ }, this);
71
+ })
72
+ };
73
+ resolve(this.data.help.instance);
74
+ });
75
+ });
76
+
77
+ });
78
+ },
79
+ doit(event, doback) {
80
+ let x = event.touches[0].x;
81
+ let y = event.touches[0].y;
82
+
83
+ this.data.help.instance.getRegion(x, y).then((regionName) => {
84
+ // 兼容旧语法
85
+ if (doback) doback(regionName);
86
+
87
+ this.triggerEvent('dotouchstart', {
88
+ name: regionName,
89
+ x: x,
90
+ y: y
91
+ })
92
+ });
93
+ },
94
+ doitstart(event) {
95
+ this.doit(event, this.data.touchstart);
96
+ }
97
+ }
98
+
99
+ });
@@ -1,4 +1,4 @@
1
- {
2
- "usingComponents": {},
3
- "component": true
4
- }
1
+ {
2
+ "usingComponents": {},
3
+ "component": true
4
+ }
@@ -1,4 +1,4 @@
1
- <view>
2
- <canvas type="2d" id="painter" style='width:{{width}}px;height:{{height}}px;' bindtouchstart="doitstart"></canvas>
3
- <canvas type="2d" id="region" style='width:{{width}}px;height:{{height}}px;' class="region"></canvas>
4
- </view>
1
+ <view>
2
+ <canvas type="2d" id="painter" style='width:{{width}}px;height:{{height}}px;' bindtouchstart="doitstart"></canvas>
3
+ <canvas type="2d" id="region" style='width:{{width}}px;height:{{height}}px;' class="region"></canvas>
4
+ </view>
@@ -1,5 +1,5 @@
1
- /* 辅助的区域不应该可以看见 */
2
- .region {
3
- position: fixed;
4
- left: 50000px;
5
- }
1
+ /* 辅助的区域不应该可以看见 */
2
+ .region {
3
+ position: fixed;
4
+ left: 50000px;
5
+ }
@@ -1,2 +1,2 @@
1
- import Buffer from '../../src/common/webgl/buffer'
1
+ import Buffer from '../../src/common/webgl/buffer'
2
2
  export default Buffer
@@ -1,2 +1,2 @@
1
- import Canvas from "../../src/Canvas"
1
+ import Canvas from "../../src/Canvas"
2
2
  export default Canvas
@@ -1,3 +1,3 @@
1
- import Cardinal from "../../src/interpolation/Cardinal"
2
-
1
+ import Cardinal from "../../src/interpolation/Cardinal"
2
+
3
3
  export default Cardinal
@@ -1,3 +1,3 @@
1
- import Eoap from "../../src/Eoap"
2
-
1
+ import Eoap from "../../src/Eoap"
2
+
3
3
  export default Eoap
@@ -1,3 +1,3 @@
1
- import Hermite from "../../src/interpolation/Hermite"
2
-
1
+ import Hermite from "../../src/interpolation/Hermite"
2
+
3
3
  export default Hermite
@@ -1,3 +1,3 @@
1
- import Matrix4 from "../../src/Matrix4/index"
2
-
1
+ import Matrix4 from "../../src/Matrix4/index"
2
+
3
3
  export default Matrix4
@@ -1,3 +1,3 @@
1
- import Mercator from "../../src/Mercator"
2
-
1
+ import Mercator from "../../src/Mercator"
2
+
3
3
  export default Mercator
@@ -1,2 +1,2 @@
1
- import _Canvas from "../../src/common/canvas/index"
1
+ import _Canvas from "../../src/common/canvas/index"
2
2
  export default _Canvas
@@ -1,2 +1,2 @@
1
- import _WebGL from "../../src/common/webgl/index"
1
+ import _WebGL from "../../src/common/webgl/index"
2
2
  export default _WebGL
@@ -1,3 +1,3 @@
1
- import SVG from "../../src/SVG"
2
-
1
+ import SVG from "../../src/SVG"
2
+
3
3
  export default SVG
@@ -1,2 +1,2 @@
1
- import Shader from '../../src/common/webgl/shader'
1
+ import Shader from '../../src/common/webgl/shader'
2
2
  export default Shader
@@ -1,2 +1,2 @@
1
- import Texture from '../../src/common/webgl/texture'
1
+ import Texture from '../../src/common/webgl/texture'
2
2
  export default Texture
@@ -1,2 +1,2 @@
1
- import WebGL from "../../src/WebGL"
1
+ import WebGL from "../../src/WebGL"
2
2
  export default WebGL
@@ -1,3 +1,3 @@
1
- import animation from "../../src/animation"
2
-
1
+ import animation from "../../src/animation"
2
+
3
3
  export default animation