@rive-app/webgl-single 2.34.0 → 2.34.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl-single",
3
- "version": "2.34.0",
3
+ "version": "2.34.1",
4
4
  "description": "Rive's webgl based web api with bundled wasm.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -429,6 +429,8 @@ export declare class Rive {
429
429
  private _devicePixelRatioUsed;
430
430
  private _hasZeroSize;
431
431
  private _needsRedraw;
432
+ private _currentCanvasWidth;
433
+ private _currentCanvasHeight;
432
434
  private _audioEventListener;
433
435
  private _boundDraw;
434
436
  private _viewModelInstance;
@@ -464,6 +466,7 @@ export declare class Rive {
464
466
  private initData;
465
467
  private initArtboard;
466
468
  drawFrame(): void;
469
+ private _canvasSizeChanged;
467
470
  private lastRenderTime;
468
471
  private frameRequestId;
469
472
  /**
package/rive.js CHANGED
@@ -3923,7 +3923,7 @@ moduleRtn = ca;
3923
3923
  /* 2 */
3924
3924
  /***/ ((module) => {
3925
3925
 
3926
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl-single","version":"2.34.0","description":"Rive\'s webgl based web api with bundled wasm.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3926
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl-single","version":"2.34.1","description":"Rive\'s webgl based web api with bundled wasm.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3927
3927
 
3928
3928
  /***/ }),
3929
3929
  /* 3 */
@@ -6268,6 +6268,10 @@ var Rive = /** @class */ (function () {
6268
6268
  this._hasZeroSize = false;
6269
6269
  // Whether a draw operation needs to be forced
6270
6270
  this._needsRedraw = false;
6271
+ // Canvas width and height. Values are lazily updated so they might
6272
+ // not be in sync with current canvas size.
6273
+ this._currentCanvasWidth = 0;
6274
+ this._currentCanvasHeight = 0;
6271
6275
  // Audio event listener
6272
6276
  this._audioEventListener = null;
6273
6277
  // draw method bound to the class
@@ -6302,6 +6306,8 @@ var Rive = /** @class */ (function () {
6302
6306
  if (params.canvas.constructor === HTMLCanvasElement) {
6303
6307
  this._observed = observers.add(this.canvas, this.onCanvasResize);
6304
6308
  }
6309
+ this._currentCanvasWidth = this.canvas.width;
6310
+ this._currentCanvasHeight = this.canvas.height;
6305
6311
  this.src = params.src;
6306
6312
  this.buffer = params.buffer;
6307
6313
  this.riveFile = params.riveFile;
@@ -6642,6 +6648,20 @@ var Rive = /** @class */ (function () {
6642
6648
  this.scheduleRendering();
6643
6649
  }
6644
6650
  };
6651
+ Rive.prototype._canvasSizeChanged = function () {
6652
+ var changed = false;
6653
+ if (this.canvas) {
6654
+ if (this.canvas.width !== this._currentCanvasWidth) {
6655
+ this._currentCanvasWidth = this.canvas.width;
6656
+ changed = true;
6657
+ }
6658
+ if (this.canvas.height !== this._currentCanvasHeight) {
6659
+ this._currentCanvasHeight = this.canvas.height;
6660
+ changed = true;
6661
+ }
6662
+ }
6663
+ return changed;
6664
+ };
6645
6665
  /**
6646
6666
  * Draw rendering loop; renders animation frames at the correct time interval.
6647
6667
  * @param time the time at which to render a frame
@@ -6730,7 +6750,9 @@ var Rive = /** @class */ (function () {
6730
6750
  if (!this._hasZeroSize) {
6731
6751
  // If there was no dirt on this frame, do not clear and draw
6732
6752
  if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
6733
- this.artboard.didChange() || this._needsRedraw) {
6753
+ this.artboard.didChange() ||
6754
+ this._needsRedraw ||
6755
+ this._canvasSizeChanged()) {
6734
6756
  // Canvas must be wiped to prevent artifacts
6735
6757
  renderer.clear();
6736
6758
  renderer.save();
@@ -7361,7 +7383,8 @@ var Rive = /** @class */ (function () {
7361
7383
  * @returns true if no animations are playing or paused
7362
7384
  */
7363
7385
  get: function () {
7364
- return this.animator.isStopped;
7386
+ var _a, _b;
7387
+ return (_b = (_a = this.animator) === null || _a === void 0 ? void 0 : _a.isStopped) !== null && _b !== void 0 ? _b : true;
7365
7388
  },
7366
7389
  enumerable: false,
7367
7390
  configurable: true