@visactor/vrender 0.14.0-alpha.7 → 0.14.0-alpha.9

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 (32) hide show
  1. package/cjs/common/utils.d.ts +14 -2
  2. package/cjs/common/utils.js +21 -1
  3. package/cjs/common/utils.js.map +1 -1
  4. package/cjs/core/contributions/env/feishu-contribution.js +3 -3
  5. package/cjs/core/contributions/env/feishu-contribution.js.map +1 -1
  6. package/cjs/core/contributions/env/lynx-contribution.js +3 -3
  7. package/cjs/core/contributions/env/lynx-contribution.js.map +1 -1
  8. package/cjs/core/contributions/env/node-contribution.js +3 -3
  9. package/cjs/core/contributions/env/node-contribution.js.map +1 -1
  10. package/cjs/core/contributions/env/wx-contribution.js +3 -3
  11. package/cjs/core/contributions/env/wx-contribution.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/dist/index.js +42 -9
  16. package/dist/index.min.js +1 -1
  17. package/es/common/utils.d.ts +14 -2
  18. package/es/common/utils.js +22 -0
  19. package/es/common/utils.js.map +1 -1
  20. package/es/core/contributions/env/feishu-contribution.js +4 -2
  21. package/es/core/contributions/env/feishu-contribution.js.map +1 -1
  22. package/es/core/contributions/env/lynx-contribution.js +4 -2
  23. package/es/core/contributions/env/lynx-contribution.js.map +1 -1
  24. package/es/core/contributions/env/node-contribution.js +4 -2
  25. package/es/core/contributions/env/node-contribution.js.map +1 -1
  26. package/es/core/contributions/env/wx-contribution.js +4 -2
  27. package/es/core/contributions/env/wx-contribution.js.map +1 -1
  28. package/es/index.d.ts +1 -1
  29. package/es/index.js +1 -1
  30. package/es/index.js.map +1 -1
  31. package/es/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -14560,6 +14560,37 @@
14560
14560
  }
14561
14561
  return attr[key];
14562
14562
  }
14563
+ class RafBasedSTO {
14564
+ static TimeOut = 1000 / 60;
14565
+ durations;
14566
+ timeout;
14567
+ lastDate;
14568
+ durationsListThreshold;
14569
+ constructor() {
14570
+ this.durations = [];
14571
+ this.timeout = RafBasedSTO.TimeOut;
14572
+ this.lastDate = 0;
14573
+ this.durationsListThreshold = 30;
14574
+ }
14575
+ call(cb) {
14576
+ this.lastDate = Date.now();
14577
+ return setTimeout(() => {
14578
+ this.appendDuration(Date.now() - this.lastDate);
14579
+ cb(0);
14580
+ }, this.timeout, true);
14581
+ }
14582
+ clear(h) {
14583
+ clearTimeout(h);
14584
+ }
14585
+ appendDuration(d) {
14586
+ this.durations.push(d);
14587
+ if (this.durations.length > this.durationsListThreshold) {
14588
+ this.durations.shift();
14589
+ }
14590
+ this.timeout = Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60);
14591
+ }
14592
+ }
14593
+ const rafBasedSto = new RafBasedSTO();
14563
14594
 
14564
14595
  class IncreaseCount extends ACustomAnimate {
14565
14596
  fromNumber;
@@ -30180,12 +30211,12 @@
30180
30211
  }
30181
30212
  getRequestAnimationFrame() {
30182
30213
  return function (callback) {
30183
- return setTimeout(callback, 1000 / 60, true);
30214
+ return rafBasedSto.call(callback);
30184
30215
  };
30185
30216
  }
30186
30217
  getCancelAnimationFrame() {
30187
30218
  return (h) => {
30188
- clearTimeout(h);
30219
+ rafBasedSto.clear(h);
30189
30220
  };
30190
30221
  }
30191
30222
  addEventListener(type, listener, options) {
@@ -30497,12 +30528,12 @@
30497
30528
  }
30498
30529
  getRequestAnimationFrame() {
30499
30530
  return function (callback) {
30500
- return setTimeout(callback, 1000 / 60, true);
30531
+ return rafBasedSto.call(callback);
30501
30532
  };
30502
30533
  }
30503
30534
  getCancelAnimationFrame() {
30504
30535
  return (h) => {
30505
- clearTimeout(h);
30536
+ rafBasedSto.clear(h);
30506
30537
  };
30507
30538
  }
30508
30539
  addEventListener(type, listener, options) {
@@ -30623,12 +30654,12 @@
30623
30654
  }
30624
30655
  getRequestAnimationFrame() {
30625
30656
  return function (callback) {
30626
- return setTimeout(callback, 1000 / 60, true);
30657
+ return rafBasedSto.call(callback);
30627
30658
  };
30628
30659
  }
30629
30660
  getCancelAnimationFrame() {
30630
30661
  return (h) => {
30631
- clearTimeout(h);
30662
+ rafBasedSto.clear(h);
30632
30663
  };
30633
30664
  }
30634
30665
  addEventListener(type, listener, options) {
@@ -30732,12 +30763,12 @@
30732
30763
  }
30733
30764
  getRequestAnimationFrame() {
30734
30765
  return function (callback) {
30735
- return setTimeout(callback, 1000 / 60, true);
30766
+ return rafBasedSto.call(callback);
30736
30767
  };
30737
30768
  }
30738
30769
  getCancelAnimationFrame() {
30739
30770
  return (h) => {
30740
- clearTimeout(h);
30771
+ rafBasedSto.clear(h);
30741
30772
  };
30742
30773
  }
30743
30774
  addEventListener(type, listener, options) {
@@ -37371,7 +37402,7 @@
37371
37402
  'rect'
37372
37403
  ];
37373
37404
 
37374
- const version = "0.14.0-alpha.7";
37405
+ const version = "0.14.0-alpha.9";
37375
37406
 
37376
37407
  exports.ACustomAnimate = ACustomAnimate;
37377
37408
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;
@@ -37514,6 +37545,7 @@
37514
37545
  exports.RECT3D_NUMBER_TYPE = RECT3D_NUMBER_TYPE;
37515
37546
  exports.RECT_NUMBER_TYPE = RECT_NUMBER_TYPE;
37516
37547
  exports.RICHTEXT_NUMBER_TYPE = RICHTEXT_NUMBER_TYPE;
37548
+ exports.RafBasedSTO = RafBasedSTO;
37517
37549
  exports.Rect = Rect;
37518
37550
  exports.Rect3DRender = Rect3DRender;
37519
37551
  exports.Rect3d = Rect3d;
@@ -37656,6 +37688,7 @@
37656
37688
  exports.pointInterpolationHighPerformance = pointInterpolationHighPerformance;
37657
37689
  exports.pointsEqual = pointsEqual;
37658
37690
  exports.pointsInterpolation = pointsInterpolation;
37691
+ exports.rafBasedSto = rafBasedSto;
37659
37692
  exports.rectFillVisible = rectFillVisible;
37660
37693
  exports.rectStrokeVisible = rectStrokeVisible;
37661
37694
  exports.recursiveCallBinarySplit = recursiveCallBinarySplit;