vislite 0.8.1-alpha.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +220 -214
  3. package/LICENSE +20 -20
  4. package/README.md +136 -136
  5. package/lib/Buffer/index.umd.js +36 -36
  6. package/lib/Buffer/index.umd.min.js +2 -2
  7. package/lib/Canvas/index.umd.js +694 -691
  8. package/lib/Canvas/index.umd.min.js +3 -3
  9. package/lib/Cardinal/index.umd.js +91 -91
  10. package/lib/Cardinal/index.umd.min.js +2 -2
  11. package/lib/Eoap/index.umd.js +34 -34
  12. package/lib/Eoap/index.umd.min.js +2 -2
  13. package/lib/Geometry/index.umd.js +286 -286
  14. package/lib/Geometry/index.umd.min.js +2 -2
  15. package/lib/Hermite/index.umd.js +36 -36
  16. package/lib/Hermite/index.umd.min.js +2 -2
  17. package/lib/Matrix4/index.umd.js +125 -125
  18. package/lib/Matrix4/index.umd.min.js +2 -2
  19. package/lib/Mercator/index.umd.js +20 -20
  20. package/lib/Mercator/index.umd.min.js +2 -2
  21. package/lib/OralCanvas/index.es.js +637 -634
  22. package/lib/OralCanvas/index.es.min.js +3 -3
  23. package/lib/OralWebGL/index.es.js +560 -560
  24. package/lib/OralWebGL/index.es.min.js +3 -3
  25. package/lib/SVG/index.umd.js +471 -471
  26. package/lib/SVG/index.umd.min.js +2 -2
  27. package/lib/Shader/index.umd.js +69 -69
  28. package/lib/Shader/index.umd.min.js +3 -3
  29. package/lib/Texture/index.umd.js +54 -54
  30. package/lib/Texture/index.umd.min.js +2 -2
  31. package/lib/TreeLayout/index.umd.js +368 -368
  32. package/lib/TreeLayout/index.umd.min.js +2 -2
  33. package/lib/WebGL/index.umd.js +607 -607
  34. package/lib/WebGL/index.umd.min.js +3 -3
  35. package/lib/animation/index.umd.js +73 -73
  36. package/lib/animation/index.umd.min.js +2 -2
  37. package/lib/formatColor/index.umd.js +40 -40
  38. package/lib/formatColor/index.umd.min.js +2 -2
  39. package/lib/getLoopColors/index.umd.js +36 -36
  40. package/lib/getLoopColors/index.umd.min.js +2 -2
  41. package/lib/getWebGLContext/index.umd.js +63 -63
  42. package/lib/getWebGLContext/index.umd.min.js +2 -2
  43. package/lib/index.umd.js +2974 -2971
  44. package/lib/index.umd.min.js +3 -3
  45. package/lib/move/index.umd.js +8 -8
  46. package/lib/move/index.umd.min.js +2 -2
  47. package/lib/resizeObserver/index.umd.js +30 -30
  48. package/lib/resizeObserver/index.umd.min.js +2 -2
  49. package/lib/rotate/index.umd.js +8 -8
  50. package/lib/rotate/index.umd.min.js +2 -2
  51. package/lib/ruler/index.umd.js +138 -138
  52. package/lib/ruler/index.umd.min.js +2 -2
  53. package/lib/scale/index.umd.js +7 -7
  54. package/lib/scale/index.umd.min.js +2 -2
  55. package/lib/throttle/index.umd.js +49 -49
  56. package/lib/throttle/index.umd.min.js +2 -2
  57. package/lib/viewHandler/index.umd.js +120 -120
  58. package/lib/viewHandler/index.umd.min.js +2 -2
  59. package/miniprogram/ui-canvas/drawImage.js +6 -4
  60. package/miniprogram/ui-canvas/index.js +122 -122
  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 +40 -40
  83. package/package/index.ts +76 -76
  84. package/package/move/index.ts +2 -2
  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 +2 -2
  89. package/package/throttle/index.ts +2 -2
  90. package/package/viewHandler/index.ts +2 -2
  91. package/package.json +70 -70
  92. package/src/Canvas.ts +72 -72
  93. package/src/Eoap.ts +66 -66
  94. package/src/Geometry.ts +210 -210
  95. package/src/Matrix4/index.ts +84 -84
  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/WebGL.ts +66 -66
  103. package/src/animation.ts +98 -98
  104. package/src/common/assemble.ts +22 -22
  105. package/src/common/canvas/arc.ts +51 -51
  106. package/src/common/canvas/config.ts +158 -158
  107. package/src/common/canvas/gradient.ts +29 -29
  108. package/src/common/canvas/index.ts +183 -183
  109. package/src/common/canvas/painter.ts +453 -446
  110. package/src/common/canvas/texts.ts +18 -18
  111. package/src/common/geometry/prism-horizontal.ts +50 -50
  112. package/src/common/geometry/prism-vertical.ts +55 -55
  113. package/src/common/geometry/sphere-fragment.ts +40 -40
  114. package/src/common/geometry/tool/circle.ts +17 -17
  115. package/src/common/geometry/tool/rotateLine.ts +48 -48
  116. package/src/common/geometry/tool/triangles.ts +23 -23
  117. package/src/common/mergeOption.ts +6 -6
  118. package/src/common/setStyle.ts +5 -5
  119. package/src/common/svg/config.ts +190 -190
  120. package/src/common/svg/gradient.ts +63 -63
  121. package/src/common/svg/index.ts +356 -356
  122. package/src/common/svg/tool.ts +44 -44
  123. package/src/common/tree/index.ts +25 -25
  124. package/src/common/tree/toInnerTree.ts +59 -59
  125. package/src/common/tree/toPlainTree.ts +132 -132
  126. package/src/common/webgl/buffer.ts +79 -79
  127. package/src/common/webgl/doDraw.ts +108 -108
  128. package/src/common/webgl/getColorFactory.ts +26 -26
  129. package/src/common/webgl/getShader.ts +48 -48
  130. package/src/common/webgl/getTexture.ts +11 -11
  131. package/src/common/webgl/getWebGLContext.ts +45 -45
  132. package/src/common/webgl/index.ts +227 -227
  133. package/src/common/webgl/shader.ts +75 -75
  134. package/src/common/webgl/texture.ts +97 -97
  135. package/src/formatColor.ts +44 -44
  136. package/src/getLoopColors.ts +42 -42
  137. package/src/interpolation/Cardinal.ts +110 -110
  138. package/src/interpolation/Hermite.ts +65 -65
  139. package/src/layout/TreeLayout.ts +188 -188
  140. package/src/move.ts +7 -7
  141. package/src/resizeObserver.ts +37 -37
  142. package/src/rotate.ts +7 -7
  143. package/src/ruler.ts +209 -209
  144. package/src/scale.ts +6 -6
  145. package/src/shader/fsColor.c +7 -7
  146. package/src/shader/fsColors.c +7 -7
  147. package/src/shader/fsCube.c +8 -8
  148. package/src/shader/fsImage.c +8 -8
  149. package/src/shader/vsColor.c +17 -17
  150. package/src/shader/vsColors.c +13 -13
  151. package/src/shader/vsCube.c +13 -13
  152. package/src/shader/vsImage.c +13 -13
  153. package/src/throttle.ts +52 -52
  154. package/src/viewHandler.ts +160 -160
  155. package/types/Buffer.d.ts +23 -23
  156. package/types/Canvas.d.ts +318 -318
  157. package/types/CanvasConfig.d.ts +106 -106
  158. package/types/CanvasOption.d.ts +8 -8
  159. package/types/CanvasOpts.d.ts +9 -9
  160. package/types/Cardinal.d.ts +13 -13
  161. package/types/Geometry.d.ts +132 -132
  162. package/types/GeometryOption.d.ts +11 -11
  163. package/types/GeometryResult.d.ts +18 -18
  164. package/types/Gradient.d.ts +14 -14
  165. package/types/Hermite.d.ts +18 -18
  166. package/types/Map.d.ts +9 -9
  167. package/types/Matrix4.d.ts +47 -47
  168. package/types/Object3D.d.ts +114 -114
  169. package/types/SVG.d.ts +238 -238
  170. package/types/SVGConfig.d.ts +79 -79
  171. package/types/Scene3D.d.ts +6 -6
  172. package/types/Shader.d.ts +23 -23
  173. package/types/Texture.d.ts +16 -16
  174. package/types/Tree.d.ts +69 -69
  175. package/types/TreeConfig.d.ts +36 -36
  176. package/types/TreeLayout.d.ts +54 -54
  177. package/types/TreeOption.d.ts +48 -48
  178. package/types/WebGL.d.ts +38 -38
  179. package/types/WebGLOption.d.ts +14 -14
  180. package/types/animation.d.ts +6 -6
  181. package/types/formatColor.d.ts +2 -2
  182. package/types/getLoopColors.d.ts +2 -2
  183. package/types/getWebGLContext.d.ts +4 -4
  184. package/types/index.d.ts +175 -175
  185. package/types/move.d.ts +2 -2
  186. package/types/painterConfig.d.ts +2 -2
  187. package/types/resizeObserver.d.ts +2 -2
  188. package/types/rotate.d.ts +2 -2
  189. package/types/ruler.d.ts +7 -7
  190. package/types/scale.d.ts +2 -2
  191. package/types/throttle.d.ts +4 -4
  192. package/types/throttleOption.d.ts +21 -21
  193. package/types/ui-canvas.d.ts +4 -4
  194. package/types/viewHandler.d.ts +13 -13
  195. package/uni-app/drawImage.js +19 -17
  196. package/uni-app/ui-canvas.vue +290 -290
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.1-alpha.1
2
+ * VISLite JavaScript Library v0.8.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Wed Apr 03 2024 10:29:52 GMT+0800 (China Standard Time)
9
+ * Publish Date: Wed Apr 10 2024 20:35:52 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 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,r){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,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.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(a){if(s.__region&&(s.__region.fillRect(i,e,n,r),a({})),s.__isPainter&&s.__onlyRegion)return s;if("string"!=typeof t||o)s.painter.drawImage(t,i,e,n,r),a({});else{var _=new Image;_.onload=function(){s.painter.drawImage(_,i,e,n,r),a({})},_.src=t}}))},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,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new _(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__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),o.__scaleSize=r,o.setRegion(""),o}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){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},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.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},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){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},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,willReadFrequently:!1});var r,o=i.clientWidth,s=i.clientHeight,a=null,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],a=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(a=document.createElement("canvas")),_._vislite_canvas_=[r,a],i.setAttribute("vislite","Canvas"));for(var h=[a,r],l=0;l<h.length;l++){var p=h[l];p&&(p.style.width=o+"px",p.setAttribute("width",l*o+o+""),p.style.height=s+"px",p.setAttribute("height",l*s+s+""))}return(n=t.call(this,r,a,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=r,n.painter.scale(2,2),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();
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,r){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,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(){return Promise.resolve()},t.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(a){if(s.__region&&s.__region.fillRect(i,e,n,r),s.__isPainter&&s.__onlyRegion)a({});else if("string"!=typeof t||o)s.painter.drawImage(t,0,0,n,r,i,e,n,r),a({});else{var _=new Image;_.onload=function(){s.painter.drawImage(_,0,0,_.width,_.height,i,e,n,r),a({})},_.src=t}}))},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,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new _(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__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),o.__scaleSize=r,o.setRegion(""),o}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){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},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.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},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){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},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,willReadFrequently:!1});var r,o=i.clientWidth,s=i.clientHeight,a=null,_=i;_._vislite_canvas_?(r=_._vislite_canvas_[0],a=_._vislite_canvas_[1]):(r=document.createElement("canvas"),i.appendChild(r),e.region&&(a=document.createElement("canvas")),_._vislite_canvas_=[r,a],i.setAttribute("vislite","Canvas"));for(var h=[a,r],l=0;l<h.length;l++){var p=h[l];p&&(p.style.width=o+"px",p.setAttribute("width",l*o+o+""),p.style.height=s+"px",p.setAttribute("height",l*s+s+""))}return(n=t.call(this,r,a,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=r,n.painter.scale(2,2),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.8.1-alpha.1
2
+ * VISLite JavaScript Library v0.8.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Wed Apr 03 2024 10:29:52 GMT+0800 (China Standard Time)
9
+ * Publish Date: Wed Apr 10 2024 20:35:52 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -14,97 +14,97 @@
14
14
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Cardinal = factory());
15
15
  })(this, (function () { 'use strict';
16
16
 
17
- var Hermite = (function () {
18
- function Hermite(u) {
19
- if (u === void 0) { u = 0.5; }
20
- this.name = 'Hermite';
21
- this.__u = u;
22
- }
23
- Hermite.prototype.setP = function (x1, y1, x2, y2, s1, s2) {
24
- if (x1 < x2) {
25
- this.__a = x1;
26
- this.__b = x2;
27
- var p3 = this.__u * s1, p4 = this.__u * s2;
28
- y1 /= (x2 - x1);
29
- y2 /= (x2 - x1);
30
- this.__MR = [
31
- 2 * y1 - 2 * y2 + p3 + p4,
32
- 3 * y2 - 3 * y1 - 2 * p3 - p4,
33
- p3,
34
- y1
35
- ];
36
- }
37
- else
38
- throw new Error('The point x-position should be increamented!');
39
- return this;
40
- };
41
- Hermite.prototype.use = function (x) {
42
- if (this.__MR) {
43
- var sx = (x - this.__a) / (this.__b - this.__a), sx2 = sx * sx, sx3 = sx * sx2;
44
- var sResult = sx3 * this.__MR[0] + sx2 * this.__MR[1] + sx * this.__MR[2] + this.__MR[3];
45
- return sResult * (this.__b - this.__a);
46
- }
47
- else
48
- throw new Error('You shoud first set the position!');
49
- };
50
- return Hermite;
17
+ var Hermite = (function () {
18
+ function Hermite(u) {
19
+ if (u === void 0) { u = 0.5; }
20
+ this.name = 'Hermite';
21
+ this.__u = u;
22
+ }
23
+ Hermite.prototype.setP = function (x1, y1, x2, y2, s1, s2) {
24
+ if (x1 < x2) {
25
+ this.__a = x1;
26
+ this.__b = x2;
27
+ var p3 = this.__u * s1, p4 = this.__u * s2;
28
+ y1 /= (x2 - x1);
29
+ y2 /= (x2 - x1);
30
+ this.__MR = [
31
+ 2 * y1 - 2 * y2 + p3 + p4,
32
+ 3 * y2 - 3 * y1 - 2 * p3 - p4,
33
+ p3,
34
+ y1
35
+ ];
36
+ }
37
+ else
38
+ throw new Error('The point x-position should be increamented!');
39
+ return this;
40
+ };
41
+ Hermite.prototype.use = function (x) {
42
+ if (this.__MR) {
43
+ var sx = (x - this.__a) / (this.__b - this.__a), sx2 = sx * sx, sx3 = sx * sx2;
44
+ var sResult = sx3 * this.__MR[0] + sx2 * this.__MR[1] + sx * this.__MR[2] + this.__MR[3];
45
+ return sResult * (this.__b - this.__a);
46
+ }
47
+ else
48
+ throw new Error('You shoud first set the position!');
49
+ };
50
+ return Hermite;
51
51
  }());
52
52
 
53
- var Cardinal = (function () {
54
- function Cardinal(t) {
55
- if (t === void 0) { t = 0; }
56
- this.name = 'Cardinal';
57
- this.__t = t;
58
- }
59
- Cardinal.prototype.setP = function (points) {
60
- this.__HS = {
61
- "x": [],
62
- "h": []
63
- };
64
- var flag, slope = (points[1][1] - points[0][1]) / (points[1][0] - points[0][0]), temp;
65
- this.__HS.x[0] = points[0][0];
66
- for (flag = 1; flag < points.length; flag++) {
67
- if (points[flag][0] <= points[flag - 1][0])
68
- throw new Error('The point position should be increamented!');
69
- this.__HS.x[flag] = points[flag][0];
70
- if (flag < points.length - 1) {
71
- if ((points[flag + 1][1] > points[flag][1] && points[flag - 1][1] > points[flag][1]) ||
72
- (points[flag + 1][1] < points[flag][1] && points[flag - 1][1] < points[flag][1]) ||
73
- points[flag + 1][1] == points[flag][1] ||
74
- points[flag - 1][1] == points[flag][1]) {
75
- temp = 0;
76
- }
77
- else {
78
- temp = (points[flag + 1][1] - points[flag - 1][1]) / (points[flag + 1][0] - points[flag - 1][0]);
79
- }
80
- }
81
- else {
82
- temp = (points[flag][1] - points[flag - 1][1]) / (points[flag][0] - points[flag - 1][0]);
83
- }
84
- this.__HS.h[flag - 1] = new Hermite((1 - this.__t) * 0.5).setP(points[flag - 1][0], points[flag - 1][1], points[flag][0], points[flag][1], slope, temp);
85
- slope = temp;
86
- }
87
- return this;
88
- };
89
- Cardinal.prototype.use = function (x) {
90
- if (this.__HS) {
91
- this.__i = -1;
92
- while (this.__i + 1 < this.__HS.x.length && (x > this.__HS.x[this.__i + 1] || (this.__i == -1 && x >= this.__HS.x[this.__i + 1]))) {
93
- this.__i += 1;
94
- }
95
- if (this.__i < 0) {
96
- return this.__HS.h[0].use(this.__HS.x[0]);
97
- }
98
- else if (this.__i >= this.__HS.h.length) {
99
- return this.__HS.h[this.__HS.h.length - 1].use(this.__HS.x[this.__HS.x.length - 1]);
100
- }
101
- return this.__HS.h[this.__i].use(x);
102
- }
103
- else {
104
- throw new Error('You shoud first set the position!');
105
- }
106
- };
107
- return Cardinal;
53
+ var Cardinal = (function () {
54
+ function Cardinal(t) {
55
+ if (t === void 0) { t = 0; }
56
+ this.name = 'Cardinal';
57
+ this.__t = t;
58
+ }
59
+ Cardinal.prototype.setP = function (points) {
60
+ this.__HS = {
61
+ "x": [],
62
+ "h": []
63
+ };
64
+ var flag, slope = (points[1][1] - points[0][1]) / (points[1][0] - points[0][0]), temp;
65
+ this.__HS.x[0] = points[0][0];
66
+ for (flag = 1; flag < points.length; flag++) {
67
+ if (points[flag][0] <= points[flag - 1][0])
68
+ throw new Error('The point position should be increamented!');
69
+ this.__HS.x[flag] = points[flag][0];
70
+ if (flag < points.length - 1) {
71
+ if ((points[flag + 1][1] > points[flag][1] && points[flag - 1][1] > points[flag][1]) ||
72
+ (points[flag + 1][1] < points[flag][1] && points[flag - 1][1] < points[flag][1]) ||
73
+ points[flag + 1][1] == points[flag][1] ||
74
+ points[flag - 1][1] == points[flag][1]) {
75
+ temp = 0;
76
+ }
77
+ else {
78
+ temp = (points[flag + 1][1] - points[flag - 1][1]) / (points[flag + 1][0] - points[flag - 1][0]);
79
+ }
80
+ }
81
+ else {
82
+ temp = (points[flag][1] - points[flag - 1][1]) / (points[flag][0] - points[flag - 1][0]);
83
+ }
84
+ this.__HS.h[flag - 1] = new Hermite((1 - this.__t) * 0.5).setP(points[flag - 1][0], points[flag - 1][1], points[flag][0], points[flag][1], slope, temp);
85
+ slope = temp;
86
+ }
87
+ return this;
88
+ };
89
+ Cardinal.prototype.use = function (x) {
90
+ if (this.__HS) {
91
+ this.__i = -1;
92
+ while (this.__i + 1 < this.__HS.x.length && (x > this.__HS.x[this.__i + 1] || (this.__i == -1 && x >= this.__HS.x[this.__i + 1]))) {
93
+ this.__i += 1;
94
+ }
95
+ if (this.__i < 0) {
96
+ return this.__HS.h[0].use(this.__HS.x[0]);
97
+ }
98
+ else if (this.__i >= this.__HS.h.length) {
99
+ return this.__HS.h[this.__HS.h.length - 1].use(this.__HS.x[this.__HS.x.length - 1]);
100
+ }
101
+ return this.__HS.h[this.__i].use(x);
102
+ }
103
+ else {
104
+ throw new Error('You shoud first set the position!');
105
+ }
106
+ };
107
+ return Cardinal;
108
108
  }());
109
109
 
110
110
  return Cardinal;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.1-alpha.1
2
+ * VISLite JavaScript Library v0.8.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Wed Apr 03 2024 10:29:52 GMT+0800 (China Standard Time)
9
+ * Publish Date: Wed Apr 10 2024 20:35:52 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.8.1-alpha.1
2
+ * VISLite JavaScript Library v0.8.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Wed Apr 03 2024 10:29:52 GMT+0800 (China Standard Time)
9
+ * Publish Date: Wed Apr 10 2024 20:35:52 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -14,38 +14,38 @@
14
14
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_Eoap = factory());
15
15
  })(this, (function () { 'use strict';
16
16
 
17
- var rotateX = function (deg, x, y, z) {
18
- var cos = Math.cos(deg), sin = Math.sin(deg);
19
- return [x, y * cos - z * sin, y * sin + z * cos];
20
- };
21
- var rotateY = function (deg, x, y, z) {
22
- var cos = Math.cos(deg), sin = Math.sin(deg);
23
- return [z * sin + x * cos, y, z * cos - x * sin];
24
- };
25
- var rotateZ = function (deg, x, y, z) {
26
- var cos = Math.cos(deg), sin = Math.sin(deg);
27
- return [x * cos - y * sin, x * sin + y * cos, z];
28
- };
29
- var Eoap = (function () {
30
- function Eoap(scale, center) {
31
- if (scale === void 0) { scale = 7; }
32
- if (center === void 0) { center = [107, 36]; }
33
- this.name = 'Eoap';
34
- this.__scale = scale;
35
- this.__center = center;
36
- }
37
- Eoap.prototype.use = function (λ, φ) {
38
- var p = rotateY((360 - φ) / 180 * Math.PI, 100 * this.__scale, 0, 0);
39
- p = rotateZ(λ / 180 * Math.PI, p[0], p[1], p[2]);
40
- p = rotateZ((90 - this.__center[0]) / 180 * Math.PI, p[0], p[1], p[2]);
41
- p = rotateX((90 - this.__center[1]) / 180 * Math.PI, p[0], p[1], p[2]);
42
- return [
43
- -p[0],
44
- p[1],
45
- p[2]
46
- ];
47
- };
48
- return Eoap;
17
+ var rotateX = function (deg, x, y, z) {
18
+ var cos = Math.cos(deg), sin = Math.sin(deg);
19
+ return [x, y * cos - z * sin, y * sin + z * cos];
20
+ };
21
+ var rotateY = function (deg, x, y, z) {
22
+ var cos = Math.cos(deg), sin = Math.sin(deg);
23
+ return [z * sin + x * cos, y, z * cos - x * sin];
24
+ };
25
+ var rotateZ = function (deg, x, y, z) {
26
+ var cos = Math.cos(deg), sin = Math.sin(deg);
27
+ return [x * cos - y * sin, x * sin + y * cos, z];
28
+ };
29
+ var Eoap = (function () {
30
+ function Eoap(scale, center) {
31
+ if (scale === void 0) { scale = 7; }
32
+ if (center === void 0) { center = [107, 36]; }
33
+ this.name = 'Eoap';
34
+ this.__scale = scale;
35
+ this.__center = center;
36
+ }
37
+ Eoap.prototype.use = function (λ, φ) {
38
+ var p = rotateY((360 - φ) / 180 * Math.PI, 100 * this.__scale, 0, 0);
39
+ p = rotateZ(λ / 180 * Math.PI, p[0], p[1], p[2]);
40
+ p = rotateZ((90 - this.__center[0]) / 180 * Math.PI, p[0], p[1], p[2]);
41
+ p = rotateX((90 - this.__center[1]) / 180 * Math.PI, p[0], p[1], p[2]);
42
+ return [
43
+ -p[0],
44
+ p[1],
45
+ p[2]
46
+ ];
47
+ };
48
+ return Eoap;
49
49
  }());
50
50
 
51
51
  return Eoap;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.8.1-alpha.1
2
+ * VISLite JavaScript Library v0.8.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Wed Apr 03 2024 10:29:52 GMT+0800 (China Standard Time)
9
+ * Publish Date: Wed Apr 10 2024 20:35:52 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();