vislite 0.4.1-alpha.2 → 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 (113) hide show
  1. package/.editorconfig +19 -0
  2. package/CHANGELOG +17 -8
  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 +89 -10
  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 +79 -8
  19. package/lib/OralCanvas/index.es.min.js +3 -3
  20. package/lib/OralWebGL/index.es.js +35 -10
  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 +45 -12
  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 +555 -23
  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/package/Buffer/index.ts +1 -0
  53. package/package/Canvas/index.ts +1 -0
  54. package/package/OralCanvas/index.ts +1 -0
  55. package/package/OralWebGL/index.ts +1 -0
  56. package/package/Shader/index.ts +39 -1
  57. package/package/Texture/index.ts +1 -0
  58. package/package/TreeLayout/index.ts +3 -0
  59. package/package/WebGL/index.ts +1 -0
  60. package/package/formatColor/index.ts +3 -0
  61. package/package/index.ts +12 -1
  62. package/package/resizeObserver/index.ts +3 -0
  63. package/package/throttle/index.ts +3 -0
  64. package/package.json +1 -1
  65. package/src/Canvas.ts +7 -3
  66. package/src/Eoap.ts +1 -1
  67. package/src/Matrix4/index.ts +1 -1
  68. package/src/Mercator.ts +1 -1
  69. package/src/SVG.ts +2 -1
  70. package/src/TreeLayout/index.ts +186 -0
  71. package/src/WebGL.ts +7 -3
  72. package/src/animation.ts +2 -3
  73. package/src/common/canvas/config.ts +2 -1
  74. package/src/common/canvas/index.ts +10 -3
  75. package/src/common/canvas/painter.ts +74 -5
  76. package/src/common/mergeOption.ts +7 -0
  77. package/src/common/svg/config.ts +2 -1
  78. package/src/common/svg/index.ts +2 -1
  79. package/src/common/svg/tool.ts +2 -1
  80. package/src/common/tree/index.ts +26 -0
  81. package/src/common/tree/toInnerTree.ts +57 -0
  82. package/src/common/tree/toPlainTree.ts +132 -0
  83. package/src/common/webgl/doDraw.ts +2 -0
  84. package/src/common/webgl/getShader.ts +25 -52
  85. package/src/common/webgl/index.ts +4 -3
  86. package/src/common/webgl/texture.ts +2 -5
  87. package/src/formatColor.ts +45 -0
  88. package/src/interpolation/Cardinal.ts +2 -1
  89. package/src/interpolation/Hermite.ts +1 -1
  90. package/src/resizeObserver.ts +37 -0
  91. package/src/ruler.ts +1 -1
  92. package/src/shader/fsColor.c +8 -0
  93. package/src/shader/fsColors.c +8 -0
  94. package/src/shader/fsCube.c +9 -0
  95. package/src/shader/fsImage.c +9 -0
  96. package/src/shader/vsColor.c +18 -0
  97. package/src/shader/vsColors.c +14 -0
  98. package/src/shader/vsCube.c +14 -0
  99. package/src/shader/vsImage.c +14 -0
  100. package/src/throttle.ts +50 -0
  101. package/src/viewHandler.ts +1 -1
  102. package/types/Canvas.d.ts +12 -0
  103. package/types/CanvasOption.d.ts +2 -2
  104. package/types/Shader.d.ts +6 -0
  105. package/types/Tree.d.ts +38 -0
  106. package/types/TreeConfig.d.ts +25 -0
  107. package/types/TreeLayout.d.ts +49 -0
  108. package/types/TreeOption.d.ts +46 -0
  109. package/types/formatColor.d.ts +3 -0
  110. package/types/index.d.ts +24 -1
  111. package/types/resizeObserver.d.ts +3 -0
  112. package/types/throttle.d.ts +5 -0
  113. package/types/throttleOption.d.ts +20 -0
package/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ indent_style = space
8
+ indent_size = 4
9
+ end_of_line = cr
10
+ insert_final_newline = false
11
+ trim_trailing_whitespace = true
12
+
13
+ [*.md]
14
+ insert_final_newline = false
15
+ trim_trailing_whitespace = false
16
+
17
+ [*.json]
18
+ indent_size = 2
19
+ insert_final_newline = true
package/CHANGELOG CHANGED
@@ -3,7 +3,7 @@ v0.1.0:
3
3
  changes:
4
4
  - 初始化版本
5
5
  1、Canvas
6
- (支持平台:H5、uni-app(包括:H5、微信小程序、支付宝小程序)、微信小程序)
6
+ (支持平台:H5、uni-app(包括:H5、微信小程序、支付宝小程序)、微信小程序)
7
7
  2、SVG画笔
8
8
  (支持平台:H5)
9
9
  3、Eoap 等角斜方位投影
@@ -80,7 +80,7 @@ v0.4.0:
80
80
  changes:
81
81
  - 新增功能
82
82
  1、Canvas画笔
83
- * textWidth 计算文字宽
83
+ * textWidth 计算文字宽
84
84
  v0.4.1:
85
85
  date:
86
86
  changes:
@@ -91,14 +91,23 @@ v0.4.1:
91
91
  - 优化改造
92
92
  1、优化WebGL区域计算设计
93
93
  - 新增功能
94
- 1、viewHandler新增对悬浮hover事件的捕获并统一添加event参数
95
- 2、刻度尺算法ruler新增可选上下界约束
94
+ 1、Canvas画笔
95
+ * 添加region配置,可以控制是否支持区域管理
96
+ * onlyRegion 区域模式
97
+ 2、WebGL画笔
98
+ * 添加region配置,可以控制是否支持区域管理
96
99
  3、uni-app平台的ui-canvas
97
100
  * 画笔的draw方法对外暴露更丰富的参数
98
101
  * 添加region属性,可以控制是否支持区域管理
99
102
  4、微信小程序平台的ui-canvas
100
103
  * 添加region属性,可以控制是否支持区域管理
101
- 5、Canvas画笔
102
- * 添加region配置,可以控制是否支持区域管理
103
- 6、WebGL画笔
104
- * 添加region配置,可以控制是否支持区域管理
104
+ 5、viewHandler新增对悬浮hover事件的捕获并统一添加event参数
105
+ 6、刻度尺算法ruler新增可选上下界约束
106
+ 7、颜色格式化 formatColor
107
+ (支持平台:H5)
108
+ 8、节点缩放监听 resizeObserver
109
+ (支持平台:H5)
110
+ 9、节流函数 throttle
111
+ 10、布局
112
+ * 树布局 treeLayout
113
+ 11、着色器compile方法丰富参数(添加color、colors、image、cube四种内置着色器程序)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  - 开源不易,去 <i>[Github给个Star](https://github.com/oi-contrib/VISLite) </i>吧!
2
2
 
3
- <img src='https://oi-contrib.github.io/VISLite/images/logo.png' height='300px'/>
3
+ <img src='./docs/images/logo.png' height='300px'/>
4
4
 
5
5
  <p>
6
6
  <a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=vislite&interval=7">
@@ -27,6 +27,8 @@
27
27
  - 简单与复杂共存:一方面我们提供了可视化需要的基础功能,你可以按照自己的需要组合使用;另一方面,为了加速开发,我们针对常见的可视化业务场景进行了封装,可以帮助你快速完成,你可以根据实际情况进行选择。
28
28
  - 向下兼容:我们向你保证,始终向下兼容```(alpha和beta版本为测试版本,不包括)```,因此,无论何时,最新版本总是最好的选择。
29
29
 
30
+ > 版本说明:alpha为开发阶段、beta为发布前测试、无后缀的为正式版本。
31
+
30
32
  ## 需求墙
31
33
 
32
34
  我们的目标是不断完善丰富可视化功能,非常希望获得你宝贵的建议和批评,无论任何想法,都可以给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们。
@@ -47,6 +49,19 @@
47
49
 
48
50
  给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们你希望快速扩展的功能,我们会优先你的建议考虑哦~
49
51
 
52
+ ## 参与贡献
53
+
54
+ 你可以选择下列一项或多项进行参与:
55
+
56
+ - 代码维护:由于新功能或一些BUG的出现,对代码进行维护和升级。
57
+ - 文档编辑:主要是接口文档和教程需要编辑,这很重要。
58
+ - 用例开发和测试:在项目的test文件夹下有一些测试,而在docs文档中存在一些例子需要补充。
59
+ - 参与讨论:主要是讨论未来如何发展,改造的方向等。
60
+
61
+ 如果有意向加入我们,你可以通过提 [issue](https://github.com/oi-contrib/VISLite/issues) 和我们取到联系,请简单说明一下情况,我们会尽快回复。
62
+
63
+ 你可以查看[VISLite 贡献指南](./.github/CONTRIBUTING.md)文件了解更多细节,查看[AUTHORS.txt](./AUTHORS.txt)了解所有的贡献者。
64
+
50
65
  ## 版权
51
66
 
52
67
  MIT License
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
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: Sat Aug 12 2023 23:34:54 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.2
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: Sat Aug 12 2023 23:34:54 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";return function(){function t(t,e){void 0===e&&(e=!1),this.__painter=t,this.__isElement=e,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,e,i,n){var r=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(r,e,n)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,e,i,n){return void 0===n&&(n=0),function(t,e,i,n,r,_,f){t.vertexAttribPointer(e,i,n,f,r,_),t.enableVertexAttribArray(e)}(this.__painter,t,e,this.__painter.FLOAT,i*this.__fsize,n*this.__fsize,!1),this},t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VISLite_Buffer=e();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
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: Sat Aug 12 2023 23:34:54 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() :
@@ -161,9 +161,11 @@
161
161
  }
162
162
 
163
163
  var Painter = (function () {
164
- function Painter(canvas, opts, region) {
164
+ function Painter(canvas, opts, region, isPainter) {
165
165
  if (opts === void 0) { opts = {}; }
166
+ if (isPainter === void 0) { isPainter = false; }
166
167
  this.__region = null;
168
+ this.__onlyRegion = false;
167
169
  this.__specialConfig = {
168
170
  "fontSize": 16,
169
171
  "fontFamily": "sans-serif",
@@ -184,6 +186,7 @@
184
186
  };
185
187
  this.painter = canvas.getContext("2d", opts);
186
188
  this.__region = region;
189
+ this.__isPainter = isPainter;
187
190
  this.painter.textBaseline = 'middle';
188
191
  this.painter.textAlign = 'left';
189
192
  }
@@ -193,6 +196,8 @@
193
196
  this.__region.useConfig(key, value);
194
197
  }
195
198
  }
199
+ if (this.__isPainter && this.__onlyRegion)
200
+ return this;
196
201
  if (key == 'lineDash') {
197
202
  if (this.painter.setLineDash)
198
203
  this.painter.setLineDash(value);
@@ -215,6 +220,8 @@
215
220
  if (deg === void 0) { deg = 0; }
216
221
  if (this.__region)
217
222
  this.__region.fillText(text, x, y, deg);
223
+ if (this.__isPainter && this.__onlyRegion)
224
+ return this;
218
225
  this.painter.save();
219
226
  initText(this.painter, this.__specialConfig, x, y, deg).fillText(text, 0, 0);
220
227
  this.painter.restore();
@@ -224,6 +231,8 @@
224
231
  if (deg === void 0) { deg = 0; }
225
232
  if (this.__region)
226
233
  this.__region.strokeText(text, x, y, deg);
234
+ if (this.__isPainter && this.__onlyRegion)
235
+ return this;
227
236
  this.painter.save();
228
237
  initText(this.painter, this.__specialConfig, x, y, deg).strokeText(text, 0, 0);
229
238
  this.painter.restore();
@@ -233,6 +242,8 @@
233
242
  if (deg === void 0) { deg = 0; }
234
243
  if (this.__region)
235
244
  this.__region.fullText(text, x, y, deg);
245
+ if (this.__isPainter && this.__onlyRegion)
246
+ return this;
236
247
  this.painter.save();
237
248
  initText(this.painter, this.__specialConfig, x, y, deg);
238
249
  this.painter.fillText(text, 0, 0);
@@ -244,8 +255,11 @@
244
255
  var _this = this;
245
256
  if (lineHeight === void 0) { lineHeight = 1.2; }
246
257
  if (deg === void 0) { deg = 0; }
258
+ var h = 0;
247
259
  if (this.__region)
248
- this.__region.fillTexts(contents, x, y, width, lineHeight);
260
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
261
+ if (this.__isPainter && this.__onlyRegion)
262
+ return h;
249
263
  this.painter.save();
250
264
  initText(this.painter, this.__specialConfig, x, y, deg);
251
265
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -258,8 +272,11 @@
258
272
  var _this = this;
259
273
  if (lineHeight === void 0) { lineHeight = 1.2; }
260
274
  if (deg === void 0) { deg = 0; }
275
+ var h = 0;
261
276
  if (this.__region)
262
- this.__region.fillTexts(contents, x, y, width, lineHeight);
277
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
278
+ if (this.__isPainter && this.__onlyRegion)
279
+ return h;
263
280
  this.painter.save();
264
281
  initText(this.painter, this.__specialConfig, x, y, deg);
265
282
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -272,8 +289,11 @@
272
289
  var _this = this;
273
290
  if (lineHeight === void 0) { lineHeight = 1.2; }
274
291
  if (deg === void 0) { deg = 0; }
292
+ var h = 0;
275
293
  if (this.__region)
276
- this.__region.fillTexts(contents, x, y, width, lineHeight);
294
+ h = this.__region.fillTexts(contents, x, y, width, lineHeight);
295
+ if (this.__isPainter && this.__onlyRegion)
296
+ return h;
277
297
  this.painter.save();
278
298
  initText(this.painter, this.__specialConfig, x, y, deg);
279
299
  var height = texts(this.painter, contents, width, this.__specialConfig.fontSize * lineHeight, function (content, top) {
@@ -286,48 +306,64 @@
286
306
  Painter.prototype.beginPath = function () {
287
307
  if (this.__region)
288
308
  this.__region.beginPath();
309
+ if (this.__isPainter && this.__onlyRegion)
310
+ return this;
289
311
  this.painter.beginPath();
290
312
  return this;
291
313
  };
292
314
  Painter.prototype.closePath = function () {
293
315
  if (this.__region)
294
316
  this.__region.closePath();
317
+ if (this.__isPainter && this.__onlyRegion)
318
+ return this;
295
319
  this.painter.closePath();
296
320
  return this;
297
321
  };
298
322
  Painter.prototype.moveTo = function (x, y) {
299
323
  if (this.__region)
300
324
  this.__region.moveTo(x, y);
325
+ if (this.__isPainter && this.__onlyRegion)
326
+ return this;
301
327
  this.painter.moveTo(Math.round(x) + 0.5, Math.round(y) + 0.5);
302
328
  return this;
303
329
  };
304
330
  Painter.prototype.lineTo = function (x, y) {
305
331
  if (this.__region)
306
332
  this.__region.lineTo(x, y);
333
+ if (this.__isPainter && this.__onlyRegion)
334
+ return this;
307
335
  this.painter.lineTo(Math.round(x) + 0.5, Math.round(y) + 0.5);
308
336
  return this;
309
337
  };
310
338
  Painter.prototype.arc = function (x, y, r, beginDeg, deg) {
311
339
  if (this.__region)
312
340
  this.__region.arc(x, y, r, beginDeg, deg);
341
+ if (this.__isPainter && this.__onlyRegion)
342
+ return this;
313
343
  this.painter.arc(x, y, r, beginDeg, beginDeg + deg, deg < 0);
314
344
  return this;
315
345
  };
316
346
  Painter.prototype.fill = function () {
317
347
  if (this.__region)
318
348
  this.__region.fill();
349
+ if (this.__isPainter && this.__onlyRegion)
350
+ return this;
319
351
  this.painter.fill();
320
352
  return this;
321
353
  };
322
354
  Painter.prototype.stroke = function () {
323
355
  if (this.__region)
324
356
  this.__region.stroke();
357
+ if (this.__isPainter && this.__onlyRegion)
358
+ return this;
325
359
  this.painter.stroke();
326
360
  return this;
327
361
  };
328
362
  Painter.prototype.full = function () {
329
363
  if (this.__region)
330
364
  this.__region.full();
365
+ if (this.__isPainter && this.__onlyRegion)
366
+ return this;
331
367
  this.painter.fill();
332
368
  this.painter.stroke();
333
369
  return this;
@@ -335,54 +371,72 @@
335
371
  Painter.prototype.save = function () {
336
372
  if (this.__region)
337
373
  this.__region.save();
374
+ if (this.__isPainter && this.__onlyRegion)
375
+ return this;
338
376
  this.painter.save();
339
377
  return this;
340
378
  };
341
379
  Painter.prototype.restore = function () {
342
380
  if (this.__region)
343
381
  this.__region.restore();
382
+ if (this.__isPainter && this.__onlyRegion)
383
+ return this;
344
384
  this.painter.restore();
345
385
  return this;
346
386
  };
347
387
  Painter.prototype.clip = function () {
348
388
  if (this.__region)
349
389
  this.__region.clip();
390
+ if (this.__isPainter && this.__onlyRegion)
391
+ return this;
350
392
  this.painter.clip();
351
393
  return this;
352
394
  };
353
395
  Painter.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
354
396
  if (this.__region)
355
397
  this.__region.quadraticCurveTo(cpx, cpy, x, y);
398
+ if (this.__isPainter && this.__onlyRegion)
399
+ return this;
356
400
  this.painter.quadraticCurveTo(cpx, cpy, x, y);
357
401
  return this;
358
402
  };
359
403
  Painter.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
360
404
  if (this.__region)
361
405
  this.__region.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
406
+ if (this.__isPainter && this.__onlyRegion)
407
+ return this;
362
408
  this.painter.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
363
409
  return this;
364
410
  };
365
411
  Painter.prototype.clearRect = function (x, y, w, h) {
366
412
  if (this.__region)
367
413
  this.__region.clearRect(x, y, w, h);
414
+ if (this.__isPainter && this.__onlyRegion)
415
+ return this;
368
416
  this.painter.clearRect(x, y, w, h);
369
417
  return this;
370
418
  };
371
419
  Painter.prototype.fillArc = function (cx, cy, r1, r2, beginDeg, deg) {
372
420
  if (this.__region)
373
421
  this.__region.fillArc(cx, cy, r1, r2, beginDeg, deg);
422
+ if (this.__isPainter && this.__onlyRegion)
423
+ return this;
374
424
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg).fill();
375
425
  return this;
376
426
  };
377
427
  Painter.prototype.strokeArc = function (cx, cy, r1, r2, beginDeg, deg) {
378
428
  if (this.__region)
379
429
  this.__region.strokeArc(cx, cy, r1, r2, beginDeg, deg);
430
+ if (this.__isPainter && this.__onlyRegion)
431
+ return this;
380
432
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg).stroke();
381
433
  return this;
382
434
  };
383
435
  Painter.prototype.fullArc = function (cx, cy, r1, r2, beginDeg, deg) {
384
436
  if (this.__region)
385
437
  this.__region.fullArc(cx, cy, r1, r2, beginDeg, deg);
438
+ if (this.__isPainter && this.__onlyRegion)
439
+ return this;
386
440
  initArc(this.painter, this.__specialConfig, cx, cy, r1, r2, beginDeg, deg);
387
441
  this.painter.fill();
388
442
  this.painter.stroke();
@@ -391,18 +445,24 @@
391
445
  Painter.prototype.fillCircle = function (cx, cy, r) {
392
446
  if (this.__region)
393
447
  this.__region.fillCircle(cx, cy, r);
448
+ if (this.__isPainter && this.__onlyRegion)
449
+ return this;
394
450
  initCircle(this.painter, cx, cy, r).fill();
395
451
  return this;
396
452
  };
397
453
  Painter.prototype.strokeCircle = function (cx, cy, r) {
398
454
  if (this.__region)
399
455
  this.__region.strokeCircle(cx, cy, r);
456
+ if (this.__isPainter && this.__onlyRegion)
457
+ return this;
400
458
  initCircle(this.painter, cx, cy, r).stroke();
401
459
  return this;
402
460
  };
403
461
  Painter.prototype.fullCircle = function (cx, cy, r) {
404
462
  if (this.__region)
405
463
  this.__region.fullCircle(cx, cy, r);
464
+ if (this.__isPainter && this.__onlyRegion)
465
+ return this;
406
466
  initCircle(this.painter, cx, cy, r);
407
467
  this.painter.fill();
408
468
  this.painter.stroke();
@@ -411,23 +471,30 @@
411
471
  Painter.prototype.fillRect = function (x, y, width, height) {
412
472
  if (this.__region)
413
473
  this.__region.fillRect(x, y, width, height);
474
+ if (this.__isPainter && this.__onlyRegion)
475
+ return this;
414
476
  initRect(this.painter, x, y, width, height).fill();
415
477
  return this;
416
478
  };
417
479
  Painter.prototype.strokeRect = function (x, y, width, height) {
418
480
  if (this.__region)
419
481
  this.__region.strokeRect(x, y, width, height);
482
+ if (this.__isPainter && this.__onlyRegion)
483
+ return this;
420
484
  initRect(this.painter, x, y, width, height).stroke();
421
485
  return this;
422
486
  };
423
487
  Painter.prototype.fullRect = function (x, y, width, height) {
424
488
  if (this.__region)
425
489
  this.__region.fullRect(x, y, width, height);
490
+ if (this.__isPainter && this.__onlyRegion)
491
+ return this;
426
492
  initRect(this.painter, x, y, width, height);
427
493
  this.painter.fill();
428
494
  this.painter.stroke();
429
495
  return this;
430
496
  };
497
+ Painter.prototype.draw = function () { };
431
498
  return Painter;
432
499
  }());
433
500
 
@@ -489,7 +556,7 @@
489
556
  function Canvas(ViewCanvas, RegionCanvas) {
490
557
  var _this = _super.call(this, ViewCanvas, {}, RegionCanvas ? new Painter(RegionCanvas, {
491
558
  willReadFrequently: true,
492
- }) : null) || this;
559
+ }) : null, true) || this;
493
560
  _this.name = "Canvas";
494
561
  _this.__regionList = {};
495
562
  _this.__regionAssemble = assemble(0, 255, 10, 3);
@@ -503,10 +570,14 @@
503
570
  }
504
571
  return this;
505
572
  };
573
+ Canvas.prototype.onlyRegion = function (flag) {
574
+ this.__onlyRegion = flag;
575
+ return this;
576
+ };
506
577
  Canvas.prototype.setRegion = function (regionName) {
507
578
  if (this.__region) {
508
579
  if (regionName) {
509
- if (this.__regionList[regionName] == undefined) {
580
+ if (this.__regionList[regionName] == void 0) {
510
581
  var tempColor = this.__regionAssemble();
511
582
  this.__regionList[regionName] =
512
583
  "rgb(" + tempColor[0] + "," + tempColor[1] + "," + tempColor[2] + ")";
@@ -589,6 +660,13 @@
589
660
  return Canvas;
590
661
  }(Painter));
591
662
 
663
+ function mergeOption (option, defaultOption) {
664
+ for (var key in option) {
665
+ defaultOption[key] = option[key];
666
+ }
667
+ return defaultOption;
668
+ }
669
+
592
670
  var Canvas = (function (_super) {
593
671
  __extends(Canvas, _super);
594
672
  function Canvas(el, option) {
@@ -597,8 +675,9 @@
597
675
  if (!el) {
598
676
  throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");
599
677
  }
600
- if (!('region' in option))
601
- option.region = true;
678
+ option = mergeOption(option, {
679
+ region: true
680
+ });
602
681
  var width = el.clientWidth, height = el.clientHeight;
603
682
  var ViewCanvas, RegionCanvas;
604
683
  var _el = el;
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
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: Sat Aug 12 2023 23:34:54 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 _=o;o=s,s=_}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,_=[];h=e(0,0,t,o,0),_[0]=h[0],_[1]=h[1],h=e(0,0,i,h[0],h[1]),_[2]=h[0],_[3]=h[1],h=e(0,0,t,s,0),_[4]=h[0],_[5]=h[1],h=e(0,0,i,h[0],h[1]),_[6]=h[0],_[7]=h[1],a(t,t+i,_[0]+r,_[1]+n,_[4]+r,_[5]+n,_[2]+r,_[3]+n,_[6]+r,_[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,_),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+l),.5*(_+p),v,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(h+l),.5*(_+p),v,e,e-Math.PI,!1):t.lineTo(h,_)})),"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$/.test(s)?(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 _=a(this.painter,t,n,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i)}));return this.painter.restore(),_},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 _=a(this.painter,t,n,this.__specialConfig.fontSize*o,(function(t,i){h.painter.strokeText(t,0,i)}));return this.painter.restore(),_},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 _=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(),_},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}(),_={"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 r=t.call(this,i,{},e?new h(e,{willReadFrequently:!0}):null)||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=_[i]||i;this.useConfig(e,t[i])}return 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(r,n){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]){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?this.__region.painter:null: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,e){void 0===e&&(e={});var r=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");"region"in e||(e.region=!0);var n,o,s=i.clientWidth,a=i.clientHeight,h=i;h._vislite_canvas_?(n=h._vislite_canvas_[0],o=h._vislite_canvas_[1]):(n=document.createElement("canvas"),i.appendChild(n),e.region&&(o=document.createElement("canvas")),h._vislite_canvas_=[n,o],i.setAttribute("vislite","Canvas"));for(var _=0,l=[n,o];_<l.length;_++){var p=l[_];p&&(p.style.width=s+"px",p.setAttribute("width",s+""),p.style.height=a+"px",p.setAttribute("height",a+""))}return(r=t.call(this,n,o)||this).__canvas=n,r}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){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.2
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: Sat Aug 12 2023 23:34:54 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.2
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: Sat Aug 12 2023 23:34:54 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.2
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: Sat Aug 12 2023 23:34:54 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.2
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: Sat Aug 12 2023 23:34:54 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.2
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: Sat Aug 12 2023 23:34:54 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() :