@rive-app/canvas 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 +1 -1
- package/rive.d.ts +3 -0
- package/rive.js +26 -3
- package/rive.js.map +1 -1
package/package.json
CHANGED
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
|
@@ -3383,7 +3383,7 @@ moduleRtn = da;
|
|
|
3383
3383
|
/* 2 */
|
|
3384
3384
|
/***/ ((module) => {
|
|
3385
3385
|
|
|
3386
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.34.
|
|
3386
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.34.1","description":"Rive\'s canvas based web api.","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.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3387
3387
|
|
|
3388
3388
|
/***/ }),
|
|
3389
3389
|
/* 3 */
|
|
@@ -5728,6 +5728,10 @@ var Rive = /** @class */ (function () {
|
|
|
5728
5728
|
this._hasZeroSize = false;
|
|
5729
5729
|
// Whether a draw operation needs to be forced
|
|
5730
5730
|
this._needsRedraw = false;
|
|
5731
|
+
// Canvas width and height. Values are lazily updated so they might
|
|
5732
|
+
// not be in sync with current canvas size.
|
|
5733
|
+
this._currentCanvasWidth = 0;
|
|
5734
|
+
this._currentCanvasHeight = 0;
|
|
5731
5735
|
// Audio event listener
|
|
5732
5736
|
this._audioEventListener = null;
|
|
5733
5737
|
// draw method bound to the class
|
|
@@ -5762,6 +5766,8 @@ var Rive = /** @class */ (function () {
|
|
|
5762
5766
|
if (params.canvas.constructor === HTMLCanvasElement) {
|
|
5763
5767
|
this._observed = observers.add(this.canvas, this.onCanvasResize);
|
|
5764
5768
|
}
|
|
5769
|
+
this._currentCanvasWidth = this.canvas.width;
|
|
5770
|
+
this._currentCanvasHeight = this.canvas.height;
|
|
5765
5771
|
this.src = params.src;
|
|
5766
5772
|
this.buffer = params.buffer;
|
|
5767
5773
|
this.riveFile = params.riveFile;
|
|
@@ -6102,6 +6108,20 @@ var Rive = /** @class */ (function () {
|
|
|
6102
6108
|
this.scheduleRendering();
|
|
6103
6109
|
}
|
|
6104
6110
|
};
|
|
6111
|
+
Rive.prototype._canvasSizeChanged = function () {
|
|
6112
|
+
var changed = false;
|
|
6113
|
+
if (this.canvas) {
|
|
6114
|
+
if (this.canvas.width !== this._currentCanvasWidth) {
|
|
6115
|
+
this._currentCanvasWidth = this.canvas.width;
|
|
6116
|
+
changed = true;
|
|
6117
|
+
}
|
|
6118
|
+
if (this.canvas.height !== this._currentCanvasHeight) {
|
|
6119
|
+
this._currentCanvasHeight = this.canvas.height;
|
|
6120
|
+
changed = true;
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
return changed;
|
|
6124
|
+
};
|
|
6105
6125
|
/**
|
|
6106
6126
|
* Draw rendering loop; renders animation frames at the correct time interval.
|
|
6107
6127
|
* @param time the time at which to render a frame
|
|
@@ -6190,7 +6210,9 @@ var Rive = /** @class */ (function () {
|
|
|
6190
6210
|
if (!this._hasZeroSize) {
|
|
6191
6211
|
// If there was no dirt on this frame, do not clear and draw
|
|
6192
6212
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
6193
|
-
this.artboard.didChange() ||
|
|
6213
|
+
this.artboard.didChange() ||
|
|
6214
|
+
this._needsRedraw ||
|
|
6215
|
+
this._canvasSizeChanged()) {
|
|
6194
6216
|
// Canvas must be wiped to prevent artifacts
|
|
6195
6217
|
renderer.clear();
|
|
6196
6218
|
renderer.save();
|
|
@@ -6821,7 +6843,8 @@ var Rive = /** @class */ (function () {
|
|
|
6821
6843
|
* @returns true if no animations are playing or paused
|
|
6822
6844
|
*/
|
|
6823
6845
|
get: function () {
|
|
6824
|
-
|
|
6846
|
+
var _a, _b;
|
|
6847
|
+
return (_b = (_a = this.animator) === null || _a === void 0 ? void 0 : _a.isStopped) !== null && _b !== void 0 ? _b : true;
|
|
6825
6848
|
},
|
|
6826
6849
|
enumerable: false,
|
|
6827
6850
|
configurable: true
|