vislite 1.8.0 → 1.9.0-alpha.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 (186) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +10 -1
  3. package/LICENSE +20 -20
  4. package/README.md +242 -242
  5. package/lib/BarLayout/index.es.js +113 -113
  6. package/lib/BarLayout/index.es.min.js +2 -2
  7. package/lib/Buffer/index.es.js +1 -1
  8. package/lib/Buffer/index.es.min.js +1 -1
  9. package/lib/Canvas/index.es.js +2 -1
  10. package/lib/Canvas/index.es.min.js +2 -2
  11. package/lib/Cardinal/index.es.js +1 -1
  12. package/lib/Cardinal/index.es.min.js +1 -1
  13. package/lib/Eoap/index.es.js +1 -1
  14. package/lib/Eoap/index.es.min.js +1 -1
  15. package/lib/Hermite/index.es.js +1 -1
  16. package/lib/Hermite/index.es.min.js +1 -1
  17. package/lib/MapCoordinate/index.es.js +1 -1
  18. package/lib/MapCoordinate/index.es.min.js +1 -1
  19. package/lib/Matrix4/index.es.js +1 -1
  20. package/lib/Matrix4/index.es.min.js +1 -1
  21. package/lib/Mercator/index.es.js +1 -1
  22. package/lib/Mercator/index.es.min.js +1 -1
  23. package/lib/PieLayout/index.es.js +115 -114
  24. package/lib/PieLayout/index.es.min.js +3 -3
  25. package/lib/RawCanvas/index.es.js +2 -1
  26. package/lib/RawCanvas/index.es.min.js +2 -2
  27. package/lib/SVG/index.es.js +1 -1
  28. package/lib/SVG/index.es.min.js +1 -1
  29. package/lib/Shader/index.es.js +1 -1
  30. package/lib/Shader/index.es.min.js +1 -1
  31. package/lib/Texture/index.es.js +1 -1
  32. package/lib/Texture/index.es.min.js +1 -1
  33. package/lib/TreeLayout/index.es.js +113 -113
  34. package/lib/TreeLayout/index.es.min.js +2 -2
  35. package/lib/animation/index.es.js +113 -113
  36. package/lib/animation/index.es.min.js +2 -2
  37. package/lib/assemble/index.es.js +1 -1
  38. package/lib/assemble/index.es.min.js +1 -1
  39. package/lib/getLoopColors/index.es.js +1 -1
  40. package/lib/getLoopColors/index.es.min.js +1 -1
  41. package/lib/getWebGLContext/index.es.js +1 -1
  42. package/lib/getWebGLContext/index.es.min.js +1 -1
  43. package/lib/index.umd.js +166 -164
  44. package/lib/index.umd.min.js +4 -4
  45. package/lib/initOption/index.es.js +1 -1
  46. package/lib/initOption/index.es.min.js +1 -1
  47. package/lib/mergeOption/index.es.js +1 -1
  48. package/lib/mergeOption/index.es.min.js +1 -1
  49. package/lib/move/index.es.js +1 -1
  50. package/lib/move/index.es.min.js +1 -1
  51. package/lib/rotate/index.es.js +1 -1
  52. package/lib/rotate/index.es.min.js +1 -1
  53. package/lib/ruler/index.es.js +1 -1
  54. package/lib/ruler/index.es.min.js +1 -1
  55. package/lib/scale/index.es.js +1 -1
  56. package/lib/scale/index.es.min.js +1 -1
  57. package/lib/throttle/index.es.js +51 -51
  58. package/lib/throttle/index.es.min.js +2 -2
  59. package/minialipay/ui-canvas/drawImage.js +35 -35
  60. package/minialipay/ui-canvas/index.acss +4 -4
  61. package/minialipay/ui-canvas/index.axml +3 -3
  62. package/minialipay/ui-canvas/index.d.ts +1 -1
  63. package/minialipay/ui-canvas/index.js +100 -100
  64. package/minialipay/ui-canvas/index.json +6 -6
  65. package/miniprogram/ui-canvas/drawImage.js +35 -35
  66. package/miniprogram/ui-canvas/index.js +125 -125
  67. package/miniprogram/ui-canvas/index.json +4 -4
  68. package/miniprogram/ui-canvas/index.wxml +4 -4
  69. package/miniprogram/ui-canvas/index.wxss +5 -5
  70. package/package/BarLayout/index.ts +2 -2
  71. package/package/Buffer/index.ts +2 -2
  72. package/package/Canvas/index.ts +2 -2
  73. package/package/Cardinal/index.ts +2 -2
  74. package/package/Eoap/index.ts +2 -2
  75. package/package/Hermite/index.ts +2 -2
  76. package/package/MapCoordinate/index.ts +2 -2
  77. package/package/Matrix4/index.ts +2 -2
  78. package/package/Mercator/index.ts +2 -2
  79. package/package/PieLayout/index.ts +2 -2
  80. package/package/RawCanvas/index.ts +2 -2
  81. package/package/SVG/index.ts +2 -2
  82. package/package/Shader/index.ts +2 -2
  83. package/package/Texture/index.ts +2 -2
  84. package/package/TreeLayout/index.ts +2 -2
  85. package/package/animation/index.ts +5 -5
  86. package/package/assemble/index.ts +2 -2
  87. package/package/getLoopColors/index.ts +2 -2
  88. package/package/getWebGLContext/index.ts +40 -40
  89. package/package/index.ts +84 -84
  90. package/package/initOption/index.ts +2 -2
  91. package/package/mergeOption/index.ts +2 -2
  92. package/package/move/index.ts +2 -2
  93. package/package/rotate/index.ts +2 -2
  94. package/package/ruler/index.ts +2 -2
  95. package/package/scale/index.ts +2 -2
  96. package/package/throttle/index.ts +2 -2
  97. package/package.json +75 -75
  98. package/src/Canvas.ts +89 -89
  99. package/src/Eoap.ts +66 -66
  100. package/src/Matrix4/index.ts +84 -84
  101. package/src/Matrix4/move.ts +12 -12
  102. package/src/Matrix4/rotate.ts +15 -15
  103. package/src/Matrix4/scale.ts +11 -11
  104. package/src/Matrix4/transform.ts +64 -64
  105. package/src/Mercator.ts +27 -27
  106. package/src/SVG.ts +55 -55
  107. package/src/common/assemble.ts +22 -22
  108. package/src/common/canvas/arc.ts +51 -51
  109. package/src/common/canvas/config.ts +176 -176
  110. package/src/common/canvas/default.ts +64 -64
  111. package/src/common/canvas/gradient.ts +31 -31
  112. package/src/common/canvas/index.ts +189 -189
  113. package/src/common/canvas/painter.ts +1 -0
  114. package/src/common/canvas/texts.ts +18 -18
  115. package/src/common/map/getBoundary.ts +15 -15
  116. package/src/common/map/tool.ts +29 -29
  117. package/src/common/option.ts +29 -29
  118. package/src/common/setStyle.ts +5 -5
  119. package/src/common/svg/config.ts +213 -213
  120. package/src/common/svg/default.ts +29 -29
  121. package/src/common/svg/gradient.ts +53 -53
  122. package/src/common/svg/index.ts +420 -420
  123. package/src/common/svg/tool.ts +51 -51
  124. package/src/common/tree/index.ts +25 -25
  125. package/src/common/tree/toInnerTree.ts +61 -61
  126. package/src/common/tree/toPlainTree.ts +135 -135
  127. package/src/common/type.ts +26 -26
  128. package/src/common/webgl/buffer.ts +79 -79
  129. package/src/common/webgl/getWebGLContext.ts +45 -45
  130. package/src/common/webgl/shader.ts +75 -75
  131. package/src/common/webgl/texture.ts +98 -98
  132. package/src/coordinate/MapCoordinate.ts +80 -80
  133. package/src/getLoopColors.ts +42 -42
  134. package/src/interpolation/Cardinal.ts +110 -110
  135. package/src/interpolation/Hermite.ts +65 -65
  136. package/src/layout/BarLayout.ts +249 -249
  137. package/src/layout/PieLayout.ts +3 -1
  138. package/src/layout/TreeLayout.ts +200 -200
  139. package/src/move.ts +7 -7
  140. package/src/rotate.ts +7 -7
  141. package/src/ruler.ts +209 -209
  142. package/src/scale.ts +6 -6
  143. package/types/Bar.d.ts +91 -91
  144. package/types/BarConfig.d.ts +4 -4
  145. package/types/BarLayout.d.ts +48 -48
  146. package/types/BarOption.d.ts +31 -31
  147. package/types/Buffer.d.ts +23 -23
  148. package/types/Canvas.d.ts +375 -375
  149. package/types/CanvasConfig.d.ts +88 -88
  150. package/types/CanvasOption.d.ts +13 -13
  151. package/types/CanvasOpts.d.ts +9 -9
  152. package/types/Cardinal.d.ts +13 -13
  153. package/types/Gradient.d.ts +14 -14
  154. package/types/Hermite.d.ts +18 -18
  155. package/types/Map.d.ts +9 -9
  156. package/types/MapConfig.d.ts +27 -27
  157. package/types/MapCoordinate.d.ts +22 -22
  158. package/types/Matrix4.d.ts +47 -47
  159. package/types/Pie.d.ts +73 -73
  160. package/types/PieConfig.d.ts +26 -26
  161. package/types/PieLayout.d.ts +40 -40
  162. package/types/PieOption.d.ts +21 -21
  163. package/types/SVG.d.ts +278 -278
  164. package/types/SVGConfig.d.ts +71 -71
  165. package/types/Shader.d.ts +16 -16
  166. package/types/Texture.d.ts +16 -16
  167. package/types/Tree.d.ts +74 -74
  168. package/types/TreeConfig.d.ts +36 -36
  169. package/types/TreeLayout.d.ts +59 -59
  170. package/types/TreeOption.d.ts +48 -48
  171. package/types/animation.d.ts +11 -11
  172. package/types/assemble.d.ts +5 -5
  173. package/types/getLoopColors.d.ts +5 -5
  174. package/types/getWebGLContext.d.ts +7 -7
  175. package/types/index.d.ts +196 -196
  176. package/types/move.d.ts +5 -5
  177. package/types/option.d.ts +12 -12
  178. package/types/painterConfig.d.ts +4 -4
  179. package/types/rotate.d.ts +5 -5
  180. package/types/ruler.d.ts +10 -10
  181. package/types/scale.d.ts +5 -5
  182. package/types/throttle.d.ts +5 -5
  183. package/types/ui-canvas.d.ts +4 -4
  184. package/types/uni-canvas.d.ts +3 -3
  185. package/uni-app/drawImage.js +19 -19
  186. package/uni-app/ui-canvas.vue +295 -295
package/lib/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VISLite JavaScript Library v1.8.0
2
+ * VISLite JavaScript Library v1.9.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  (function (global, factory) {
@@ -294,121 +294,121 @@
294
294
  }
295
295
 
296
296
  /*!
297
- * animation of OIPage v1.7.0-alpha.3
297
+ * animation of OIPage v1.7.0
298
298
  * git+https://github.com/oi-contrib/OIPage.git
299
299
  */
300
300
 
301
- //当前正在运动的动画的tick函数堆栈
302
- var $timers = [];
303
- //唯一定时器的定时间隔
304
- var $interval = 13;
305
- //定时器ID
306
- var $timerId;
307
-
308
- /**
309
- * 动画轮播
310
- * @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
311
- * @param {number} duration 动画时长,可选
312
- * @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
313
- *
314
- * @returns {object} 返回一个对象,包含一个stop方法,用于在动画结束前结束动画
315
- */
316
- function animation$1(doback, duration, callback) {
317
- if (arguments.length < 2) duration = 400;
318
- if (arguments.length < 3) callback = function () { };
319
-
320
- var clock = {
321
- //把tick函数推入堆栈
322
- "timer": function (tick, duration, callback) {
323
- if (!tick) {
324
- throw new Error('Tick is required!');
325
- }
326
- var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
327
- $timers.push({
328
- "id": id,
329
- "createTime": new Date(),
330
- "tick": tick,
331
- "duration": duration,
332
- "callback": callback
333
- });
334
- clock.start();
335
- return id;
336
- },
337
-
338
- //开启唯一的定时器timerId
339
- "start": function () {
340
- if (!$timerId) {
341
- if (!globalThis.requestAnimationFrame) {
342
- $timerId = setInterval(clock.tick, $interval);
343
- } else {
344
- $timerId = globalThis.requestAnimationFrame(function step() {
345
- clock.tick();
346
- if ($timerId) $timerId = globalThis.requestAnimationFrame(step);
347
- });
348
- }
349
- }
350
- },
351
-
352
- //被定时器调用,遍历timers堆栈
353
- "tick": function () {
354
- var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
355
-
356
- $timers = [];
357
- $timers.length = 0;
358
-
359
- for (flag = 0; flag < timers.length; flag++) {
360
- //初始化数据
361
- timer = timers[flag];
362
- createTime = timer.createTime;
363
- tick = timer.tick;
364
- duration = timer.duration;
365
- callback = timer.callback;
366
-
367
- //执行
368
- passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
369
- passTime = passTime > 1 ? 1 : passTime;
370
- tick(passTime);
371
- if (passTime < 1 && timer.id) {
372
- //动画没有结束再添加
373
- $timers.push(timer);
374
- } else {
375
- callback(passTime);
376
- }
377
- }
378
- if ($timers.length <= 0) {
379
- clock.stop();
380
- }
381
- },
382
-
383
- //停止定时器,重置timerId=null
384
- "stop": function () {
385
- if ($timerId) {
386
- if (!globalThis.requestAnimationFrame) clearInterval($timerId);
387
- else globalThis.cancelAnimationFrame($timerId);
388
- $timerId = null;
389
- }
390
- }
391
- };
392
-
393
- var id = clock.timer(function (deep) {
394
- //其中deep为0-1,表示改变的程度
395
- doback(deep);
396
- }, duration, callback);
397
-
398
- return {
399
- // 一个函数
400
- // 用于在动画结束前结束动画
401
- stop: function () {
402
- var i;
403
- for (i in $timers) {
404
- if ($timers[i].id == id) {
405
- $timers[i].id = void 0;
406
- return;
407
- }
408
- }
409
- }
410
- };
411
-
301
+ //当前正在运动的动画的tick函数堆栈
302
+ var $timers = [];
303
+ //唯一定时器的定时间隔
304
+ var $interval = 13;
305
+ //定时器ID
306
+ var $timerId;
307
+
308
+ /**
309
+ * 动画轮播
310
+ * @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
311
+ * @param {number} duration 动画时长,可选
312
+ * @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
313
+ *
314
+ * @returns {object} 返回一个对象,包含一个stop方法,用于在动画结束前结束动画
315
+ */
316
+ function animation$1(doback, duration, callback) {
317
+ if (arguments.length < 2) duration = 400;
318
+ if (arguments.length < 3) callback = function () { };
319
+
320
+ var clock = {
321
+ //把tick函数推入堆栈
322
+ "timer": function (tick, duration, callback) {
323
+ if (!tick) {
324
+ throw new Error('Tick is required!');
325
+ }
326
+ var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
327
+ $timers.push({
328
+ "id": id,
329
+ "createTime": new Date(),
330
+ "tick": tick,
331
+ "duration": duration,
332
+ "callback": callback
333
+ });
334
+ clock.start();
335
+ return id;
336
+ },
337
+
338
+ //开启唯一的定时器timerId
339
+ "start": function () {
340
+ if (!$timerId) {
341
+ if (!globalThis.requestAnimationFrame) {
342
+ $timerId = setInterval(clock.tick, $interval);
343
+ } else {
344
+ $timerId = globalThis.requestAnimationFrame(function step() {
345
+ clock.tick();
346
+ if ($timerId) $timerId = globalThis.requestAnimationFrame(step);
347
+ });
348
+ }
349
+ }
350
+ },
351
+
352
+ //被定时器调用,遍历timers堆栈
353
+ "tick": function () {
354
+ var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
355
+
356
+ $timers = [];
357
+ $timers.length = 0;
358
+
359
+ for (flag = 0; flag < timers.length; flag++) {
360
+ //初始化数据
361
+ timer = timers[flag];
362
+ createTime = timer.createTime;
363
+ tick = timer.tick;
364
+ duration = timer.duration;
365
+ callback = timer.callback;
366
+
367
+ //执行
368
+ passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
369
+ passTime = passTime > 1 ? 1 : passTime;
370
+ tick(passTime);
371
+ if (passTime < 1 && timer.id) {
372
+ //动画没有结束再添加
373
+ $timers.push(timer);
374
+ } else {
375
+ callback(passTime);
376
+ }
377
+ }
378
+ if ($timers.length <= 0) {
379
+ clock.stop();
380
+ }
381
+ },
382
+
383
+ //停止定时器,重置timerId=null
384
+ "stop": function () {
385
+ if ($timerId) {
386
+ if (!globalThis.requestAnimationFrame) clearInterval($timerId);
387
+ else globalThis.cancelAnimationFrame($timerId);
388
+ $timerId = null;
389
+ }
390
+ }
391
+ };
392
+
393
+ var id = clock.timer(function (deep) {
394
+ //其中deep为0-1,表示改变的程度
395
+ doback(deep);
396
+ }, duration, callback);
397
+
398
+ return {
399
+ // 一个函数
400
+ // 用于在动画结束前结束动画
401
+ stop: function () {
402
+ var i;
403
+ for (i in $timers) {
404
+ if ($timers[i].id == id) {
405
+ $timers[i].id = void 0;
406
+ return;
407
+ }
408
+ }
409
+ }
410
+ };
411
+
412
412
  }
413
413
 
414
414
  function animation (doback, duration, callback) {
@@ -1399,6 +1399,7 @@
1399
1399
  this.__isPainter = isPainter;
1400
1400
  this.painter.textBaseline = 'middle';
1401
1401
  this.painter.textAlign = 'left';
1402
+ this.painter.shadowColor = 'black';
1402
1403
  }
1403
1404
  Painter.prototype.useConfig = function (key, value) {
1404
1405
  if (this.__region && !this.__onlyView) {
@@ -2273,59 +2274,59 @@
2273
2274
  }());
2274
2275
 
2275
2276
  /*!
2276
- * throttle of OIPage v1.7.0-alpha.3
2277
+ * throttle of OIPage v1.7.0
2277
2278
  * git+https://github.com/oi-contrib/OIPage.git
2278
2279
  */
2279
2280
 
2280
- function throttle(callback, _option) {
2281
-
2282
- // 缺省值
2283
- var option = {
2284
- time: 200,
2285
- keep: false,
2286
- opportunity: "end"
2287
- };
2288
-
2289
- // 校对
2290
- if (_option) {
2291
- for (var key in _option) {
2292
- option[key] = _option[key];
2293
- }
2294
- }
2295
-
2296
- var hadInterval = false, hadClick = false, oneClick = false, arg;
2297
- return function () {
2298
- const _this = this;
2299
- arg = arguments;
2300
-
2301
- // 如果前置任务都完成了
2302
- if (!hadInterval) {
2303
- if (option.opportunity != 'end') {
2304
- callback.apply(_this, arg);
2305
- }
2306
- hadInterval = true;
2307
-
2308
- var interval = setInterval(() => {
2309
- if (hadClick) {
2310
- if (!option.keep) {
2311
- callback.apply(_this, arg);
2312
- }
2313
- } else {
2314
- if (option.opportunity != 'begin') {
2315
- if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
2316
- }
2317
- hadInterval = false;
2318
- oneClick = false;
2319
- clearInterval(interval);
2320
- }
2321
- hadClick = false;
2322
- }, option.time);
2323
- } else {
2324
- hadClick = true;
2325
- oneClick = true;
2326
- }
2327
-
2328
- };
2281
+ function throttle(callback, _option) {
2282
+
2283
+ // 缺省值
2284
+ var option = {
2285
+ time: 200,
2286
+ keep: false,
2287
+ opportunity: "end"
2288
+ };
2289
+
2290
+ // 校对
2291
+ if (_option) {
2292
+ for (var key in _option) {
2293
+ option[key] = _option[key];
2294
+ }
2295
+ }
2296
+
2297
+ var hadInterval = false, hadClick = false, oneClick = false, arg;
2298
+ return function () {
2299
+ const _this = this;
2300
+ arg = arguments;
2301
+
2302
+ // 如果前置任务都完成了
2303
+ if (!hadInterval) {
2304
+ if (option.opportunity != 'end') {
2305
+ callback.apply(_this, arg);
2306
+ }
2307
+ hadInterval = true;
2308
+
2309
+ var interval = setInterval(() => {
2310
+ if (hadClick) {
2311
+ if (!option.keep) {
2312
+ callback.apply(_this, arg);
2313
+ }
2314
+ } else {
2315
+ if (option.opportunity != 'begin') {
2316
+ if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
2317
+ }
2318
+ hadInterval = false;
2319
+ oneClick = false;
2320
+ clearInterval(interval);
2321
+ }
2322
+ hadClick = false;
2323
+ }, option.time);
2324
+ } else {
2325
+ hadClick = true;
2326
+ oneClick = true;
2327
+ }
2328
+
2329
+ };
2329
2330
  }
2330
2331
 
2331
2332
  function mllData(geoJson) {
@@ -2781,7 +2782,7 @@
2781
2782
  var beginDeg = Math.PI * -0.5, currenDeg;
2782
2783
  for (var i = 0; i < initPie.length; i++) {
2783
2784
  currenDeg = values[i] / totalValue * Math.PI * 2;
2784
- var radius = [this.__option.radius[0], this.__option.radius[1] * (1 + (hoverIndex === i ? 0.05 : 0))];
2785
+ var radius = [this.__option.radius[0] * (1 + (this.__option.radius[0] > 0 && hoverIndex === i ? -0.1 : 0)), this.__option.radius[1] * (1 + (hoverIndex === i ? 0.05 : 0))];
2785
2786
  var pdeg = beginDeg + currenDeg * 0.5, pradius = Math.max(this.__option.radius[0], this.__option.radius[1]);
2786
2787
  var p0 = rotate$1(pie.cx, pie.cy, pdeg, pie.cx + pradius, pie.cy);
2787
2788
  var p1 = rotate$1(pie.cx, pie.cy, pdeg, pie.cx + pradius + 15, pie.cy);
@@ -2833,6 +2834,7 @@
2833
2834
  animation$1(function (deep) {
2834
2835
  if (_this.__prePie) {
2835
2836
  for (var i = 0; i < cachePie.count; i++) {
2837
+ cachePie.node[i].radius[0] = _this.__prePie.node[i].radius[0] + (newPie.node[i].radius[0] - _this.__prePie.node[i].radius[0]) * deep;
2836
2838
  cachePie.node[i].radius[1] = _this.__prePie.node[i].radius[1] + (newPie.node[i].radius[1] - _this.__prePie.node[i].radius[1]) * deep;
2837
2839
  }
2838
2840
  }