vislite 1.9.0-alpha.2 → 1.9.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 (184) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +12 -2
  3. package/LICENSE +20 -20
  4. package/README.md +1 -1
  5. package/lib/BarLayout/index.es.js +119 -128
  6. package/lib/BarLayout/index.es.min.js +1 -10
  7. package/lib/Buffer/index.es.js +0 -4
  8. package/lib/Buffer/index.es.min.js +0 -4
  9. package/lib/Canvas/index.es.js +0 -4
  10. package/lib/Canvas/index.es.min.js +0 -4
  11. package/lib/Cardinal/index.es.js +0 -4
  12. package/lib/Cardinal/index.es.min.js +0 -4
  13. package/lib/Eoap/index.es.js +0 -4
  14. package/lib/Eoap/index.es.min.js +0 -4
  15. package/lib/Hermite/index.es.js +0 -4
  16. package/lib/Hermite/index.es.min.js +0 -4
  17. package/lib/MapCoordinate/index.es.js +0 -4
  18. package/lib/MapCoordinate/index.es.min.js +0 -4
  19. package/lib/Matrix4/index.es.js +0 -4
  20. package/lib/Matrix4/index.es.min.js +0 -4
  21. package/lib/Mercator/index.es.js +0 -4
  22. package/lib/Mercator/index.es.min.js +0 -4
  23. package/lib/PieLayout/index.es.js +119 -128
  24. package/lib/PieLayout/index.es.min.js +1 -9
  25. package/lib/RawCanvas/index.es.js +0 -4
  26. package/lib/RawCanvas/index.es.min.js +0 -4
  27. package/lib/SVG/index.es.js +14 -9
  28. package/lib/SVG/index.es.min.js +1 -5
  29. package/lib/Shader/index.es.js +0 -4
  30. package/lib/Shader/index.es.min.js +0 -4
  31. package/lib/Texture/index.es.js +0 -4
  32. package/lib/Texture/index.es.min.js +0 -4
  33. package/lib/TreeLayout/index.es.js +119 -128
  34. package/lib/TreeLayout/index.es.min.js +1 -9
  35. package/lib/animation/index.es.js +119 -128
  36. package/lib/animation/index.es.min.js +0 -8
  37. package/lib/assemble/index.es.js +0 -4
  38. package/lib/assemble/index.es.min.js +0 -4
  39. package/lib/getLoopColors/index.es.js +0 -4
  40. package/lib/getLoopColors/index.es.min.js +0 -4
  41. package/lib/getWebGLContext/index.es.js +0 -4
  42. package/lib/getWebGLContext/index.es.min.js +0 -4
  43. package/lib/index.umd.js +183 -184
  44. package/lib/index.umd.min.js +2 -12
  45. package/lib/initOption/index.es.js +0 -4
  46. package/lib/initOption/index.es.min.js +0 -4
  47. package/lib/mergeOption/index.es.js +0 -4
  48. package/lib/mergeOption/index.es.min.js +0 -4
  49. package/lib/move/index.es.js +0 -4
  50. package/lib/move/index.es.min.js +0 -4
  51. package/lib/rotate/index.es.js +0 -4
  52. package/lib/rotate/index.es.min.js +0 -4
  53. package/lib/ruler/index.es.js +0 -4
  54. package/lib/ruler/index.es.min.js +0 -4
  55. package/lib/scale/index.es.js +0 -4
  56. package/lib/scale/index.es.min.js +0 -4
  57. package/lib/throttle/index.es.js +49 -58
  58. package/lib/throttle/index.es.min.js +0 -8
  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 +69 -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/texts.ts +18 -18
  114. package/src/common/map/getBoundary.ts +15 -15
  115. package/src/common/map/tool.ts +29 -29
  116. package/src/common/option.ts +29 -29
  117. package/src/common/setStyle.ts +5 -5
  118. package/src/common/svg/config.ts +213 -213
  119. package/src/common/svg/default.ts +29 -29
  120. package/src/common/svg/gradient.ts +53 -53
  121. package/src/common/svg/index.ts +420 -420
  122. package/src/common/svg/tool.ts +51 -51
  123. package/src/common/tree/index.ts +25 -25
  124. package/src/common/tree/toInnerTree.ts +61 -61
  125. package/src/common/tree/toPlainTree.ts +135 -135
  126. package/src/common/type.ts +26 -26
  127. package/src/common/webgl/buffer.ts +79 -79
  128. package/src/common/webgl/getWebGLContext.ts +45 -45
  129. package/src/common/webgl/shader.ts +75 -75
  130. package/src/common/webgl/texture.ts +98 -98
  131. package/src/coordinate/MapCoordinate.ts +80 -80
  132. package/src/getLoopColors.ts +42 -42
  133. package/src/interpolation/Cardinal.ts +110 -110
  134. package/src/interpolation/Hermite.ts +65 -65
  135. package/src/layout/BarLayout.ts +249 -249
  136. package/src/layout/TreeLayout.ts +200 -200
  137. package/src/move.ts +7 -7
  138. package/src/rotate.ts +7 -7
  139. package/src/ruler.ts +209 -209
  140. package/src/scale.ts +6 -6
  141. package/types/Bar.d.ts +91 -91
  142. package/types/BarConfig.d.ts +4 -4
  143. package/types/BarLayout.d.ts +48 -48
  144. package/types/BarOption.d.ts +31 -31
  145. package/types/Buffer.d.ts +23 -23
  146. package/types/Canvas.d.ts +375 -375
  147. package/types/CanvasConfig.d.ts +88 -88
  148. package/types/CanvasOption.d.ts +13 -13
  149. package/types/CanvasOpts.d.ts +9 -9
  150. package/types/Cardinal.d.ts +13 -13
  151. package/types/Gradient.d.ts +14 -14
  152. package/types/Hermite.d.ts +18 -18
  153. package/types/Map.d.ts +9 -9
  154. package/types/MapConfig.d.ts +27 -27
  155. package/types/MapCoordinate.d.ts +22 -22
  156. package/types/Matrix4.d.ts +47 -47
  157. package/types/Pie.d.ts +73 -73
  158. package/types/PieConfig.d.ts +26 -26
  159. package/types/PieLayout.d.ts +40 -40
  160. package/types/PieOption.d.ts +21 -21
  161. package/types/SVG.d.ts +278 -278
  162. package/types/SVGConfig.d.ts +71 -71
  163. package/types/Shader.d.ts +16 -16
  164. package/types/Texture.d.ts +16 -16
  165. package/types/Tree.d.ts +74 -74
  166. package/types/TreeConfig.d.ts +36 -36
  167. package/types/TreeLayout.d.ts +59 -59
  168. package/types/TreeOption.d.ts +48 -48
  169. package/types/animation.d.ts +11 -11
  170. package/types/assemble.d.ts +5 -5
  171. package/types/getLoopColors.d.ts +5 -5
  172. package/types/getWebGLContext.d.ts +7 -7
  173. package/types/index.d.ts +196 -196
  174. package/types/move.d.ts +5 -5
  175. package/types/option.d.ts +12 -12
  176. package/types/painterConfig.d.ts +4 -4
  177. package/types/rotate.d.ts +5 -5
  178. package/types/ruler.d.ts +10 -10
  179. package/types/scale.d.ts +5 -5
  180. package/types/throttle.d.ts +5 -5
  181. package/types/ui-canvas.d.ts +4 -4
  182. package/types/uni-canvas.d.ts +3 -3
  183. package/uni-app/drawImage.js +19 -19
  184. 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.9.0-alpha.2
2
+ * VISLite JavaScript Library v1.9.1
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  (function (global, factory) {
@@ -293,130 +293,125 @@
293
293
  return colors;
294
294
  }
295
295
 
296
- /*!
297
- * animation of OIPage v1.8.0-alpha.1
298
- * git+https://github.com/oi-contrib/OIPage.git
299
- */
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
- try {
342
- if (globalThis && globalThis.requestAnimationFrame) {
343
- $timerId = globalThis.requestAnimationFrame(function step() {
344
- clock.tick();
345
- if ($timerId) $timerId = globalThis.requestAnimationFrame(step);
346
- });
347
- } else {
348
- $timerId = setInterval(clock.tick, $interval);
349
- }
350
- } catch (e) {
351
- $timerId = setInterval(clock.tick, $interval);
352
- }
353
- }
354
- },
355
-
356
- //被定时器调用,遍历timers堆栈
357
- "tick": function () {
358
- var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
359
-
360
- $timers = [];
361
- $timers.length = 0;
362
-
363
- for (flag = 0; flag < timers.length; flag++) {
364
- //初始化数据
365
- timer = timers[flag];
366
- createTime = timer.createTime;
367
- tick = timer.tick;
368
- duration = timer.duration;
369
- callback = timer.callback;
370
-
371
- //执行
372
- passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
373
- passTime = passTime > 1 ? 1 : passTime;
374
- tick(passTime);
375
- if (passTime < 1 && timer.id) {
376
- //动画没有结束再添加
377
- $timers.push(timer);
378
- } else {
379
- callback(passTime);
380
- }
381
- }
382
- if ($timers.length <= 0) {
383
- clock.stop();
384
- }
385
- },
386
-
387
- //停止定时器,重置timerId=null
388
- "stop": function () {
389
- if ($timerId) {
390
- try {
391
- if (globalThis && globalThis.requestAnimationFrame) globalThis.cancelAnimationFrame($timerId);
392
- else clearInterval($timerId);
393
- } catch (e) {
394
- clearInterval($timerId);
395
- }
396
- $timerId = null;
397
- }
398
- }
399
- };
400
-
401
- var id = clock.timer(function (deep) {
402
- //其中deep为0-1,表示改变的程度
403
- doback(deep);
404
- }, duration, callback);
405
-
406
- return {
407
- // 一个函数
408
- // 用于在动画结束前结束动画
409
- stop: function () {
410
- var i;
411
- for (i in $timers) {
412
- if ($timers[i].id == id) {
413
- $timers[i].id = void 0;
414
- return;
415
- }
416
- }
417
- }
418
- };
419
-
296
+ //当前正在运动的动画的tick函数堆栈
297
+ var $timers = [];
298
+ //唯一定时器的定时间隔
299
+ var $interval = 13;
300
+ //定时器ID
301
+ var $timerId;
302
+
303
+ /**
304
+ * 动画轮播
305
+ * @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
306
+ * @param {number} duration 动画时长,可选
307
+ * @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
308
+ *
309
+ * @returns {object} 返回一个对象,包含一个stop方法,用于在动画结束前结束动画
310
+ */
311
+ function animation$1(doback, duration, callback) {
312
+ if (arguments.length < 2) duration = 400;
313
+ if (arguments.length < 3) callback = function () { };
314
+
315
+ var clock = {
316
+ //把tick函数推入堆栈
317
+ "timer": function (tick, duration, callback) {
318
+ if (!tick) {
319
+ throw new Error('Tick is required!');
320
+ }
321
+ var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
322
+ $timers.push({
323
+ "id": id,
324
+ "createTime": new Date(),
325
+ "tick": tick,
326
+ "duration": duration,
327
+ "callback": callback
328
+ });
329
+ clock.start();
330
+ return id;
331
+ },
332
+
333
+ //开启唯一的定时器timerId
334
+ "start": function () {
335
+ if (!$timerId) {
336
+ try {
337
+ if (globalThis && globalThis.requestAnimationFrame) {
338
+ $timerId = globalThis.requestAnimationFrame(function step() {
339
+ clock.tick();
340
+ if ($timerId) $timerId = globalThis.requestAnimationFrame(step);
341
+ });
342
+ } else {
343
+ $timerId = setInterval(clock.tick, $interval);
344
+ }
345
+ } catch (e) {
346
+ $timerId = setInterval(clock.tick, $interval);
347
+ }
348
+ }
349
+ },
350
+
351
+ //被定时器调用,遍历timers堆栈
352
+ "tick": function () {
353
+ var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
354
+
355
+ $timers = [];
356
+ $timers.length = 0;
357
+
358
+ for (flag = 0; flag < timers.length; flag++) {
359
+ //初始化数据
360
+ timer = timers[flag];
361
+ createTime = timer.createTime;
362
+ tick = timer.tick;
363
+ duration = timer.duration;
364
+ callback = timer.callback;
365
+
366
+ //执行
367
+ passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
368
+ passTime = passTime > 1 ? 1 : passTime;
369
+ tick(passTime);
370
+ if (passTime < 1 && timer.id) {
371
+ //动画没有结束再添加
372
+ $timers.push(timer);
373
+ } else {
374
+ callback(passTime);
375
+ }
376
+ }
377
+ if ($timers.length <= 0) {
378
+ clock.stop();
379
+ }
380
+ },
381
+
382
+ //停止定时器,重置timerId=null
383
+ "stop": function () {
384
+ if ($timerId) {
385
+ try {
386
+ if (globalThis && globalThis.requestAnimationFrame) globalThis.cancelAnimationFrame($timerId);
387
+ else clearInterval($timerId);
388
+ } catch (e) {
389
+ clearInterval($timerId);
390
+ }
391
+ $timerId = null;
392
+ }
393
+ }
394
+ };
395
+
396
+ var id = clock.timer(function (deep) {
397
+ //其中deep为0-1,表示改变的程度
398
+ doback(deep);
399
+ }, duration, callback);
400
+
401
+ return {
402
+ // 一个函数
403
+ // 用于在动画结束前结束动画
404
+ stop: function () {
405
+ var i;
406
+ for (i in $timers) {
407
+ if ($timers[i].id == id) {
408
+ $timers[i].id = void 0;
409
+ return;
410
+ }
411
+ }
412
+ }
413
+ };
414
+
420
415
  }
421
416
 
422
417
  function animation (doback, duration, callback) {
@@ -1234,11 +1229,20 @@
1234
1229
  throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
1235
1230
  }
1236
1231
  var width = el.clientWidth, height = el.clientHeight;
1237
- var ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
1238
- el.appendChild(ViewSVG);
1239
- ViewSVG.setAttribute("width", width + "");
1240
- ViewSVG.setAttribute("height", height + "");
1241
- ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
1232
+ var ViewSVG;
1233
+ var _el = el;
1234
+ if (_el._vislite_svg_) {
1235
+ ViewSVG = _el._vislite_svg_[0];
1236
+ }
1237
+ else {
1238
+ ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
1239
+ el.appendChild(ViewSVG);
1240
+ ViewSVG.setAttribute("width", width + "");
1241
+ ViewSVG.setAttribute("height", height + "");
1242
+ ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
1243
+ _el._vislite_svg_ = [ViewSVG];
1244
+ el.setAttribute('vislite', 'SVG');
1245
+ }
1242
1246
  _this = _super.call(this, ViewSVG) || this;
1243
1247
  _this.__el = el;
1244
1248
  return _this;
@@ -2281,60 +2285,55 @@
2281
2285
  return Mercator;
2282
2286
  }());
2283
2287
 
2284
- /*!
2285
- * throttle of OIPage v1.8.0-alpha.1
2286
- * git+https://github.com/oi-contrib/OIPage.git
2287
- */
2288
-
2289
- function throttle(callback, _option) {
2290
-
2291
- // 缺省值
2292
- var option = {
2293
- time: 200,
2294
- keep: false,
2295
- opportunity: "end"
2296
- };
2297
-
2298
- // 校对
2299
- if (_option) {
2300
- for (var key in _option) {
2301
- option[key] = _option[key];
2302
- }
2303
- }
2304
-
2305
- var hadInterval = false, hadClick = false, oneClick = false, arg;
2306
- return function () {
2307
- const _this = this;
2308
- arg = arguments;
2309
-
2310
- // 如果前置任务都完成了
2311
- if (!hadInterval) {
2312
- if (option.opportunity != 'end') {
2313
- callback.apply(_this, arg);
2314
- }
2315
- hadInterval = true;
2316
-
2317
- var interval = setInterval(() => {
2318
- if (hadClick) {
2319
- if (!option.keep) {
2320
- callback.apply(_this, arg);
2321
- }
2322
- } else {
2323
- if (option.opportunity != 'begin') {
2324
- if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
2325
- }
2326
- hadInterval = false;
2327
- oneClick = false;
2328
- clearInterval(interval);
2329
- }
2330
- hadClick = false;
2331
- }, option.time);
2332
- } else {
2333
- hadClick = true;
2334
- oneClick = true;
2335
- }
2336
-
2337
- };
2288
+ function throttle(callback, _option) {
2289
+
2290
+ // 缺省值
2291
+ var option = {
2292
+ time: 200,
2293
+ keep: false,
2294
+ opportunity: "end"
2295
+ };
2296
+
2297
+ // 校对
2298
+ if (_option) {
2299
+ for (var key in _option) {
2300
+ option[key] = _option[key];
2301
+ }
2302
+ }
2303
+
2304
+ var hadInterval = false, hadClick = false, oneClick = false, arg;
2305
+ return function () {
2306
+ const _this = this;
2307
+ arg = arguments;
2308
+
2309
+ // 如果前置任务都完成了
2310
+ if (!hadInterval) {
2311
+ if (option.opportunity != 'end') {
2312
+ callback.apply(_this, arg);
2313
+ }
2314
+ hadInterval = true;
2315
+
2316
+ var interval = setInterval(() => {
2317
+ if (hadClick) {
2318
+ if (!option.keep) {
2319
+ callback.apply(_this, arg);
2320
+ }
2321
+ } else {
2322
+ if (option.opportunity != 'begin') {
2323
+ if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
2324
+ }
2325
+ hadInterval = false;
2326
+ oneClick = false;
2327
+ clearInterval(interval);
2328
+ }
2329
+ hadClick = false;
2330
+ }, option.time);
2331
+ } else {
2332
+ hadClick = true;
2333
+ oneClick = true;
2334
+ }
2335
+
2336
+ };
2338
2337
  }
2339
2338
 
2340
2339
  function mllData(geoJson) {