@rive-app/canvas-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 +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
|
@@ -4260,7 +4260,7 @@ moduleRtn = da;
|
|
|
4260
4260
|
/* 2 */
|
|
4261
4261
|
/***/ ((module) => {
|
|
4262
4262
|
|
|
4263
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-single","version":"2.34.
|
|
4263
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-single","version":"2.34.1","description":"Rive\'s high-level canvas based web api all in one js file.","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}}');
|
|
4264
4264
|
|
|
4265
4265
|
/***/ }),
|
|
4266
4266
|
/* 3 */
|
|
@@ -6605,6 +6605,10 @@ var Rive = /** @class */ (function () {
|
|
|
6605
6605
|
this._hasZeroSize = false;
|
|
6606
6606
|
// Whether a draw operation needs to be forced
|
|
6607
6607
|
this._needsRedraw = false;
|
|
6608
|
+
// Canvas width and height. Values are lazily updated so they might
|
|
6609
|
+
// not be in sync with current canvas size.
|
|
6610
|
+
this._currentCanvasWidth = 0;
|
|
6611
|
+
this._currentCanvasHeight = 0;
|
|
6608
6612
|
// Audio event listener
|
|
6609
6613
|
this._audioEventListener = null;
|
|
6610
6614
|
// draw method bound to the class
|
|
@@ -6639,6 +6643,8 @@ var Rive = /** @class */ (function () {
|
|
|
6639
6643
|
if (params.canvas.constructor === HTMLCanvasElement) {
|
|
6640
6644
|
this._observed = observers.add(this.canvas, this.onCanvasResize);
|
|
6641
6645
|
}
|
|
6646
|
+
this._currentCanvasWidth = this.canvas.width;
|
|
6647
|
+
this._currentCanvasHeight = this.canvas.height;
|
|
6642
6648
|
this.src = params.src;
|
|
6643
6649
|
this.buffer = params.buffer;
|
|
6644
6650
|
this.riveFile = params.riveFile;
|
|
@@ -6979,6 +6985,20 @@ var Rive = /** @class */ (function () {
|
|
|
6979
6985
|
this.scheduleRendering();
|
|
6980
6986
|
}
|
|
6981
6987
|
};
|
|
6988
|
+
Rive.prototype._canvasSizeChanged = function () {
|
|
6989
|
+
var changed = false;
|
|
6990
|
+
if (this.canvas) {
|
|
6991
|
+
if (this.canvas.width !== this._currentCanvasWidth) {
|
|
6992
|
+
this._currentCanvasWidth = this.canvas.width;
|
|
6993
|
+
changed = true;
|
|
6994
|
+
}
|
|
6995
|
+
if (this.canvas.height !== this._currentCanvasHeight) {
|
|
6996
|
+
this._currentCanvasHeight = this.canvas.height;
|
|
6997
|
+
changed = true;
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
return changed;
|
|
7001
|
+
};
|
|
6982
7002
|
/**
|
|
6983
7003
|
* Draw rendering loop; renders animation frames at the correct time interval.
|
|
6984
7004
|
* @param time the time at which to render a frame
|
|
@@ -7067,7 +7087,9 @@ var Rive = /** @class */ (function () {
|
|
|
7067
7087
|
if (!this._hasZeroSize) {
|
|
7068
7088
|
// If there was no dirt on this frame, do not clear and draw
|
|
7069
7089
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
7070
|
-
this.artboard.didChange() ||
|
|
7090
|
+
this.artboard.didChange() ||
|
|
7091
|
+
this._needsRedraw ||
|
|
7092
|
+
this._canvasSizeChanged()) {
|
|
7071
7093
|
// Canvas must be wiped to prevent artifacts
|
|
7072
7094
|
renderer.clear();
|
|
7073
7095
|
renderer.save();
|
|
@@ -7698,7 +7720,8 @@ var Rive = /** @class */ (function () {
|
|
|
7698
7720
|
* @returns true if no animations are playing or paused
|
|
7699
7721
|
*/
|
|
7700
7722
|
get: function () {
|
|
7701
|
-
|
|
7723
|
+
var _a, _b;
|
|
7724
|
+
return (_b = (_a = this.animator) === null || _a === void 0 ? void 0 : _a.isStopped) !== null && _b !== void 0 ? _b : true;
|
|
7702
7725
|
},
|
|
7703
7726
|
enumerable: false,
|
|
7704
7727
|
configurable: true
|