vislite 0.5.2-alpha.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/.editorconfig +18 -18
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +143 -137
  4. package/LICENSE +20 -20
  5. package/README.md +69 -69
  6. package/lib/Buffer/index.umd.js +36 -36
  7. package/lib/Buffer/index.umd.min.js +2 -2
  8. package/lib/Canvas/index.umd.js +650 -650
  9. package/lib/Canvas/index.umd.min.js +2 -2
  10. package/lib/Cardinal/index.umd.js +91 -91
  11. package/lib/Cardinal/index.umd.min.js +2 -2
  12. package/lib/Eoap/index.umd.js +34 -34
  13. package/lib/Eoap/index.umd.min.js +2 -2
  14. package/lib/Geometry/index.umd.js +142 -142
  15. package/lib/Geometry/index.umd.min.js +2 -2
  16. package/lib/Hermite/index.umd.js +36 -36
  17. package/lib/Hermite/index.umd.min.js +2 -2
  18. package/lib/Matrix4/index.umd.js +119 -119
  19. package/lib/Matrix4/index.umd.min.js +2 -2
  20. package/lib/Mercator/index.umd.js +20 -20
  21. package/lib/Mercator/index.umd.min.js +2 -2
  22. package/lib/OralCanvas/index.es.js +598 -598
  23. package/lib/OralCanvas/index.es.min.js +2 -2
  24. package/lib/OralWebGL/index.es.js +532 -532
  25. package/lib/OralWebGL/index.es.min.js +3 -3
  26. package/lib/SVG/index.umd.js +470 -405
  27. package/lib/SVG/index.umd.min.js +3 -3
  28. package/lib/Shader/index.umd.js +69 -69
  29. package/lib/Shader/index.umd.min.js +3 -3
  30. package/lib/Texture/index.umd.js +53 -53
  31. package/lib/Texture/index.umd.min.js +2 -2
  32. package/lib/TreeLayout/index.umd.js +363 -363
  33. package/lib/TreeLayout/index.umd.min.js +2 -2
  34. package/lib/WebGL/index.umd.js +579 -579
  35. package/lib/WebGL/index.umd.min.js +3 -3
  36. package/lib/animation/index.umd.js +72 -72
  37. package/lib/animation/index.umd.min.js +2 -2
  38. package/lib/formatColor/index.umd.js +40 -40
  39. package/lib/formatColor/index.umd.min.js +2 -2
  40. package/lib/getLoopColors/index.umd.js +36 -36
  41. package/lib/getLoopColors/index.umd.min.js +2 -2
  42. package/lib/getWebGLContext/index.umd.js +44 -44
  43. package/lib/getWebGLContext/index.umd.min.js +2 -2
  44. package/lib/index.umd.js +2744 -2662
  45. package/lib/index.umd.min.js +3 -3
  46. package/lib/move/index.umd.js +27 -0
  47. package/lib/move/index.umd.min.js +11 -0
  48. package/lib/resizeObserver/index.umd.js +29 -29
  49. package/lib/resizeObserver/index.umd.min.js +2 -2
  50. package/lib/rotate/index.umd.js +8 -8
  51. package/lib/rotate/index.umd.min.js +2 -2
  52. package/lib/ruler/index.umd.js +126 -126
  53. package/lib/ruler/index.umd.min.js +2 -2
  54. package/lib/scale/index.umd.js +26 -0
  55. package/lib/scale/index.umd.min.js +11 -0
  56. package/lib/throttle/index.umd.js +49 -49
  57. package/lib/throttle/index.umd.min.js +2 -2
  58. package/lib/viewHandler/index.umd.js +120 -120
  59. package/lib/viewHandler/index.umd.min.js +2 -2
  60. package/miniprogram/ui-canvas/index.js +107 -107
  61. package/miniprogram/ui-canvas/index.json +4 -4
  62. package/miniprogram/ui-canvas/index.wxml +4 -4
  63. package/miniprogram/ui-canvas/index.wxss +5 -5
  64. package/package/Buffer/index.ts +2 -2
  65. package/package/Canvas/index.ts +2 -2
  66. package/package/Cardinal/index.ts +2 -2
  67. package/package/Eoap/index.ts +2 -2
  68. package/package/Geometry/index.ts +2 -2
  69. package/package/Hermite/index.ts +2 -2
  70. package/package/Matrix4/index.ts +2 -2
  71. package/package/Mercator/index.ts +2 -2
  72. package/package/OralCanvas/index.ts +2 -2
  73. package/package/OralWebGL/index.ts +2 -2
  74. package/package/SVG/index.ts +2 -2
  75. package/package/Shader/index.ts +39 -39
  76. package/package/Texture/index.ts +2 -2
  77. package/package/TreeLayout/index.ts +2 -2
  78. package/package/WebGL/index.ts +2 -2
  79. package/package/animation/index.ts +2 -2
  80. package/package/formatColor/index.ts +2 -2
  81. package/package/getLoopColors/index.ts +2 -2
  82. package/package/getWebGLContext/index.ts +39 -39
  83. package/package/index.ts +76 -72
  84. package/package/move/index.ts +3 -0
  85. package/package/resizeObserver/index.ts +2 -2
  86. package/package/rotate/index.ts +2 -2
  87. package/package/ruler/index.ts +2 -2
  88. package/package/scale/index.ts +3 -0
  89. package/package/throttle/index.ts +2 -2
  90. package/package/viewHandler/index.ts +2 -2
  91. package/package.json +66 -66
  92. package/src/Canvas.ts +67 -67
  93. package/src/Eoap.ts +66 -66
  94. package/src/Geometry.ts +82 -82
  95. package/src/Matrix4/index.ts +76 -76
  96. package/src/Matrix4/move.ts +12 -12
  97. package/src/Matrix4/rotate.ts +15 -15
  98. package/src/Matrix4/scale.ts +11 -11
  99. package/src/Matrix4/transform.ts +64 -64
  100. package/src/Mercator.ts +27 -27
  101. package/src/SVG.ts +24 -24
  102. package/src/TreeLayout/index.ts +186 -186
  103. package/src/WebGL.ts +66 -66
  104. package/src/animation.ts +98 -98
  105. package/src/common/assemble.ts +22 -22
  106. package/src/common/canvas/arc.ts +50 -50
  107. package/src/common/canvas/config.ts +158 -158
  108. package/src/common/canvas/gradient.ts +29 -29
  109. package/src/common/canvas/index.ts +168 -168
  110. package/src/common/canvas/painter.ts +426 -426
  111. package/src/common/canvas/texts.ts +18 -18
  112. package/src/common/geometry/prism-horizontal.ts +33 -33
  113. package/src/common/geometry/prism-vertical.ts +40 -40
  114. package/src/common/geometry/sphere-fragment.ts +39 -39
  115. package/src/common/geometry/tool/circle.ts +11 -11
  116. package/src/common/mergeOption.ts +6 -6
  117. package/src/common/setStyle.ts +5 -5
  118. package/src/common/svg/config.ts +186 -174
  119. package/src/common/svg/gradient.ts +63 -0
  120. package/src/common/svg/index.ts +356 -344
  121. package/src/common/svg/tool.ts +44 -44
  122. package/src/common/tree/index.ts +25 -25
  123. package/src/common/tree/toInnerTree.ts +56 -56
  124. package/src/common/tree/toPlainTree.ts +131 -131
  125. package/src/common/webgl/buffer.ts +79 -79
  126. package/src/common/webgl/doDraw.ts +108 -108
  127. package/src/common/webgl/getColorFactory.ts +26 -26
  128. package/src/common/webgl/getShader.ts +48 -48
  129. package/src/common/webgl/getTexture.ts +11 -11
  130. package/src/common/webgl/getWebGLContext.ts +27 -27
  131. package/src/common/webgl/index.ts +223 -223
  132. package/src/common/webgl/shader.ts +75 -75
  133. package/src/common/webgl/texture.ts +96 -96
  134. package/src/formatColor.ts +44 -44
  135. package/src/getLoopColors.ts +42 -42
  136. package/src/interpolation/Cardinal.ts +110 -110
  137. package/src/interpolation/Hermite.ts +65 -65
  138. package/src/move.ts +8 -0
  139. package/src/resizeObserver.ts +36 -36
  140. package/src/rotate.ts +7 -7
  141. package/src/ruler.ts +188 -188
  142. package/src/scale.ts +7 -0
  143. package/src/shader/fsColor.c +7 -7
  144. package/src/shader/fsColors.c +7 -7
  145. package/src/shader/fsCube.c +8 -8
  146. package/src/shader/fsImage.c +8 -8
  147. package/src/shader/vsColor.c +17 -17
  148. package/src/shader/vsColors.c +13 -13
  149. package/src/shader/vsCube.c +13 -13
  150. package/src/shader/vsImage.c +13 -13
  151. package/src/throttle.ts +51 -51
  152. package/src/viewHandler.ts +158 -158
  153. package/types/Buffer.d.ts +23 -23
  154. package/types/Canvas.d.ts +300 -300
  155. package/types/CanvasConfig.d.ts +106 -106
  156. package/types/CanvasOption.d.ts +7 -7
  157. package/types/Cardinal.d.ts +13 -13
  158. package/types/Geometry.d.ts +40 -40
  159. package/types/GeometryOption.d.ts +11 -11
  160. package/types/GeometryResult.d.ts +18 -18
  161. package/types/Gradient.d.ts +14 -14
  162. package/types/Hermite.d.ts +18 -18
  163. package/types/Map.d.ts +9 -9
  164. package/types/Matrix4.d.ts +42 -42
  165. package/types/Object3D.d.ts +114 -114
  166. package/types/SVG.d.ts +238 -215
  167. package/types/SVGConfig.d.ts +76 -76
  168. package/types/Scene3D.d.ts +6 -6
  169. package/types/Shader.d.ts +21 -21
  170. package/types/Texture.d.ts +16 -16
  171. package/types/Tree.d.ts +69 -69
  172. package/types/TreeConfig.d.ts +24 -24
  173. package/types/TreeLayout.d.ts +54 -54
  174. package/types/TreeOption.d.ts +48 -48
  175. package/types/WebGL.d.ts +38 -38
  176. package/types/WebGLOption.d.ts +7 -7
  177. package/types/animation.d.ts +6 -6
  178. package/types/formatColor.d.ts +2 -2
  179. package/types/getLoopColors.d.ts +2 -2
  180. package/types/getWebGLContext.d.ts +2 -2
  181. package/types/index.d.ts +175 -169
  182. package/types/move.d.ts +3 -0
  183. package/types/painterConfig.d.ts +2 -2
  184. package/types/resizeObserver.d.ts +2 -2
  185. package/types/rotate.d.ts +2 -2
  186. package/types/ruler.d.ts +7 -7
  187. package/types/scale.d.ts +3 -0
  188. package/types/throttle.d.ts +4 -4
  189. package/types/throttleOption.d.ts +21 -21
  190. package/types/viewHandler.d.ts +13 -13
  191. package/uni-app/ui-canvas.vue +226 -226
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.2-alpha.1
2
+ * VISLite JavaScript Library v0.5.2
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: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
9
+ * Publish Date: Sat Nov 04 2023 09:25:44 GMT+0800 (中国标准时间)
10
10
  */
11
- var t,e;t=this,e=function(){"use strict";var t=function(e,i){return t=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])},t(e,i)};"function"==typeof SuppressedError&&SuppressedError;var e=["href","title","show","type","role","actuate"],i=function(t,i,n){e.indexOf(i)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+i,n+""):t.setAttribute(i,n+"")},n=i;function r(t,e){i(t,"stroke",e.strokeStyle),i(t,"fill",e.fillStyle),i(t,"stroke-dasharray",e.lineDash.join(","))}function o(t,e){i(t,"fill",e.fillStyle)}function s(t,e){i(t,"stroke",e.strokeStyle),i(t,"fill","none"),i(t,"stroke-dasharray",e.lineDash.join(","))}var h=function(t,e,i,n,r){var o=Math.cos(i),s=Math.sin(i);return[+((n-t)*o-(r-e)*s+t).toFixed(7),+((n-t)*s+(r-e)*o+e).toFixed(7)]},u=function(t,e,i,r,o){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");n(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}),n(t,"x",i),n(t,"y",r),"number"==typeof o&&n(t,"transform","rotate("+(o%=360)+","+i+","+r+")")},_=function(t,e,i,r){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");n(t,"cx",e),n(t,"cy",i),n(t,"r",r)},c=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");n(t,"d",e)},a=function(t,e,i,r,o){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");o<0&&(i-=o*=-1),r<0&&(e-=r*=-1),n(t,"x",e),n(t,"y",i),n(t,"width",r),n(t,"height",o)},f=function(t,e,i,r,o,s,u,_){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(u=u/180*Math.PI,_=_/180*Math.PI,u%=2*Math.PI,o>s){var c=o;o=s,s=c}_>=1.999999*Math.PI||_<=1.999999*-Math.PI?_=1.999999*Math.PI:_%=2*Math.PI,function(t,e,i,n,r,o,s){e<0&&(t+=e,e*=-1);var u,_=[];u=h(0,0,t,r,0),_[0]=u[0],_[1]=u[1],u=h(0,0,e,u[0],u[1]),_[2]=u[0],_[3]=u[1],u=h(0,0,t,o,0),_[4]=u[0],_[5]=u[1],u=h(0,0,e,u[0],u[1]),_[6]=u[0],_[7]=u[1],s(t,t+e,_[0]+i,_[1]+n,_[4]+i,_[5]+n,_[2]+i,_[3]+n,_[6]+i,_[7]+n,.5*(o-r))}(u,_,i,r,o,s,(function(i,r,h,u,_,c,a,f,l,p,d){var y=r-i>Math.PI?1:0,E="M"+h+" "+u;d<0&&(d=-d),E+="A"+o+" "+o+" 0 "+y+" 1 "+a+" "+f,"round"==e.arcEndCap?E+="A"+d+" "+d+" 0 1 0 "+l+" "+p:"-round"==e.arcEndCap?E+="A"+d+" "+d+" 0 1 1 "+l+" "+p:E+="L"+l+" "+p,E+="A"+s+" "+s+" 0 "+y+" 0 "+_+" "+c,"round"==e.arcStartCap?E+="A"+d+" "+d+" 0 1 0 "+h+" "+u:"-round"==e.arcStartCap?E+="A"+d+" "+d+" 0 1 1 "+h+" "+u:E+="L"+h+" "+u,"butt"==e.arcStartCap&&(E+="Z"),n(t,"d",E)}))};function l(t,e,i,n,r){var o=Math.cos(i),s=Math.sin(i);return[(n-t)*o-(r-e)*s+t,(n-t)*s+(r-e)*o+e]}var p={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},d=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[p[t]||t];for(var e in t){var i=p[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,i){return e.indexOf(i)>-1&&(i="xlink:"+i),t.getAttribute(i)}(this.__useEl,t);for(var i in t)n(this.__useEl,i,t[i]);return this},t.prototype.fillText=function(t,e,i,n){return void 0===n&&(n=0),u(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,o(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,n){return void 0===n&&(n=0),u(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,s(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,n){return void 0===n&&(n=0),u(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,r(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,n,r,s){return f(this.__useEl,this.__config,t,e,i,n,r,s),o(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,n,r,o){return f(this.__useEl,this.__config,t,e,i,n,r,o),s(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,n,o,s){return f(this.__useEl,this.__config,t,e,i,n,o,s),r(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return _(this.__useEl,t,e,i),o(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return _(this.__useEl,t,e,i),s(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return _(this.__useEl,t,e,i),r(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,n){return a(this.__useEl,t,e,i,n),o(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,n){return a(this.__useEl,t,e,i,n),s(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,n){return a(this.__useEl,t,e,i,n),r(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return c(this.__useEl,this.__path),o(this.__useEl,this.__config),this},t.prototype.stroke=function(){return c(this.__useEl,this.__path),s(this.__useEl,this.__config),this},t.prototype.full=function(){return c(this.__useEl,this.__path),r(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,n,r){var o=l(t,e,n/180*Math.PI,t+i,e),s=l(t,e,(n+r)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+o[0]+","+o[1]:o[0]==this.__currentPosition[0]&&o[1]==this.__currentPosition[1]||(this.__path+="L"+o[0]+","+o[1]),this.__path+="A"+i+","+i+" 0 "+(r>180||r<-180?1:0)+","+(r>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,e,i,n){return this.__path+="Q"+t+" "+e+","+i+" "+n,this},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){return this.__path+="C"+t+" "+e+","+i+" "+n+","+r+" "+o,this},t.prototype.bind=function(t,e){return this.__useEl.addEventListener(t,(function(t){e.call(this,t,this)}),!1),this},t}();return function(e){function i(t){if(!t)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=t.clientWidth,n=t.clientHeight,r=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.appendChild(r),r.setAttribute("width",i+""),r.setAttribute("height",n+""),r.setAttribute("viewBox","0 0 "+i+" "+n),e.call(this,r)||this}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}(i,e),i}(d)},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_SVG=e();
11
+ var t,e;t=this,e=function(){"use strict";var t=function(e,i){return t=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])},t(e,i)};"function"==typeof SuppressedError&&SuppressedError;var e=["href","title","show","type","role","actuate"];function i(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}var n=function(t,i,n){e.indexOf(i)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+i,n+""):t.setAttribute(i,n+"")},r=n;function o(t,e){n(t,"stroke",e.strokeStyle),n(t,"fill",e.fillStyle),n(t,"stroke-dasharray",e.lineDash.join(","))}function s(t,e){n(t,"fill",e.fillStyle)}function u(t,e){n(t,"stroke",e.strokeStyle),n(t,"fill","none"),n(t,"stroke-dasharray",e.lineDash.join(","))}var h=function(t,e,i,n,r){var o=Math.cos(i),s=Math.sin(i);return[+((n-t)*o-(r-e)*s+t).toFixed(7),+((n-t)*s+(r-e)*o+e).toFixed(7)]},a=function(t){var e=t.getElementsByTagName("defs");if(e.length<=0){var n=i("defs");return t.appendChild(n),n}return e[0]},_=function(t,e,i,n,o){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");r(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}),r(t,"x",i),r(t,"y",n),"number"==typeof o&&r(t,"transform","rotate("+(o%=360)+","+i+","+n+")")},l=function(t,e,i,n){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");r(t,"cx",e),r(t,"cy",i),r(t,"r",n)},c=function(t,e){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");r(t,"d",e)},f=function(t,e,i,n,o){if("rect"!==t.nodeName.toLowerCase())throw new Error("Need a <rect> !");o<0&&(i-=o*=-1),n<0&&(e-=n*=-1),r(t,"x",e),r(t,"y",i),r(t,"width",n),r(t,"height",o)},p=function(t,e,i,n,o,s,u,a){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(u=u/180*Math.PI,a=a/180*Math.PI,u%=2*Math.PI,o>s){var _=o;o=s,s=_}a>=1.999999*Math.PI||a<=1.999999*-Math.PI?a=1.999999*Math.PI:a%=2*Math.PI,function(t,e,i,n,r,o,s){e<0&&(t+=e,e*=-1);var u,a=[];u=h(0,0,t,r,0),a[0]=u[0],a[1]=u[1],u=h(0,0,e,u[0],u[1]),a[2]=u[0],a[3]=u[1],u=h(0,0,t,o,0),a[4]=u[0],a[5]=u[1],u=h(0,0,e,u[0],u[1]),a[6]=u[0],a[7]=u[1],s(t,t+e,a[0]+i,a[1]+n,a[4]+i,a[5]+n,a[2]+i,a[3]+n,a[6]+i,a[7]+n,.5*(o-r))}(u,a,i,n,o,s,(function(i,n,u,h,a,_,l,c,f,p,d){var y=n-i>Math.PI?1:0,E="M"+u+" "+h;d<0&&(d=-d),E+="A"+o+" "+o+" 0 "+y+" 1 "+l+" "+c,"round"==e.arcEndCap?E+="A"+d+" "+d+" 0 1 0 "+f+" "+p:"-round"==e.arcEndCap?E+="A"+d+" "+d+" 0 1 1 "+f+" "+p:E+="L"+f+" "+p,E+="A"+s+" "+s+" 0 "+y+" 0 "+a+" "+_,"round"==e.arcStartCap?E+="A"+d+" "+d+" 0 1 0 "+u+" "+h:"-round"==e.arcStartCap?E+="A"+d+" "+d+" 0 1 1 "+u+" "+h:E+="L"+u+" "+h,"butt"==e.arcStartCap&&(E+="Z"),r(t,"d",E)}))};function d(t,e,i,n,r){var o=Math.cos(i),s=Math.sin(i);return[(n-t)*o-(r-e)*s+t,(n-t)*s+(r-e)*o+e]}var y={"font-size":"fontSize","font-family":"fontFamily","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},E=function(){function t(t){this.name="SVG",this.__config={fillStyle:"#000",strokeStyle:"#000",lineWidth:1,textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[]},this.__path="",this.__currentPosition=[],this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[y[t]||t];for(var e in t){var i=y[e]||e;this.__config[i]=t[e]}return this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,e){return e=e||this.__svg,"string"==typeof t&&(t=i(t)),e.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,e){var i=t;if("string"==typeof t&&(i={text:"text",path:"path",arc:"path",circle:"circle",rect:"rect"}[t]||""),""==i)throw new Error("Unsupported drawing method:"+t);return this.appendEl(i,e)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,i){return e.indexOf(i)>-1&&(i="xlink:"+i),t.getAttribute(i)}(this.__useEl,t);for(var i in t)r(this.__useEl,i,t[i]);return this},t.prototype.fillText=function(t,e,i,n){return void 0===n&&(n=0),_(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,s(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,e,i,n){return void 0===n&&(n=0),_(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,u(this.__useEl,this.__config),this},t.prototype.fullText=function(t,e,i,n){return void 0===n&&(n=0),_(this.__useEl,this.__config,e,i,n),this.__useEl.textContent=t,o(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,e,i,n,r,o){return p(this.__useEl,this.__config,t,e,i,n,r,o),s(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,e,i,n,r,o){return p(this.__useEl,this.__config,t,e,i,n,r,o),u(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,e,i,n,r,s){return p(this.__useEl,this.__config,t,e,i,n,r,s),o(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,e,i){return l(this.__useEl,t,e,i),s(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,e,i){return l(this.__useEl,t,e,i),u(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,e,i){return l(this.__useEl,t,e,i),o(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,e,i,n){return f(this.__useEl,t,e,i,n),s(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,e,i,n){return f(this.__useEl,t,e,i,n),u(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,e,i,n){return f(this.__useEl,t,e,i,n),o(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,e){return this.__currentPosition=[t,e],this.__path+="M"+t+" "+e,this},t.prototype.lineTo=function(t,e){return this.__currentPosition=[t,e],this.__path+=(""==this.__path?"M":"L")+t+" "+e,this},t.prototype.fill=function(){return c(this.__useEl,this.__path),s(this.__useEl,this.__config),this},t.prototype.stroke=function(){return c(this.__useEl,this.__path),u(this.__useEl,this.__config),this},t.prototype.full=function(){return c(this.__useEl,this.__path),o(this.__useEl,this.__config),this},t.prototype.arc=function(t,e,i,n,r){var o=d(t,e,n/180*Math.PI,t+i,e),s=d(t,e,(n+r)/180*Math.PI,t+i,e);return""==this.__path?this.__path+="M"+o[0]+","+o[1]:o[0]==this.__currentPosition[0]&&o[1]==this.__currentPosition[1]||(this.__path+="L"+o[0]+","+o[1]),this.__path+="A"+i+","+i+" 0 "+(r>180||r<-180?1:0)+","+(r>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,e,i,n){return this.__path+="Q"+t+" "+e+","+i+" "+n,this},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){return this.__path+="C"+t+" "+e+","+i+" "+n+","+r+" "+o,this},t.prototype.bind=function(t,e){return this.__useEl.addEventListener(t,(function(t){e.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,e,n,o){return function(t,e,n,o,s){var u=a(t),h="vislite-lg-"+(new Date).valueOf()+"-"+Math.random(),_=i("linearGradient");u.appendChild(_),r(_,"id",h),r(_,"x1",e+"%"),r(_,"y1",n+"%"),r(_,"x2",o+"%"),r(_,"y2",s+"%");var l={value:function(){return"url(#"+h+")"},setColor:function(t,e){var n=i("stop");return _.appendChild(n),r(n,"offset",100*t+"%"),r(n,"style","stop-color:"+e+";"),l}};return l}(this.__svg,t,e,n,o)},t.prototype.createRadialGradient=function(t,e,n){return function(t,e,n,o){var s=a(t),u="vislite-rg-"+(new Date).valueOf()+"-"+Math.random(),h=i("radialGradient");s.appendChild(h),r(h,"id",u),r(h,"cx",e+"%"),r(h,"cy",n+"%"),r(h,"r",o+"%");var _={value:function(){return"url(#"+u+")"},setColor:function(t,e){var n=i("stop");return h.appendChild(n),r(n,"offset",100*t+"%"),r(n,"style","stop-color:"+e+";"),_}};return _}(this.__svg,t,e,n)},t}();return function(e){function i(t){if(!t)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i=t.clientWidth,n=t.clientHeight,r=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.appendChild(r),r.setAttribute("width",i+""),r.setAttribute("height",n+""),r.setAttribute("viewBox","0 0 "+i+" "+n),e.call(this,r)||this}return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}(i,e),i}(E)},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_SVG=e();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.2-alpha.1
2
+ * VISLite JavaScript Library v0.5.2
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: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
9
+ * Publish Date: Sat Nov 04 2023 09:25:44 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -50,83 +50,83 @@
50
50
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
51
  };
52
52
 
53
- var loadShader = function (painter, type, source) {
54
- var shader = painter.createShader(type);
55
- if (shader == null)
56
- throw new Error('Unable to create shader!');
57
- painter.shaderSource(shader, source);
58
- painter.compileShader(shader);
59
- if (!painter.getShaderParameter(shader, painter.COMPILE_STATUS))
60
- throw new Error('Failed to compile shader:' + painter.getShaderInfoLog(shader));
61
- return shader;
62
- };
63
- var useShader = function (painter, vshaderSource, fshaderSource) {
64
- var vertexShader = loadShader(painter, painter.VERTEX_SHADER, vshaderSource);
65
- var fragmentShader = loadShader(painter, painter.FRAGMENT_SHADER, fshaderSource);
66
- var glProgram = painter.createProgram();
67
- painter.attachShader(glProgram, vertexShader);
68
- painter.attachShader(glProgram, fragmentShader);
69
- painter.linkProgram(glProgram);
70
- if (!painter.getProgramParameter(glProgram, painter.LINK_STATUS))
71
- throw new Error('Failed to link program: ' + painter.getProgramInfoLog(glProgram));
72
- return glProgram;
73
- };
74
- var ShaderObject = (function () {
75
- function ShaderObject(painter) {
76
- this.__painter = painter;
77
- }
78
- ShaderObject.prototype.use = function () {
79
- this.__painter.useProgram(this.program);
80
- return this;
81
- };
82
- ShaderObject.prototype.compile = function (vshaderSource, fshaderSource) {
83
- this.program = useShader(this.__painter, vshaderSource, fshaderSource);
84
- return this;
85
- };
86
- return ShaderObject;
53
+ var loadShader = function (painter, type, source) {
54
+ var shader = painter.createShader(type);
55
+ if (shader == null)
56
+ throw new Error('Unable to create shader!');
57
+ painter.shaderSource(shader, source);
58
+ painter.compileShader(shader);
59
+ if (!painter.getShaderParameter(shader, painter.COMPILE_STATUS))
60
+ throw new Error('Failed to compile shader:' + painter.getShaderInfoLog(shader));
61
+ return shader;
62
+ };
63
+ var useShader = function (painter, vshaderSource, fshaderSource) {
64
+ var vertexShader = loadShader(painter, painter.VERTEX_SHADER, vshaderSource);
65
+ var fragmentShader = loadShader(painter, painter.FRAGMENT_SHADER, fshaderSource);
66
+ var glProgram = painter.createProgram();
67
+ painter.attachShader(glProgram, vertexShader);
68
+ painter.attachShader(glProgram, fragmentShader);
69
+ painter.linkProgram(glProgram);
70
+ if (!painter.getProgramParameter(glProgram, painter.LINK_STATUS))
71
+ throw new Error('Failed to link program: ' + painter.getProgramInfoLog(glProgram));
72
+ return glProgram;
73
+ };
74
+ var ShaderObject = (function () {
75
+ function ShaderObject(painter) {
76
+ this.__painter = painter;
77
+ }
78
+ ShaderObject.prototype.use = function () {
79
+ this.__painter.useProgram(this.program);
80
+ return this;
81
+ };
82
+ ShaderObject.prototype.compile = function (vshaderSource, fshaderSource) {
83
+ this.program = useShader(this.__painter, vshaderSource, fshaderSource);
84
+ return this;
85
+ };
86
+ return ShaderObject;
87
87
  }());
88
88
 
89
- var vsColor = "attribute vec4 a_position;\nuniform mat4 u_matrix;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\n temp.z = -1.0 * temp.z;\n\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\n float dist = 4.0;\n\n // 使用投影直接计算\n // 为保证纹理和相对位置正确\n // x、y、z的改变满足线性变换\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n}";
89
+ var vsColor = "attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n\r\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\r\n temp.z = -1.0 * temp.z;\r\n\r\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\r\n float dist = 4.0;\r\n\r\n // 使用投影直接计算\r\n // 为保证纹理和相对位置正确\r\n // x、y、z的改变满足线性变换\r\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));\r\n}";
90
90
 
91
- var vsColors = "attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_color = a_color;\n}";
91
+ var vsColors = "attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec4 a_color;\r\nvarying vec4 v_color;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_color = a_color;\r\n}";
92
92
 
93
- var vsImage = "attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec2 a_textcoord;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_textcoord = a_textcoord;\n}";
93
+ var vsImage = "attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec2 a_textcoord;\r\nvarying vec2 v_textcoord;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_textcoord = a_textcoord;\r\n}";
94
94
 
95
- var vsCube = "attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_normal;\nvarying vec3 v_normal;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_normal = normalize(vec3(a_normal));\n}";
95
+ var vsCube = "attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec4 a_normal;\r\nvarying vec3 v_normal;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_normal = normalize(vec3(a_normal));\r\n}";
96
96
 
97
- var fsColor = "precision mediump float;\n\nuniform vec4 u_color;\n\nvoid main()\n{\n gl_FragColor = u_color;\n}";
97
+ var fsColor = "precision mediump float;\r\n\r\nuniform vec4 u_color;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = u_color;\r\n}";
98
98
 
99
- var fsColors = "precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}";
99
+ var fsColors = "precision mediump float;\r\n\r\nvarying vec4 v_color;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = v_color;\r\n}";
100
100
 
101
- var fsImage = "precision mediump float;\n\nuniform sampler2D u_sampler;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n gl_FragColor = texture2D(u_sampler, v_textcoord);\n}";
101
+ var fsImage = "precision mediump float;\r\n\r\nuniform sampler2D u_sampler;\r\nvarying vec2 v_textcoord;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = texture2D(u_sampler, v_textcoord);\r\n}";
102
102
 
103
- var fsCube = "precision mediump float;\n\nvarying vec3 v_normal;\nuniform samplerCube u_texture;\n\nvoid main()\n{\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\n}";
103
+ var fsCube = "precision mediump float;\r\n\r\nvarying vec3 v_normal;\r\nuniform samplerCube u_texture;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\r\n}";
104
104
 
105
- var Shader = (function (_super) {
106
- __extends(Shader, _super);
107
- function Shader() {
108
- return _super !== null && _super.apply(this, arguments) || this;
109
- }
110
- Shader.prototype.compile = function (arg1, arg2) {
111
- if (arg2) {
112
- _super.prototype.compile.call(this, arg1, arg2);
113
- }
114
- else {
115
- _super.prototype.compile.call(this, {
116
- "color": vsColor,
117
- "colors": vsColors,
118
- "image": vsImage,
119
- "cube": vsCube
120
- }[arg1], {
121
- "color": fsColor,
122
- "colors": fsColors,
123
- "image": fsImage,
124
- "cube": fsCube
125
- }[arg1]);
126
- }
127
- return this;
128
- };
129
- return Shader;
105
+ var Shader = (function (_super) {
106
+ __extends(Shader, _super);
107
+ function Shader() {
108
+ return _super !== null && _super.apply(this, arguments) || this;
109
+ }
110
+ Shader.prototype.compile = function (arg1, arg2) {
111
+ if (arg2) {
112
+ _super.prototype.compile.call(this, arg1, arg2);
113
+ }
114
+ else {
115
+ _super.prototype.compile.call(this, {
116
+ "color": vsColor,
117
+ "colors": vsColors,
118
+ "image": vsImage,
119
+ "cube": vsCube
120
+ }[arg1], {
121
+ "color": fsColor,
122
+ "colors": fsColors,
123
+ "image": fsImage,
124
+ "cube": fsCube
125
+ }[arg1]);
126
+ }
127
+ return this;
128
+ };
129
+ return Shader;
130
130
  }(ShaderObject));
131
131
 
132
132
  return Shader;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.2-alpha.1
2
+ * VISLite JavaScript Library v0.5.2
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: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
9
+ * Publish Date: Sat Nov 04 2023 09:25:44 GMT+0800 (中国标准时间)
10
10
  */
11
- var t,n;t=this,n=function(){"use strict";var t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},t(n,e)};"function"==typeof SuppressedError&&SuppressedError;var n=function(t,n,e){var o=t.createShader(n);if(null==o)throw new Error("Unable to create shader!");if(t.shaderSource(o,e),t.compileShader(o),!t.getShaderParameter(o,t.COMPILE_STATUS))throw new Error("Failed to compile shader:"+t.getShaderInfoLog(o));return o},e=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,o){var r=n(t,t.VERTEX_SHADER,e),i=n(t,t.FRAGMENT_SHADER,o),a=t.createProgram();if(t.attachShader(a,r),t.attachShader(a,i),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new Error("Failed to link program: "+t.getProgramInfoLog(a));return a}(this.__painter,t,e),this},t}(),o=function(n){function e(){return null!==n&&n.apply(this,arguments)||this}return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,n),e.prototype.compile=function(t,e){return e?n.prototype.compile.call(this,t,e):n.prototype.compile.call(this,{color:"attribute vec4 a_position;\nuniform mat4 u_matrix;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\n temp.z = -1.0 * temp.z;\n\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\n float dist = 4.0;\n\n // 使用投影直接计算\n // 为保证纹理和相对位置正确\n // x、y、z的改变满足线性变换\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n}",colors:"attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_color = a_color;\n}",image:"attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec2 a_textcoord;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_textcoord = a_textcoord;\n}",cube:"attribute vec4 a_position;\nuniform mat4 u_matrix;\nattribute vec4 a_normal;\nvarying vec3 v_normal;\n\nvoid main()\n{\n vec4 temp = u_matrix * a_position;\n temp.z = -1.0 * temp.z;\n float dist = 4.0;\n gl_Position = vec4((dist + 1.0) * temp.x, (dist + 1.0) * temp.y, dist * (dist + temp.z) + 1.0 - dist * dist, temp.w * 2.0 * (dist + temp.z));\n\n v_normal = normalize(vec3(a_normal));\n}"}[t],{color:"precision mediump float;\n\nuniform vec4 u_color;\n\nvoid main()\n{\n gl_FragColor = u_color;\n}",colors:"precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = v_color;\n}",image:"precision mediump float;\n\nuniform sampler2D u_sampler;\nvarying vec2 v_textcoord;\n\nvoid main()\n{\n gl_FragColor = texture2D(u_sampler, v_textcoord);\n}",cube:"precision mediump float;\n\nvarying vec3 v_normal;\nuniform samplerCube u_texture;\n\nvoid main()\n{\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\n}"}[t]),this},e}(e);return o},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Shader=n();
11
+ var r,t;r=this,t=function(){"use strict";var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])},r(t,n)};"function"==typeof SuppressedError&&SuppressedError;var t=function(r,t,n){var e=r.createShader(t);if(null==e)throw new Error("Unable to create shader!");if(r.shaderSource(e,n),r.compileShader(e),!r.getShaderParameter(e,r.COMPILE_STATUS))throw new Error("Failed to compile shader:"+r.getShaderInfoLog(e));return e},n=function(){function r(r){this.__painter=r}return r.prototype.use=function(){return this.__painter.useProgram(this.program),this},r.prototype.compile=function(r,n){return this.program=function(r,n,e){var o=t(r,r.VERTEX_SHADER,n),i=t(r,r.FRAGMENT_SHADER,e),a=r.createProgram();if(r.attachShader(a,o),r.attachShader(a,i),r.linkProgram(a),!r.getProgramParameter(a,r.LINK_STATUS))throw new Error("Failed to link program: "+r.getProgramInfoLog(a));return a}(this.__painter,r,n),this},r}(),e=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.compile=function(r,n){return n?t.prototype.compile.call(this,r,n):t.prototype.compile.call(this,{color:"attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n\r\n // 把原生的WebGL使用的左手坐标系变成了右手坐标系\r\n temp.z = -1.0 * temp.z;\r\n\r\n // 表示眼睛距离vec4(0.0,0.0,1.0)的距离\r\n float dist = 4.0;\r\n\r\n // 使用投影直接计算\r\n // 为保证纹理和相对位置正确\r\n // x、y、z的改变满足线性变换\r\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));\r\n}",colors:"attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec4 a_color;\r\nvarying vec4 v_color;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_color = a_color;\r\n}",image:"attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec2 a_textcoord;\r\nvarying vec2 v_textcoord;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_textcoord = a_textcoord;\r\n}",cube:"attribute vec4 a_position;\r\nuniform mat4 u_matrix;\r\nattribute vec4 a_normal;\r\nvarying vec3 v_normal;\r\n\r\nvoid main()\r\n{\r\n vec4 temp = u_matrix * a_position;\r\n temp.z = -1.0 * temp.z;\r\n float dist = 4.0;\r\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));\r\n\r\n v_normal = normalize(vec3(a_normal));\r\n}"}[r],{color:"precision mediump float;\r\n\r\nuniform vec4 u_color;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = u_color;\r\n}",colors:"precision mediump float;\r\n\r\nvarying vec4 v_color;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = v_color;\r\n}",image:"precision mediump float;\r\n\r\nuniform sampler2D u_sampler;\r\nvarying vec2 v_textcoord;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = texture2D(u_sampler, v_textcoord);\r\n}",cube:"precision mediump float;\r\n\r\nvarying vec3 v_normal;\r\nuniform samplerCube u_texture;\r\n\r\nvoid main()\r\n{\r\n gl_FragColor = textureCube(u_texture, normalize(v_normal));\r\n}"}[r]),this},n}(n);return e},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r="undefined"!=typeof globalThis?globalThis:r||self).VISLite_Shader=t();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.2-alpha.1
2
+ * VISLite JavaScript Library v0.5.2
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: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
9
+ * Publish Date: Sat Nov 04 2023 09:25:44 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -14,57 +14,57 @@
14
14
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Texture = factory());
15
15
  })(this, (function () { 'use strict';
16
16
 
17
- var initTexture = function (painter, type, unit) {
18
- var texture = painter.createTexture();
19
- painter.activeTexture(painter['TEXTURE' + unit]);
20
- painter.bindTexture(type, texture);
21
- return texture;
22
- };
23
- var linkImage = function (painter, type, level, format, textureType, image) {
24
- painter.texImage2D(type, level, format, format, textureType, image);
25
- };
26
- var linkCube = function (painter, type, level, format, textureType, images, width, height, texture) {
27
- var types = [
28
- painter.TEXTURE_CUBE_MAP_POSITIVE_X,
29
- painter.TEXTURE_CUBE_MAP_NEGATIVE_X,
30
- painter.TEXTURE_CUBE_MAP_POSITIVE_Y,
31
- painter.TEXTURE_CUBE_MAP_NEGATIVE_Y,
32
- painter.TEXTURE_CUBE_MAP_POSITIVE_Z,
33
- painter.TEXTURE_CUBE_MAP_NEGATIVE_Z
34
- ], target;
35
- for (var i = 0; i < types.length; i++) {
36
- if (images[i]) {
37
- target = types[i];
38
- painter.texImage2D(target, level, format, width, height, 0, format, textureType, null);
39
- painter.bindTexture(type, texture);
40
- painter.texImage2D(target, level, format, format, textureType, images[i]);
41
- }
42
- }
43
- painter.generateMipmap(type);
44
- };
45
- var TextureObject = (function () {
46
- function TextureObject(painter, type, unit) {
47
- if (unit === void 0) { unit = 0; }
48
- this.__painter = painter;
49
- this.__type = {
50
- "2d": painter.TEXTURE_2D,
51
- "cube": painter.TEXTURE_CUBE_MAP
52
- }[type];
53
- this.__texture = initTexture(painter, this.__type, unit);
54
- painter.texParameteri(this.__type, painter.TEXTURE_MIN_FILTER, painter.NEAREST);
55
- painter.texParameteri(this.__type, painter.TEXTURE_MAG_FILTER, painter.NEAREST);
56
- painter.texParameteri(this.__type, painter.TEXTURE_WRAP_S, painter.CLAMP_TO_EDGE);
57
- painter.texParameteri(this.__type, painter.TEXTURE_WRAP_T, painter.CLAMP_TO_EDGE);
58
- }
59
- TextureObject.prototype.useImage = function (image) {
60
- linkImage(this.__painter, this.__type, 0, this.__painter.RGBA, this.__painter.UNSIGNED_BYTE, image);
61
- return this;
62
- };
63
- TextureObject.prototype.useCube = function (images, width, height) {
64
- linkCube(this.__painter, this.__type, 0, this.__painter.RGBA, this.__painter.UNSIGNED_BYTE, images, width, height, this.__texture);
65
- return this;
66
- };
67
- return TextureObject;
17
+ var initTexture = function (painter, type, unit) {
18
+ var texture = painter.createTexture();
19
+ painter.activeTexture(painter['TEXTURE' + unit]);
20
+ painter.bindTexture(type, texture);
21
+ return texture;
22
+ };
23
+ var linkImage = function (painter, type, level, format, textureType, image) {
24
+ painter.texImage2D(type, level, format, format, textureType, image);
25
+ };
26
+ var linkCube = function (painter, type, level, format, textureType, images, width, height, texture) {
27
+ var types = [
28
+ painter.TEXTURE_CUBE_MAP_POSITIVE_X,
29
+ painter.TEXTURE_CUBE_MAP_NEGATIVE_X,
30
+ painter.TEXTURE_CUBE_MAP_POSITIVE_Y,
31
+ painter.TEXTURE_CUBE_MAP_NEGATIVE_Y,
32
+ painter.TEXTURE_CUBE_MAP_POSITIVE_Z,
33
+ painter.TEXTURE_CUBE_MAP_NEGATIVE_Z
34
+ ], target;
35
+ for (var i = 0; i < types.length; i++) {
36
+ if (images[i]) {
37
+ target = types[i];
38
+ painter.texImage2D(target, level, format, width, height, 0, format, textureType, null);
39
+ painter.bindTexture(type, texture);
40
+ painter.texImage2D(target, level, format, format, textureType, images[i]);
41
+ }
42
+ }
43
+ painter.generateMipmap(type);
44
+ };
45
+ var TextureObject = (function () {
46
+ function TextureObject(painter, type, unit) {
47
+ if (unit === void 0) { unit = 0; }
48
+ this.__painter = painter;
49
+ this.__type = {
50
+ "2d": painter.TEXTURE_2D,
51
+ "cube": painter.TEXTURE_CUBE_MAP
52
+ }[type];
53
+ this.__texture = initTexture(painter, this.__type, unit);
54
+ painter.texParameteri(this.__type, painter.TEXTURE_MIN_FILTER, painter.NEAREST);
55
+ painter.texParameteri(this.__type, painter.TEXTURE_MAG_FILTER, painter.NEAREST);
56
+ painter.texParameteri(this.__type, painter.TEXTURE_WRAP_S, painter.CLAMP_TO_EDGE);
57
+ painter.texParameteri(this.__type, painter.TEXTURE_WRAP_T, painter.CLAMP_TO_EDGE);
58
+ }
59
+ TextureObject.prototype.useImage = function (image) {
60
+ linkImage(this.__painter, this.__type, 0, this.__painter.RGBA, this.__painter.UNSIGNED_BYTE, image);
61
+ return this;
62
+ };
63
+ TextureObject.prototype.useCube = function (images, width, height) {
64
+ linkCube(this.__painter, this.__type, 0, this.__painter.RGBA, this.__painter.UNSIGNED_BYTE, images, width, height, this.__texture);
65
+ return this;
66
+ };
67
+ return TextureObject;
68
68
  }());
69
69
 
70
70
  return TextureObject;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.2-alpha.1
2
+ * VISLite JavaScript Library v0.5.2
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: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
9
+ * Publish Date: Sat Nov 04 2023 09:25:44 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,t;e=this,t=function(){"use strict";return function(){function e(e,t,_){void 0===_&&(_=0),this.__painter=e,this.__type={"2d":e.TEXTURE_2D,cube:e.TEXTURE_CUBE_MAP}[t],this.__texture=function(e,t,_){var E=e.createTexture();return e.activeTexture(e["TEXTURE"+_]),e.bindTexture(t,E),E}(e,this.__type,_),e.texParameteri(this.__type,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(this.__type,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(this.__type,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(this.__type,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}return e.prototype.useImage=function(e){return function(e,t,_,E,i,T){e.texImage2D(t,_,E,E,i,T)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,e),this},e.prototype.useCube=function(e,t,_){return function(e,t,_,E,i,T,r,n,u){for(var a,s=[e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z],p=0;p<s.length;p++)T[p]&&(a=s[p],e.texImage2D(a,_,E,r,n,0,E,i,null),e.bindTexture(t,u),e.texImage2D(a,_,E,E,i,T[p]));e.generateMipmap(t)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,e,t,_,this.__texture),this},e}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_Texture=t();