@rive-app/canvas 2.34.0 → 2.34.2
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 +34 -11
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
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
|
@@ -740,7 +740,7 @@ function Xa(a, b) {
|
|
|
740
740
|
return Wa(c, a, b);
|
|
741
741
|
}));
|
|
742
742
|
}
|
|
743
|
-
var Za, $a, db = {
|
|
743
|
+
var Za, $a, db = {490818:(a, b, c, d, e) => {
|
|
744
744
|
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
|
|
745
745
|
return 0;
|
|
746
746
|
}
|
|
@@ -803,11 +803,11 @@ var Za, $a, db = {490114:(a, b, c, d, e) => {
|
|
|
803
803
|
}
|
|
804
804
|
window.h.za += 1;
|
|
805
805
|
return 1;
|
|
806
|
-
},
|
|
806
|
+
}, 492996:() => {
|
|
807
807
|
"undefined" !== typeof window.h && (window.h.Sa.map(function(a) {
|
|
808
808
|
document.removeEventListener(a, window.h.unlock, !0);
|
|
809
809
|
}), --window.h.za, 0 === window.h.za && delete window.h);
|
|
810
|
-
},
|
|
810
|
+
}, 493300:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 493404:() => {
|
|
811
811
|
try {
|
|
812
812
|
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
|
|
813
813
|
a.close();
|
|
@@ -815,7 +815,7 @@ var Za, $a, db = {490114:(a, b, c, d, e) => {
|
|
|
815
815
|
} catch (c) {
|
|
816
816
|
return 0;
|
|
817
817
|
}
|
|
818
|
-
},
|
|
818
|
+
}, 493575:(a, b, c, d, e, f) => {
|
|
819
819
|
if ("undefined" === typeof window.h) {
|
|
820
820
|
return -1;
|
|
821
821
|
}
|
|
@@ -861,7 +861,7 @@ var Za, $a, db = {490114:(a, b, c, d, e) => {
|
|
|
861
861
|
a == window.h.J.xa && g.Z.connect(g.L.destination);
|
|
862
862
|
g.pb = f;
|
|
863
863
|
return window.h.sc(g);
|
|
864
|
-
},
|
|
864
|
+
}, 496452:a => window.h.qa(a).L.sampleRate, 496525:a => {
|
|
865
865
|
a = window.h.qa(a);
|
|
866
866
|
void 0 !== a.Z && (a.Z.onaudioprocess = function() {
|
|
867
867
|
}, a.Z.disconnect(), a.Z = void 0);
|
|
@@ -869,13 +869,13 @@ var Za, $a, db = {490114:(a, b, c, d, e) => {
|
|
|
869
869
|
a.L.close();
|
|
870
870
|
a.L = void 0;
|
|
871
871
|
a.pb = void 0;
|
|
872
|
-
},
|
|
872
|
+
}, 496925:a => {
|
|
873
873
|
window.h.Ab(a);
|
|
874
|
-
},
|
|
874
|
+
}, 496975:a => {
|
|
875
875
|
a = window.h.qa(a);
|
|
876
876
|
a.L.resume();
|
|
877
877
|
a.state = window.h.ga.wb;
|
|
878
|
-
},
|
|
878
|
+
}, 497114:a => {
|
|
879
879
|
a = window.h.qa(a);
|
|
880
880
|
a.L.suspend();
|
|
881
881
|
a.state = window.h.ga.stopped;
|
|
@@ -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.2","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
|