@visactor/vrender 0.13.7 → 0.13.8-beta.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 (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
@@ -14275,6 +14275,37 @@
14275
14275
  }
14276
14276
  return attr[key];
14277
14277
  }
14278
+ class RafBasedSTO {
14279
+ static TimeOut = 1000 / 60;
14280
+ durations;
14281
+ timeout;
14282
+ lastDate;
14283
+ durationsListThreshold;
14284
+ constructor() {
14285
+ this.durations = [];
14286
+ this.timeout = RafBasedSTO.TimeOut;
14287
+ this.lastDate = 0;
14288
+ this.durationsListThreshold = 30;
14289
+ }
14290
+ call(cb) {
14291
+ this.lastDate = Date.now();
14292
+ return setTimeout(() => {
14293
+ this.appendDuration(Date.now() - this.lastDate);
14294
+ cb(0);
14295
+ }, this.timeout, true);
14296
+ }
14297
+ clear(h) {
14298
+ clearTimeout(h);
14299
+ }
14300
+ appendDuration(d) {
14301
+ this.durations.push(d);
14302
+ if (this.durations.length > this.durationsListThreshold) {
14303
+ this.durations.shift();
14304
+ }
14305
+ this.timeout = Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60);
14306
+ }
14307
+ }
14308
+ const rafBasedSto = new RafBasedSTO();
14278
14309
 
14279
14310
  class IncreaseCount extends ACustomAnimate {
14280
14311
  fromNumber;
@@ -29404,12 +29435,12 @@
29404
29435
  }
29405
29436
  getRequestAnimationFrame() {
29406
29437
  return function (callback) {
29407
- return setTimeout(callback, 1000 / 60, true);
29438
+ return rafBasedSto.call(callback);
29408
29439
  };
29409
29440
  }
29410
29441
  getCancelAnimationFrame() {
29411
29442
  return (h) => {
29412
- clearTimeout(h);
29443
+ rafBasedSto.clear(h);
29413
29444
  };
29414
29445
  }
29415
29446
  addEventListener(type, listener, options) {
@@ -29721,12 +29752,12 @@
29721
29752
  }
29722
29753
  getRequestAnimationFrame() {
29723
29754
  return function (callback) {
29724
- return setTimeout(callback, 1000 / 60, true);
29755
+ return rafBasedSto.call(callback);
29725
29756
  };
29726
29757
  }
29727
29758
  getCancelAnimationFrame() {
29728
29759
  return (h) => {
29729
- clearTimeout(h);
29760
+ rafBasedSto.clear(h);
29730
29761
  };
29731
29762
  }
29732
29763
  addEventListener(type, listener, options) {
@@ -29847,12 +29878,12 @@
29847
29878
  }
29848
29879
  getRequestAnimationFrame() {
29849
29880
  return function (callback) {
29850
- return setTimeout(callback, 1000 / 60, true);
29881
+ return rafBasedSto.call(callback);
29851
29882
  };
29852
29883
  }
29853
29884
  getCancelAnimationFrame() {
29854
29885
  return (h) => {
29855
- clearTimeout(h);
29886
+ rafBasedSto.clear(h);
29856
29887
  };
29857
29888
  }
29858
29889
  addEventListener(type, listener, options) {
@@ -29956,12 +29987,12 @@
29956
29987
  }
29957
29988
  getRequestAnimationFrame() {
29958
29989
  return function (callback) {
29959
- return setTimeout(callback, 1000 / 60, true);
29990
+ return rafBasedSto.call(callback);
29960
29991
  };
29961
29992
  }
29962
29993
  getCancelAnimationFrame() {
29963
29994
  return (h) => {
29964
- clearTimeout(h);
29995
+ rafBasedSto.clear(h);
29965
29996
  };
29966
29997
  }
29967
29998
  addEventListener(type, listener, options) {
@@ -36343,7 +36374,7 @@
36343
36374
  'rect'
36344
36375
  ];
36345
36376
 
36346
- const version = "0.13.7";
36377
+ const version = "0.13.8-beta.1";
36347
36378
 
36348
36379
  exports.ACustomAnimate = ACustomAnimate;
36349
36380
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;
@@ -36484,6 +36515,7 @@
36484
36515
  exports.RECT3D_NUMBER_TYPE = RECT3D_NUMBER_TYPE;
36485
36516
  exports.RECT_NUMBER_TYPE = RECT_NUMBER_TYPE;
36486
36517
  exports.RICHTEXT_NUMBER_TYPE = RICHTEXT_NUMBER_TYPE;
36518
+ exports.RafBasedSTO = RafBasedSTO;
36487
36519
  exports.Rect = Rect;
36488
36520
  exports.Rect3DRender = Rect3DRender;
36489
36521
  exports.Rect3d = Rect3d;
@@ -36626,6 +36658,7 @@
36626
36658
  exports.pointInterpolationHighPerformance = pointInterpolationHighPerformance;
36627
36659
  exports.pointsEqual = pointsEqual;
36628
36660
  exports.pointsInterpolation = pointsInterpolation;
36661
+ exports.rafBasedSto = rafBasedSto;
36629
36662
  exports.rectFillVisible = rectFillVisible;
36630
36663
  exports.rectStrokeVisible = rectStrokeVisible;
36631
36664
  exports.recursiveCallBinarySplit = recursiveCallBinarySplit;