vislite 0.4.1-alpha.1 → 0.4.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.editorconfig +19 -0
  2. package/CHANGELOG +32 -11
  3. package/README.md +16 -1
  4. package/lib/Buffer/index.umd.js +2 -2
  5. package/lib/Buffer/index.umd.min.js +2 -2
  6. package/lib/Canvas/index.umd.js +131 -39
  7. package/lib/Canvas/index.umd.min.js +3 -3
  8. package/lib/Cardinal/index.umd.js +2 -2
  9. package/lib/Cardinal/index.umd.min.js +2 -2
  10. package/lib/Eoap/index.umd.js +2 -2
  11. package/lib/Eoap/index.umd.min.js +2 -2
  12. package/lib/Hermite/index.umd.js +2 -2
  13. package/lib/Hermite/index.umd.min.js +2 -2
  14. package/lib/Matrix4/index.umd.js +2 -2
  15. package/lib/Matrix4/index.umd.min.js +2 -2
  16. package/lib/Mercator/index.umd.js +2 -2
  17. package/lib/Mercator/index.umd.min.js +2 -2
  18. package/lib/OralCanvas/index.es.js +110 -33
  19. package/lib/OralCanvas/index.es.min.js +3 -3
  20. package/lib/OralWebGL/index.es.js +55 -24
  21. package/lib/OralWebGL/index.es.min.js +3 -3
  22. package/lib/SVG/index.umd.js +2 -2
  23. package/lib/SVG/index.umd.min.js +2 -2
  24. package/lib/Shader/index.umd.js +82 -3
  25. package/lib/Shader/index.umd.min.js +3 -3
  26. package/lib/Texture/index.umd.js +3 -5
  27. package/lib/Texture/index.umd.min.js +3 -3
  28. package/lib/TreeLayout/index.umd.js +427 -0
  29. package/lib/TreeLayout/index.umd.min.js +11 -0
  30. package/lib/WebGL/index.umd.js +80 -34
  31. package/lib/WebGL/index.umd.min.js +3 -3
  32. package/lib/animation/index.umd.js +3 -3
  33. package/lib/animation/index.umd.min.js +2 -2
  34. package/lib/formatColor/index.umd.js +59 -0
  35. package/lib/formatColor/index.umd.min.js +11 -0
  36. package/lib/getLoopColors/index.umd.js +2 -2
  37. package/lib/getLoopColors/index.umd.min.js +2 -2
  38. package/lib/getWebGLContext/index.umd.js +2 -2
  39. package/lib/getWebGLContext/index.umd.min.js +2 -2
  40. package/lib/index.umd.js +632 -74
  41. package/lib/index.umd.min.js +3 -3
  42. package/lib/resizeObserver/index.umd.js +48 -0
  43. package/lib/resizeObserver/index.umd.min.js +11 -0
  44. package/lib/rotate/index.umd.js +2 -2
  45. package/lib/rotate/index.umd.min.js +2 -2
  46. package/lib/ruler/index.umd.js +2 -2
  47. package/lib/ruler/index.umd.min.js +2 -2
  48. package/lib/throttle/index.umd.js +68 -0
  49. package/lib/throttle/index.umd.min.js +11 -0
  50. package/lib/viewHandler/index.umd.js +2 -2
  51. package/lib/viewHandler/index.umd.min.js +2 -2
  52. package/miniprogram/ui-canvas/index.js +23 -15
  53. package/miniprogram/ui-canvas/index.wxml +1 -1
  54. package/package/Buffer/index.ts +1 -0
  55. package/package/Canvas/index.ts +1 -0
  56. package/package/OralCanvas/index.ts +1 -0
  57. package/package/OralWebGL/index.ts +1 -0
  58. package/package/Shader/index.ts +39 -1
  59. package/package/Texture/index.ts +1 -0
  60. package/package/TreeLayout/index.ts +3 -0
  61. package/package/WebGL/index.ts +1 -0
  62. package/package/formatColor/index.ts +3 -0
  63. package/package/index.ts +12 -1
  64. package/package/resizeObserver/index.ts +3 -0
  65. package/package/throttle/index.ts +3 -0
  66. package/package.json +1 -1
  67. package/src/Canvas.ts +18 -7
  68. package/src/Eoap.ts +1 -1
  69. package/src/Matrix4/index.ts +1 -1
  70. package/src/Mercator.ts +1 -1
  71. package/src/SVG.ts +2 -1
  72. package/src/TreeLayout/index.ts +186 -0
  73. package/src/WebGL.ts +24 -11
  74. package/src/animation.ts +2 -3
  75. package/src/common/canvas/config.ts +2 -1
  76. package/src/common/canvas/index.ts +44 -30
  77. package/src/common/canvas/painter.ts +74 -5
  78. package/src/common/canvas/texts.ts +1 -1
  79. package/src/common/mergeOption.ts +7 -0
  80. package/src/common/svg/config.ts +2 -1
  81. package/src/common/svg/index.ts +2 -1
  82. package/src/common/svg/tool.ts +2 -1
  83. package/src/common/tree/index.ts +26 -0
  84. package/src/common/tree/toInnerTree.ts +57 -0
  85. package/src/common/tree/toPlainTree.ts +132 -0
  86. package/src/common/webgl/doDraw.ts +2 -0
  87. package/src/common/webgl/getShader.ts +25 -52
  88. package/src/common/webgl/index.ts +28 -21
  89. package/src/common/webgl/texture.ts +2 -5
  90. package/src/formatColor.ts +45 -0
  91. package/src/interpolation/Cardinal.ts +2 -1
  92. package/src/interpolation/Hermite.ts +1 -1
  93. package/src/resizeObserver.ts +37 -0
  94. package/src/ruler.ts +1 -1
  95. package/src/shader/fsColor.c +8 -0
  96. package/src/shader/fsColors.c +8 -0
  97. package/src/shader/fsCube.c +9 -0
  98. package/src/shader/fsImage.c +9 -0
  99. package/src/shader/vsColor.c +18 -0
  100. package/src/shader/vsColors.c +14 -0
  101. package/src/shader/vsCube.c +14 -0
  102. package/src/shader/vsImage.c +14 -0
  103. package/src/throttle.ts +50 -0
  104. package/src/viewHandler.ts +1 -1
  105. package/types/Canvas.d.ts +12 -0
  106. package/types/CanvasOption.d.ts +8 -0
  107. package/types/Shader.d.ts +6 -0
  108. package/types/Tree.d.ts +38 -0
  109. package/types/TreeConfig.d.ts +25 -0
  110. package/types/TreeLayout.d.ts +49 -0
  111. package/types/TreeOption.d.ts +46 -0
  112. package/types/WebGLOption.d.ts +8 -0
  113. package/types/formatColor.d.ts +3 -0
  114. package/types/index.d.ts +29 -3
  115. package/types/resizeObserver.d.ts +3 -0
  116. package/types/throttle.d.ts +5 -0
  117. package/types/throttleOption.d.ts +20 -0
  118. package/uni-app/ui-canvas.vue +24 -14
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
- var t,i;t=this,i=function(){"use strict";var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};function i(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}"function"==typeof SuppressedError&&SuppressedError;var e=function(t,i,e,r,n){var o=Math.cos(e),s=Math.sin(e);return[+((r-t)*o-(n-i)*s+t).toFixed(7),+((r-t)*s+(n-i)*o+i).toFixed(7)]},r=function(t,i,e,r,n){return t.beginPath(),t.translate(e,r),t.rotate(n),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},n=function(t,i,r,n,o,s,a,h){if(o>s){var l=o;o=s,s=l}return a%=2*Math.PI,h>=1.999999*Math.PI||h<=1.999999*-Math.PI?h=2*Math.PI:h%=2*Math.PI,function(t,i,r,n,o,s,a){i<0&&(t+=i,i*=-1);var h,l=[];h=e(0,0,t,o,0),l[0]=h[0],l[1]=h[1],h=e(0,0,i,h[0],h[1]),l[2]=h[0],l[3]=h[1],h=e(0,0,t,s,0),l[4]=h[0],l[5]=h[1],h=e(0,0,i,h[0],h[1]),l[6]=h[0],l[7]=h[1],a(t,t+i,l[0]+r,l[1]+n,l[4]+r,l[5]+n,l[2]+r,l[3]+n,l[6]+r,l[7]+n,.5*(s-o))}(a,h,r,n,o,s,(function(e,a,h,l,p,_,u,f,c,g,v){v<0&&(v=-v),t.beginPath(),t.moveTo(h,l),t.arc(r,n,o,e,a,!1),"round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),v,a-Math.PI,a,!0):"-round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),v,a-Math.PI,a,!1):t.lineTo(c,g),t.arc(r,n,s,a,e,!0),"round"==i.arcStartCap?t.arc(.5*(h+p),.5*(l+_),v,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(h+p),.5*(l+_),v,e,e-Math.PI,!1):t.lineTo(h,l)})),"butt"==i.arcStartCap&&t.closePath(),t},o=function(t,i,e,r){return t.beginPath(),t.moveTo(i+r,e),t.arc(i,e,r,0,2*Math.PI),t},s=function(t,i,e,r,n){return t.beginPath(),t.rect(i,e,r,n),t};function a(t,i,e,r,n){for(var o=0,s="",a=0;a<i.length;a++)t.measureText(s+i[a]).width>e?(n(s,((o+=1)-.5)*r),s=i[a]):a==i.length-1?(o+=1,n(s+i[a],(o-.5)*r)):s+=i[a];return o*r}var h=function(){function t(t,i,e){void 0===i&&(i={}),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",i),this.__region=e,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),"lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fillText(t,i,e,n),this.painter.save(),r(this.painter,this.__specialConfig,i,e,n).fillText(t,0,0),this.painter.restore(),this},t.prototype.strokeText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.strokeText(t,i,e,n),this.painter.save(),r(this.painter,this.__specialConfig,i,e,n).strokeText(t,0,0),this.painter.restore(),this},t.prototype.fullText=function(t,i,e,n){return void 0===n&&(n=0),this.__region&&this.__region.fullText(t,i,e,n),this.painter.save(),r(this.painter,this.__specialConfig,i,e,n),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore(),this},t.prototype.fillTexts=function(t,i,e,n,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0),this.__region&&this.__region.fillTexts(t,i,e,n,o),this.painter.save(),r(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,n,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,e,n,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0),this.__region&&this.__region.fillTexts(t,i,e,n,o),this.painter.save(),r(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,n,this.__specialConfig.fontSize*o,(function(t,i){h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,e,n,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0),this.__region&&this.__region.fillTexts(t,i,e,n,o),this.painter.save(),r(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,n,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i),h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},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,i){return this.__region&&this.__region.moveTo(t,i),this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&this.__region.lineTo(t,i),this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,r,n){return this.__region&&this.__region.arc(t,i,e,r,n),this.painter.arc(t,i,e,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,i,e,r){return this.__region&&this.__region.quadraticCurveTo(t,i,e,r),this.painter.quadraticCurveTo(t,i,e,r),this},t.prototype.bezierCurveTo=function(t,i,e,r,n,o){return this.__region&&this.__region.bezierCurveTo(t,i,e,r,n,o),this.painter.bezierCurveTo(t,i,e,r,n,o),this},t.prototype.clearRect=function(t,i,e,r){return this.__region&&this.__region.clearRect(t,i,e,r),this.painter.clearRect(t,i,e,r),this},t.prototype.fillArc=function(t,i,e,r,o,s){return this.__region&&this.__region.fillArc(t,i,e,r,o,s),n(this.painter,this.__specialConfig,t,i,e,r,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,r,o,s){return this.__region&&this.__region.strokeArc(t,i,e,r,o,s),n(this.painter,this.__specialConfig,t,i,e,r,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,r,o,s){return this.__region&&this.__region.fullArc(t,i,e,r,o,s),n(this.painter,this.__specialConfig,t,i,e,r,o,s),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&this.__region.fillCircle(t,i,e),o(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&this.__region.strokeCircle(t,i,e),o(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&this.__region.fullCircle(t,i,e),o(this.painter,t,i,e),this.painter.fill(),this.painter.stroke(),this},t.prototype.fillRect=function(t,i,e,r){return this.__region&&this.__region.fillRect(t,i,e,r),s(this.painter,t,i,e,r).fill(),this},t.prototype.strokeRect=function(t,i,e,r){return this.__region&&this.__region.strokeRect(t,i,e,r),s(this.painter,t,i,e,r).stroke(),this},t.prototype.fullRect=function(t,i,e,r){return this.__region&&this.__region.fullRect(t,i,e,r),s(this.painter,t,i,e,r),this.painter.fill(),this.painter.stroke(),this},t}(),l={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},p=function(t){function e(i,e){var r=t.call(this,i,{},new h(e,{willReadFrequently:!0}))||this;return r.name="Canvas",r.__regionList={},r.__regionAssemble=function(t,i,e,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<i){n[o]=+(n[o]+e).toFixed(7);break}o<r-1&&(n[o]=t)}return n}}(0,255,10,3),r.setRegion(""),r}return i(e,t),e.prototype.config=function(t){for(var i in t){var e=l[i]||i;this.useConfig(e,t[i])}return this},e.prototype.setRegion=function(t){if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,i){var e=this;return new Promise((function(r,n){var o=e.__region.painter.getImageData(t-.5,i-.5,1,1),s=o.data,a=function(){for(var t in e.__regionList)if("rgb("+s[0]+","+s[1]+","+s[2]+")"==e.__regionList[t]){r(t);break}r("")};s?a():o.then((function(t){s=t,a()}))}))},e.prototype.textWidth=function(t){this.painter.save(),r(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region.painter:this.painter},e.prototype.createLinearGradient=function(t,i,e,r){return function(t,i,e,r,n){var o=t.createLinearGradient(i,e,r,n),s={value:function(){return o},setColor:function(t,i){return o.addColorStop(t,i),s}};return s}(this.painter,t,i,e,r)},e.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,r){var n=t.createRadialGradient(i,e,0,i,e,r),o={value:function(){return n},setColor:function(t,i){return n.addColorStop(t,i),o}};return o}(this.painter,t,i,e)},e.prototype.getColor=function(t,i){var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},e}(h);return function(t){function e(i){var e=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");var r,n,o=i.clientWidth,s=i.clientHeight,a=i;a._vislite_canvas_?(r=a._vislite_canvas_[0],n=a._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),n=document.createElement("canvas"),a._vislite_canvas_=[r,n],i.setAttribute("vislite","Canvas"));for(var h=0,l=[r,n];h<l.length;h++){var p=l[h];p.style.width=o+"px",p.setAttribute("width",o+""),p.style.height=s+"px",p.setAttribute("height",s+"")}return(e=t.call(this,r,n)||this).__canvas=r,e}return i(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},e}(p)},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Canvas=i();
11
+ var t,i;t=this,i=function(){"use strict";var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};function i(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}"function"==typeof SuppressedError&&SuppressedError;var e=function(t,i,e,n,r){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(r-i)*s+t).toFixed(7),+((n-t)*s+(r-i)*o+i).toFixed(7)]},n=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},r=function(t,i,n,r,o,s,a,_){if(o>s){var h=o;o=s,s=h}return a%=2*Math.PI,_>=1.999999*Math.PI||_<=1.999999*-Math.PI?_=2*Math.PI:_%=2*Math.PI,function(t,i,n,r,o,s,a){i<0&&(t+=i,i*=-1);var _,h=[];_=e(0,0,t,o,0),h[0]=_[0],h[1]=_[1],_=e(0,0,i,_[0],_[1]),h[2]=_[0],h[3]=_[1],_=e(0,0,t,s,0),h[4]=_[0],h[5]=_[1],_=e(0,0,i,_[0],_[1]),h[6]=_[0],h[7]=_[1],a(t,t+i,h[0]+n,h[1]+r,h[4]+n,h[5]+r,h[2]+n,h[3]+r,h[6]+n,h[7]+r,.5*(s-o))}(a,_,n,r,o,s,(function(e,a,_,h,l,p,u,f,c,g,y){y<0&&(y=-y),t.beginPath(),t.moveTo(_,h),t.arc(n,r,o,e,a,!1),"round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,a-Math.PI,a,!0):"-round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,a-Math.PI,a,!1):t.lineTo(c,g),t.arc(n,r,s,a,e,!0),"round"==i.arcStartCap?t.arc(.5*(_+l),.5*(h+p),y,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(_+l),.5*(h+p),y,e,e-Math.PI,!1):t.lineTo(_,h)})),"butt"==i.arcStartCap&&t.closePath(),t},o=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},s=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function a(t,i,e,n,r){for(var o=0,s="",a=0;a<i.length;a++)t.measureText(s+i[a]).width>e||/\n$/.test(s)?(r(s,((o+=1)-.5)*n),s=i[a]):a==i.length-1?(o+=1,r(s+i[a],(o-.5)*n)):s+=i[a];return o*n}var _=function(){function t(t,i,e,n){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.fillText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.strokeText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&this.__region.fullText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,e,r,o,s){var _=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=a(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){_.painter.fillText(t,0,i),_.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.beginPath=function(){return this.__region&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,i){return this.__region&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<0),this},t.prototype.fill=function(){return this.__region&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__region&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,n,o,s){return this.__region&&this.__region.fillArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,n,o,s){return this.__region&&this.__region.strokeArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,n,o,s){return this.__region&&this.__region.fullArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||(r(this.painter,this.__specialConfig,t,i,e,n,o,s),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(o(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(s(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){},t}(),h={"font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","arc-start-cap":"arcStartCap","arc-end-cap":"arcEndCap"},l=function(t){function e(i,e){var n=t.call(this,i,{},e?new _(e,{willReadFrequently:!0}):null,!0)||this;return n.name="Canvas",n.__regionList={},n.__regionAssemble=function(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}(0,255,10,3),n.setRegion(""),n}return i(e,t),e.prototype.config=function(t){for(var i in t){var e=h[i]||i;this.useConfig(e,t[i])}return this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n,r){var o=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},s=o.data,a=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+s[0]+","+s[1]+","+s[2]+")"==e.__regionList[t]){n(t);break}n("")};s?a():o.then((function(t){s=t,a()}))}))},e.prototype.textWidth=function(t){this.painter.save(),n(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r),s={value:function(){return o},setColor:function(t,i){return o.addColorStop(t,i),s}};return s}(this.painter,t,i,e,n)},e.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n),o={value:function(){return r},setColor:function(t,i){return r.addColorStop(t,i),o}};return o}(this.painter,t,i,e)},e.prototype.getColor=function(t,i){var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},e}(_);return function(t){function e(i,e){void 0===e&&(e={});var n=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");e=function(t,i){for(var e in t)i[e]=t[e];return i}(e,{region:!0});var r,o,s=i.clientWidth,a=i.clientHeight,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],o=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(o=document.createElement("canvas")),_._vislite_canvas_=[r,o],i.setAttribute("vislite","Canvas"));for(var h=0,l=[r,o];h<l.length;h++){var p=l[h];p&&(p.style.width=s+"px",p.setAttribute("width",s+""),p.style.height=a+"px",p.setAttribute("height",a+""))}return(n=t.call(this,r,o)||this).__canvas=r,n}return i(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},e}(l)},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Canvas=i();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 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.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var t,i;t=this,i=function(){"use strict";var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,_,h,s,e){if(!(t<_))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=_;var n=this.__u*s,o=this.__u*e;return i/=_-t,h/=_-t,this.__MR=[2*i-2*h+n+o,3*h-3*i-2*n-o,n,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),_=i*i;return(i*_*this.__MR[0]+_*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}();return function(){function i(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return i.prototype.setP=function(i){this.__HS={x:[],h:[]};var _,h,s=(i[1][1]-i[0][1])/(i[1][0]-i[0][0]);for(this.__HS.x[0]=i[0][0],_=1;_<i.length;_++){if(i[_][0]<=i[_-1][0])throw new Error("The point position should be increamented!");this.__HS.x[_]=i[_][0],h=_<i.length-1?i[_+1][1]>i[_][1]&&i[_-1][1]>i[_][1]||i[_+1][1]<i[_][1]&&i[_-1][1]<i[_][1]||i[_+1][1]==i[_][1]||i[_-1][1]==i[_][1]?0:(i[_+1][1]-i[_-1][1])/(i[_+1][0]-i[_-1][0]):(i[_][1]-i[_-1][1])/(i[_][0]-i[_-1][0]),this.__HS.h[_-1]=new t(.5*(1-this.__t)).setP(i[_-1][0],i[_-1][1],i[_][0],i[_][1],s,h),s=h}return this},i.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},i}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Cardinal=i();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 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.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var t,e;t=this,e=function(){"use strict";var t=function(t,e,n,i){var o=Math.cos(t),a=Math.sin(t);return[e*o-n*a,e*a+n*o,i]};return function(){function e(t,e){void 0===t&&(t=7),void 0===e&&(e=[107,36]),this.name="Eoap",this.__scale=t,this.__center=e}return e.prototype.use=function(e,n){var i,o,a,s,r,h,u=(i=(360-n)/180*Math.PI,o=100*this.__scale,a=0,s=0,r=Math.cos(i),h=Math.sin(i),[s*h+o*r,a,s*r-o*h]);return u=t(e/180*Math.PI,u[0],u[1],u[2]),u=t((90-this.__center[0])/180*Math.PI,u[0],u[1],u[2]),u=function(t,e,n,i){var o=Math.cos(t),a=Math.sin(t);return[e,n*o-i*a,n*a+i*o]}((90-this.__center[1])/180*Math.PI,u[0],u[1],u[2]),[-u[0],u[1],u[2]]},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_Eoap=e();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 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.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var t,i;t=this,i=function(){"use strict";return function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,e,o,s,_){if(!(t<e))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=e;var n=this.__u*s,r=this.__u*_;return i/=e-t,o/=e-t,this.__MR=[2*i-2*o+n+r,3*o-3*i-2*n-r,n,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),e=i*i;return(i*e*this.__MR[0]+e*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Hermite=i();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 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.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var t,r;t=this,r=function(){"use strict";var t=function(t,r){for(var i=[],e=0;e<4;e++)for(var o=0;o<r.length/4;o++)i[4*o+e]=t[e]*r[4*o]+t[e+4]*r[4*o+1]+t[e+8]*r[4*o+2]+t[e+12]*r[4*o+3];return i};return function(){function r(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 r.prototype.move=function(r,i,e,o){return void 0===o&&(o=0),this.__matrix4=t(function(t,r,i,e){void 0===e&&(e=0);var o=Math.sqrt(r*r+i*i+e*e);return[1,0,0,0,0,1,0,0,0,0,1,0,r*t/o,i*t/o,e*t/o,1]}(r,i,e,o),this.__matrix4),this},r.prototype.rotate=function(r,i,e,o,n,u,a){var f=function(t,r,i,e,o,n){if("number"==typeof t&&"number"==typeof r){if("number"!=typeof i?(i=0,e=t,o=r,n=1):"number"==typeof e&&"number"==typeof o&&"number"==typeof n||(e=t,o=r,n=i,t=0,r=0,i=0),t==e&&r==o&&i==n)throw new Error("It's not a legitimate ray!");var u=Math.sqrt((e-t)*(e-t)+(o-r)*(o-r)),a=0!=u?(o-r)/u:1,f=0!=u?(e-t)/u:0,s=(e-t)*f+(o-r)*a,h=n-i,m=Math.sqrt(s*s+h*h),p=0!=m?h/m:1,_=0!=m?s/m:0;return[[a,p*f,f*_,0,-f,a*p,a*_,0,0,-_,p,0,r*f-t*a,i*_-t*f*p-r*a*p,-t*f*_-r*a*_-i*p,1],[a,-f,0,0,p*f,p*a,-_,0,f*_,a*_,p,0,t,r,i,1]]}throw new Error("a1 and b1 is required!")}(i,e,o,n,u,a);return this.__matrix4=t(t(t(f[1],function(t){var r=Math.sin(t),i=Math.cos(t);return[i,r,0,0,-r,i,0,0,0,0,1,0,0,0,0,1]}(r)),f[0]),this.__matrix4),this},r.prototype.scale=function(r,i,e,o,n,u){return void 0===o&&(o=0),void 0===n&&(n=0),void 0===u&&(u=0),this.__matrix4=t(function(t,r,i,e,o,n){return void 0===e&&(e=0),void 0===o&&(o=0),void 0===n&&(n=0),[t,0,0,0,0,r,0,0,0,0,i,0,e-e*t,o-o*r,n-n*i,1]}(r,i,e,o,n,u),this.__matrix4),this},r.prototype.multiply=function(r,i){return void 0===i&&(i=!1),this.__matrix4=i?t(this.__matrix4,r):t(r,this.__matrix4),this},r.prototype.use=function(r,i,e,o){return void 0===e&&(e=0),void 0===o&&(o=1),t(this.__matrix4,[r,i,e,o])},r.prototype.value=function(){return this.__matrix4},r}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Matrix4=r();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 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.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,t;e=this,t=function(){"use strict";return function(e,t){void 0===e&&(e=7),void 0===t&&(t=[107,36]),this.name="Mercator";var o=100*e*Math.PI/180,i=o*t[0],n=-1*o*t[1];this.use=function(e,t){return[.8*(o*e-i),-1*o*t-n]}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_Mercator=t();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.1
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Tue Aug 08 2023 19:08:50 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -138,7 +138,7 @@ var initRect = function (painter, x, y, width, height) {
138
138
  function texts (painter, contents, width, height, doback) {
139
139
  var lineNumber = 0, content = "";
140
140
  for (var i = 0; i < contents.length; i++) {
141
- if (painter.measureText(content + contents[i]).width > width) {
141
+ if (painter.measureText(content + contents[i]).width > width || /\n$/.test(content)) {
142
142
  lineNumber += 1;
143
143
  doback(content, (lineNumber - 0.5) * height);
144
144
  content = contents[i];
@@ -155,9 +155,11 @@ function texts (painter, contents, width, height, doback) {
155
155
  }
156
156
 
157
157
  var Painter = (function () {
158
- function Painter(canvas, opts, region) {
158
+ function Painter(canvas, opts, region, isPainter) {
159
159
  if (opts === void 0) { opts = {}; }
160
+ if (isPainter === void 0) { isPainter = false; }
160
161
  this.__region = null;
162
+ this.__onlyRegion = false;
161
163
  this.__specialConfig = {
162
164
  "fontSize": 16,
163
165
  "fontFamily": "sans-serif",
@@ -178,6 +180,7 @@ var Painter = (function () {
178
180
  };
179
181
  this.painter = canvas.getContext("2d", opts);
180
182
  this.__region = region;
183
+ this.__isPainter = isPainter;
181
184
  this.painter.textBaseline = 'middle';
182
185
  this.painter.textAlign = 'left';
183
186
  }
@@ -187,6 +190,8 @@ var Painter = (function () {
187
190
  this.__region.useConfig(key, value);
188
191
  }
189
192
  }
193
+ if (this.__isPainter && this.__onlyRegion)
194
+ return this;
190
195
  if (key == 'lineDash') {
191
196
  if (this.painter.setLineDash)
192
197
  this.painter.setLineDash(value);
@@ -209,6 +214,8 @@ var Painter = (function () {
209
214
  if (deg === void 0) { deg = 0; }
210
215
  if (this.__region)
211
216
  this.__region.fillText(text, x, y, deg);
217
+ if (this.__isPainter && this.__onlyRegion)
218
+ return this;
212
219
  this.painter.save();
213
220
  initText(this.painter, this.__specialConfig, x, y, deg).fillText(text, 0, 0);
214
221
  this.painter.restore();
@@ -218,6 +225,8 @@ var Painter = (function () {
218
225
  if (deg === void 0) { deg = 0; }
219
226
  if (this.__region)
220
227
  this.__region.strokeText(text, x, y, deg);
228
+ if (this.__isPainter && this.__onlyRegion)
229
+ return this;
221
230
  this.painter.save();
222
231
  initText(this.painter, this.__specialConfig, x, y, deg).strokeText(text, 0, 0);
223
232
  this.painter.restore();
@@ -227,6 +236,8 @@ var Painter = (function () {
227
236
  if (deg === void 0) { deg = 0; }
228
237
  if (this.__region)
229
238
  this.__region.fullText(text, x, y, deg);
239
+ if (this.__isPainter && this.__onlyRegion)
240
+ return this;
230
241
  this.painter.save();
231
242
  initText(this.painter, this.__specialConfig, x, y, deg);
232
243
  this.painter.fillText(text, 0, 0);
@@ -238,8 +249,11 @@ var Painter = (function () {
238
249
  var _this = this;
239
250
  if (lineHeight === void 0) { lineHeight = 1.2; }
240
251
  if (deg === void 0) { deg = 0; }
252
+ var h = 0;
241
253
  if (this.__region)
242
- this.__region.fillTexts(contents, x, y, width, lineHeight);
254
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
255
+ if (this.__isPainter && this.__onlyRegion)
256
+ return h;
243
257
  this.painter.save();
244
258
  initText(this.painter, this.__specialConfig, x, y, deg);
245
259
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -252,8 +266,11 @@ var Painter = (function () {
252
266
  var _this = this;
253
267
  if (lineHeight === void 0) { lineHeight = 1.2; }
254
268
  if (deg === void 0) { deg = 0; }
269
+ var h = 0;
255
270
  if (this.__region)
256
- this.__region.fillTexts(contents, x, y, width, lineHeight);
271
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
272
+ if (this.__isPainter && this.__onlyRegion)
273
+ return h;
257
274
  this.painter.save();
258
275
  initText(this.painter, this.__specialConfig, x, y, deg);
259
276
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -266,8 +283,11 @@ var Painter = (function () {
266
283
  var _this = this;
267
284
  if (lineHeight === void 0) { lineHeight = 1.2; }
268
285
  if (deg === void 0) { deg = 0; }
286
+ var h = 0;
269
287
  if (this.__region)
270
- this.__region.fillTexts(contents, x, y, width, lineHeight);
288
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
289
+ if (this.__isPainter && this.__onlyRegion)
290
+ return h;
271
291
  this.painter.save();
272
292
  initText(this.painter, this.__specialConfig, x, y, deg);
273
293
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -280,48 +300,64 @@ var Painter = (function () {
280
300
  Painter.prototype.beginPath = function () {
281
301
  if (this.__region)
282
302
  this.__region.beginPath();
303
+ if (this.__isPainter && this.__onlyRegion)
304
+ return this;
283
305
  this.painter.beginPath();
284
306
  return this;
285
307
  };
286
308
  Painter.prototype.closePath = function () {
287
309
  if (this.__region)
288
310
  this.__region.closePath();
311
+ if (this.__isPainter && this.__onlyRegion)
312
+ return this;
289
313
  this.painter.closePath();
290
314
  return this;
291
315
  };
292
316
  Painter.prototype.moveTo = function (x, y) {
293
317
  if (this.__region)
294
318
  this.__region.moveTo(x, y);
319
+ if (this.__isPainter && this.__onlyRegion)
320
+ return this;
295
321
  this.painter.moveTo(Math.round(x) + 0.5, Math.round(y) + 0.5);
296
322
  return this;
297
323
  };
298
324
  Painter.prototype.lineTo = function (x, y) {
299
325
  if (this.__region)
300
326
  this.__region.lineTo(x, y);
327
+ if (this.__isPainter && this.__onlyRegion)
328
+ return this;
301
329
  this.painter.lineTo(Math.round(x) + 0.5, Math.round(y) + 0.5);
302
330
  return this;
303
331
  };
304
332
  Painter.prototype.arc = function (x, y, r, beginDeg, deg) {
305
333
  if (this.__region)
306
334
  this.__region.arc(x, y, r, beginDeg, deg);
335
+ if (this.__isPainter && this.__onlyRegion)
336
+ return this;
307
337
  this.painter.arc(x, y, r, beginDeg, beginDeg + deg, deg < 0);
308
338
  return this;
309
339
  };
310
340
  Painter.prototype.fill = function () {
311
341
  if (this.__region)
312
342
  this.__region.fill();
343
+ if (this.__isPainter && this.__onlyRegion)
344
+ return this;
313
345
  this.painter.fill();
314
346
  return this;
315
347
  };
316
348
  Painter.prototype.stroke = function () {
317
349
  if (this.__region)
318
350
  this.__region.stroke();
351
+ if (this.__isPainter && this.__onlyRegion)
352
+ return this;
319
353
  this.painter.stroke();
320
354
  return this;
321
355
  };
322
356
  Painter.prototype.full = function () {
323
357
  if (this.__region)
324
358
  this.__region.full();
359
+ if (this.__isPainter && this.__onlyRegion)
360
+ return this;
325
361
  this.painter.fill();
326
362
  this.painter.stroke();
327
363
  return this;
@@ -329,54 +365,72 @@ var Painter = (function () {
329
365
  Painter.prototype.save = function () {
330
366
  if (this.__region)
331
367
  this.__region.save();
368
+ if (this.__isPainter && this.__onlyRegion)
369
+ return this;
332
370
  this.painter.save();
333
371
  return this;
334
372
  };
335
373
  Painter.prototype.restore = function () {
336
374
  if (this.__region)
337
375
  this.__region.restore();
376
+ if (this.__isPainter && this.__onlyRegion)
377
+ return this;
338
378
  this.painter.restore();
339
379
  return this;
340
380
  };
341
381
  Painter.prototype.clip = function () {
342
382
  if (this.__region)
343
383
  this.__region.clip();
384
+ if (this.__isPainter && this.__onlyRegion)
385
+ return this;
344
386
  this.painter.clip();
345
387
  return this;
346
388
  };
347
389
  Painter.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
348
390
  if (this.__region)
349
391
  this.__region.quadraticCurveTo(cpx, cpy, x, y);
392
+ if (this.__isPainter && this.__onlyRegion)
393
+ return this;
350
394
  this.painter.quadraticCurveTo(cpx, cpy, x, y);
351
395
  return this;
352
396
  };
353
397
  Painter.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
354
398
  if (this.__region)
355
399
  this.__region.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
400
+ if (this.__isPainter && this.__onlyRegion)
401
+ return this;
356
402
  this.painter.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
357
403
  return this;
358
404
  };
359
405
  Painter.prototype.clearRect = function (x, y, w, h) {
360
406
  if (this.__region)
361
407
  this.__region.clearRect(x, y, w, h);
408
+ if (this.__isPainter && this.__onlyRegion)
409
+ return this;
362
410
  this.painter.clearRect(x, y, w, h);
363
411
  return this;
364
412
  };
365
413
  Painter.prototype.fillArc = function (cx, cy, r1, r2, beginDeg, deg) {
366
414
  if (this.__region)
367
415
  this.__region.fillArc(cx, cy, r1, r2, beginDeg, deg);
416
+ if (this.__isPainter && this.__onlyRegion)
417
+ return this;
368
418
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg).fill();
369
419
  return this;
370
420
  };
371
421
  Painter.prototype.strokeArc = function (cx, cy, r1, r2, beginDeg, deg) {
372
422
  if (this.__region)
373
423
  this.__region.strokeArc(cx, cy, r1, r2, beginDeg, deg);
424
+ if (this.__isPainter && this.__onlyRegion)
425
+ return this;
374
426
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg).stroke();
375
427
  return this;
376
428
  };
377
429
  Painter.prototype.fullArc = function (cx, cy, r1, r2, beginDeg, deg) {
378
430
  if (this.__region)
379
431
  this.__region.fullArc(cx, cy, r1, r2, beginDeg, deg);
432
+ if (this.__isPainter && this.__onlyRegion)
433
+ return this;
380
434
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg);
381
435
  this.painter.fill();
382
436
  this.painter.stroke();
@@ -385,18 +439,24 @@ var Painter = (function () {
385
439
  Painter.prototype.fillCircle = function (cx, cy, r) {
386
440
  if (this.__region)
387
441
  this.__region.fillCircle(cx, cy, r);
442
+ if (this.__isPainter && this.__onlyRegion)
443
+ return this;
388
444
  initCircle(this.painter, cx, cy, r).fill();
389
445
  return this;
390
446
  };
391
447
  Painter.prototype.strokeCircle = function (cx, cy, r) {
392
448
  if (this.__region)
393
449
  this.__region.strokeCircle(cx, cy, r);
450
+ if (this.__isPainter && this.__onlyRegion)
451
+ return this;
394
452
  initCircle(this.painter, cx, cy, r).stroke();
395
453
  return this;
396
454
  };
397
455
  Painter.prototype.fullCircle = function (cx, cy, r) {
398
456
  if (this.__region)
399
457
  this.__region.fullCircle(cx, cy, r);
458
+ if (this.__isPainter && this.__onlyRegion)
459
+ return this;
400
460
  initCircle(this.painter, cx, cy, r);
401
461
  this.painter.fill();
402
462
  this.painter.stroke();
@@ -405,23 +465,30 @@ var Painter = (function () {
405
465
  Painter.prototype.fillRect = function (x, y, width, height) {
406
466
  if (this.__region)
407
467
  this.__region.fillRect(x, y, width, height);
468
+ if (this.__isPainter && this.__onlyRegion)
469
+ return this;
408
470
  initRect(this.painter, x, y, width, height).fill();
409
471
  return this;
410
472
  };
411
473
  Painter.prototype.strokeRect = function (x, y, width, height) {
412
474
  if (this.__region)
413
475
  this.__region.strokeRect(x, y, width, height);
476
+ if (this.__isPainter && this.__onlyRegion)
477
+ return this;
414
478
  initRect(this.painter, x, y, width, height).stroke();
415
479
  return this;
416
480
  };
417
481
  Painter.prototype.fullRect = function (x, y, width, height) {
418
482
  if (this.__region)
419
483
  this.__region.fullRect(x, y, width, height);
484
+ if (this.__isPainter && this.__onlyRegion)
485
+ return this;
420
486
  initRect(this.painter, x, y, width, height);
421
487
  this.painter.fill();
422
488
  this.painter.stroke();
423
489
  return this;
424
490
  };
491
+ Painter.prototype.draw = function () { };
425
492
  return Painter;
426
493
  }());
427
494
 
@@ -481,9 +548,9 @@ var oldAttrName = {
481
548
  var Canvas = (function (_super) {
482
549
  __extends(Canvas, _super);
483
550
  function Canvas(ViewCanvas, RegionCanvas) {
484
- var _this = _super.call(this, ViewCanvas, {}, new Painter(RegionCanvas, {
551
+ var _this = _super.call(this, ViewCanvas, {}, RegionCanvas ? new Painter(RegionCanvas, {
485
552
  willReadFrequently: true,
486
- })) || this;
553
+ }) : null, true) || this;
487
554
  _this.name = "Canvas";
488
555
  _this.__regionList = {};
489
556
  _this.__regionAssemble = assemble(0, 255, 10, 3);
@@ -497,39 +564,49 @@ var Canvas = (function (_super) {
497
564
  }
498
565
  return this;
499
566
  };
567
+ Canvas.prototype.onlyRegion = function (flag) {
568
+ this.__onlyRegion = flag;
569
+ return this;
570
+ };
500
571
  Canvas.prototype.setRegion = function (regionName) {
501
- if (regionName) {
502
- if (this.__regionList[regionName] == undefined) {
503
- var tempColor = this.__regionAssemble();
504
- this.__regionList[regionName] =
505
- "rgb(" + tempColor[0] + "," + tempColor[1] + "," + tempColor[2] + ")";
572
+ if (this.__region) {
573
+ if (regionName) {
574
+ if (this.__regionList[regionName] == void 0) {
575
+ var tempColor = this.__regionAssemble();
576
+ this.__regionList[regionName] =
577
+ "rgb(" + tempColor[0] + "," + tempColor[1] + "," + tempColor[2] + ")";
578
+ }
579
+ this.__region.useConfig("fillStyle", this.__regionList[regionName]) &&
580
+ this.__region.useConfig("strokeStyle", this.__regionList[regionName]);
581
+ }
582
+ else {
583
+ this.__region.useConfig("fillStyle", "#000000") &&
584
+ this.__region.useConfig("strokeStyle", "#000000");
506
585
  }
507
- this.__region.useConfig("fillStyle", this.__regionList[regionName]) &&
508
- this.__region.useConfig("strokeStyle", this.__regionList[regionName]);
509
- }
510
- else {
511
- this.__region.useConfig("fillStyle", "#000000") &&
512
- this.__region.useConfig("strokeStyle", "#000000");
513
586
  }
514
587
  return this;
515
588
  };
516
589
  Canvas.prototype.getRegion = function (x, y) {
517
590
  var _this = this;
518
591
  return new Promise(function (resolve, reject) {
519
- var imgData = _this.__region.painter.getImageData(x - 0.5, y - 0.5, 1, 1);
592
+ var imgData = _this.__region ? _this.__region.painter.getImageData(x - 0.5, y - 0.5, 1, 1) : {
593
+ data: [0, 0, 0, 0]
594
+ };
520
595
  var currentRGBA = imgData.data;
521
596
  var doit = function () {
522
- for (var key in _this.__regionList) {
523
- if ("rgb(" +
524
- currentRGBA[0] +
525
- "," +
526
- currentRGBA[1] +
527
- "," +
528
- currentRGBA[2] +
529
- ")" ==
530
- _this.__regionList[key]) {
531
- resolve(key);
532
- break;
597
+ if (_this.__region) {
598
+ for (var key in _this.__regionList) {
599
+ if ("rgb(" +
600
+ currentRGBA[0] +
601
+ "," +
602
+ currentRGBA[1] +
603
+ "," +
604
+ currentRGBA[2] +
605
+ ")" ==
606
+ _this.__regionList[key]) {
607
+ resolve(key);
608
+ break;
609
+ }
533
610
  }
534
611
  }
535
612
  resolve("");
@@ -554,7 +631,7 @@ var Canvas = (function (_super) {
554
631
  };
555
632
  Canvas.prototype.getContext = function (isRegion) {
556
633
  if (isRegion === void 0) { isRegion = false; }
557
- return isRegion ? this.__region.painter : this.painter;
634
+ return isRegion ? (this.__region ? this.__region.painter : null) : this.painter;
558
635
  };
559
636
  Canvas.prototype.createLinearGradient = function (x0, y0, x1, y1) {
560
637
  return linearGradient(this.painter, x0, y0, x1, y1);