@rive-app/webgl2 2.12.2 → 2.13.0
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 +1 -21
- package/rive.js +6 -31
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
package/package.json
CHANGED
package/rive.d.ts
CHANGED
|
@@ -5,9 +5,6 @@ export type { FileAsset, FontAsset, ImageAsset } from './rive_advanced.mjs';
|
|
|
5
5
|
*/
|
|
6
6
|
export type VoidCallback = () => void;
|
|
7
7
|
export type AssetLoadCallback = (asset: rc.FileAsset, bytes: Uint8Array) => Boolean;
|
|
8
|
-
interface SetupRiveListenersOptions {
|
|
9
|
-
isTouchScrollEnabled?: boolean;
|
|
10
|
-
}
|
|
11
8
|
/**
|
|
12
9
|
* Type for artboard bounds
|
|
13
10
|
*/
|
|
@@ -205,12 +202,6 @@ export interface RiveParameters {
|
|
|
205
202
|
* will be attached to the <canvas> element
|
|
206
203
|
*/
|
|
207
204
|
shouldDisableRiveListeners?: boolean;
|
|
208
|
-
/**
|
|
209
|
-
* For Rive Listeners, allows scrolling behavior to still occur on canvas elements
|
|
210
|
-
* when a touch/drag action is performed on touch-enabled devices. Otherwise,
|
|
211
|
-
* scroll behavior may be prevented on touch/drag actions on the canvas by default.
|
|
212
|
-
*/
|
|
213
|
-
isTouchScrollEnabled?: boolean;
|
|
214
205
|
/**
|
|
215
206
|
* Enable Rive Events to be handled by the runtime. This means any special Rive Event may have
|
|
216
207
|
* a side effect that takes place implicitly.
|
|
@@ -307,21 +298,10 @@ export declare class Rive {
|
|
|
307
298
|
durations: number[];
|
|
308
299
|
frameTimes: number[];
|
|
309
300
|
frameCount: number;
|
|
310
|
-
isTouchScrollEnabled: boolean;
|
|
311
301
|
constructor(params: RiveParameters);
|
|
312
302
|
static new(params: RiveParameters): Rive;
|
|
313
303
|
private init;
|
|
314
|
-
|
|
315
|
-
* Setup Rive Listeners on the canvas
|
|
316
|
-
* @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow
|
|
317
|
-
* touch scrolling on the canvas element on touch-enabled devices
|
|
318
|
-
* i.e. { isTouchScrollEnabled: true }
|
|
319
|
-
*/
|
|
320
|
-
setupRiveListeners(riveListenerOptions?: SetupRiveListenersOptions): void;
|
|
321
|
-
/**
|
|
322
|
-
* Remove Rive Listeners setup on the canvas
|
|
323
|
-
*/
|
|
324
|
-
removeRiveListeners(): void;
|
|
304
|
+
private setupRiveListeners;
|
|
325
305
|
private initData;
|
|
326
306
|
private initArtboard;
|
|
327
307
|
drawFrame(): void;
|
package/rive.js
CHANGED
|
@@ -3609,7 +3609,7 @@ be();
|
|
|
3609
3609
|
/* 2 */
|
|
3610
3610
|
/***/ ((module) => {
|
|
3611
3611
|
|
|
3612
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
3612
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.13.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3613
3613
|
|
|
3614
3614
|
/***/ }),
|
|
3615
3615
|
/* 3 */
|
|
@@ -3643,15 +3643,11 @@ var _this = undefined;
|
|
|
3643
3643
|
* @param event - Either a TouchEvent or a MouseEvent
|
|
3644
3644
|
* @returns - Coordinates of the clientX and clientY properties from the touch/mouse event
|
|
3645
3645
|
*/
|
|
3646
|
-
var getClientCoordinates = function (event
|
|
3646
|
+
var getClientCoordinates = function (event) {
|
|
3647
3647
|
var _a, _b;
|
|
3648
3648
|
if (["touchstart", "touchmove"].indexOf(event.type) > -1 &&
|
|
3649
3649
|
((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
3650
|
-
|
|
3651
|
-
// which may prevent scrolling if a drag motion on the canvas is performed
|
|
3652
|
-
if (!isTouchScrollEnabled) {
|
|
3653
|
-
event.preventDefault();
|
|
3654
|
-
}
|
|
3650
|
+
event.preventDefault();
|
|
3655
3651
|
return {
|
|
3656
3652
|
clientX: event.touches[0].clientX,
|
|
3657
3653
|
clientY: event.touches[0].clientY,
|
|
@@ -3676,7 +3672,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled) {
|
|
|
3676
3672
|
* the state machine pointer move/up/down functions based on cursor interaction
|
|
3677
3673
|
*/
|
|
3678
3674
|
var registerTouchInteractions = function (_a) {
|
|
3679
|
-
var canvas = _a.canvas, artboard = _a.artboard, _b = _a.stateMachines, stateMachines = _b === void 0 ? [] : _b, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment
|
|
3675
|
+
var canvas = _a.canvas, artboard = _a.artboard, _b = _a.stateMachines, stateMachines = _b === void 0 ? [] : _b, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment;
|
|
3680
3676
|
if (!canvas ||
|
|
3681
3677
|
!stateMachines.length ||
|
|
3682
3678
|
!renderer ||
|
|
@@ -3687,7 +3683,7 @@ var registerTouchInteractions = function (_a) {
|
|
|
3687
3683
|
}
|
|
3688
3684
|
var processEventCallback = function (event) {
|
|
3689
3685
|
var boundingRect = event.currentTarget.getBoundingClientRect();
|
|
3690
|
-
var _a = getClientCoordinates(event
|
|
3686
|
+
var _a = getClientCoordinates(event), clientX = _a.clientX, clientY = _a.clientY;
|
|
3691
3687
|
if (!clientX && !clientY) {
|
|
3692
3688
|
return;
|
|
3693
3689
|
}
|
|
@@ -4873,7 +4869,6 @@ var Rive = /** @class */ (function () {
|
|
|
4873
4869
|
this.durations = [];
|
|
4874
4870
|
this.frameTimes = [];
|
|
4875
4871
|
this.frameCount = 0;
|
|
4876
|
-
this.isTouchScrollEnabled = false;
|
|
4877
4872
|
/**
|
|
4878
4873
|
* Used be draw to track when a second of active rendering time has passed.
|
|
4879
4874
|
* Used for debugging purposes
|
|
@@ -4884,7 +4879,6 @@ var Rive = /** @class */ (function () {
|
|
|
4884
4879
|
this.buffer = params.buffer;
|
|
4885
4880
|
this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
|
|
4886
4881
|
this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
|
|
4887
|
-
this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
|
|
4888
4882
|
this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
|
|
4889
4883
|
this.enableRiveAssetCDN =
|
|
4890
4884
|
params.enableRiveAssetCDN === undefined
|
|
@@ -4986,22 +4980,12 @@ var Rive = /** @class */ (function () {
|
|
|
4986
4980
|
console.error(e);
|
|
4987
4981
|
});
|
|
4988
4982
|
};
|
|
4989
|
-
|
|
4990
|
-
* Setup Rive Listeners on the canvas
|
|
4991
|
-
* @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow
|
|
4992
|
-
* touch scrolling on the canvas element on touch-enabled devices
|
|
4993
|
-
* i.e. { isTouchScrollEnabled: true }
|
|
4994
|
-
*/
|
|
4995
|
-
Rive.prototype.setupRiveListeners = function (riveListenerOptions) {
|
|
4983
|
+
Rive.prototype.setupRiveListeners = function () {
|
|
4996
4984
|
var _this = this;
|
|
4997
4985
|
if (!this.shouldDisableRiveListeners) {
|
|
4998
4986
|
var activeStateMachines = (this.animator.stateMachines || [])
|
|
4999
4987
|
.filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
|
|
5000
4988
|
.map(function (sm) { return sm.instance; });
|
|
5001
|
-
var touchScrollEnabledOption = this.isTouchScrollEnabled;
|
|
5002
|
-
if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
|
|
5003
|
-
touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
|
|
5004
|
-
}
|
|
5005
4989
|
this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
|
|
5006
4990
|
canvas: this.canvas,
|
|
5007
4991
|
artboard: this.artboard,
|
|
@@ -5010,18 +4994,9 @@ var Rive = /** @class */ (function () {
|
|
|
5010
4994
|
rive: this.runtime,
|
|
5011
4995
|
fit: this._layout.runtimeFit(this.runtime),
|
|
5012
4996
|
alignment: this._layout.runtimeAlignment(this.runtime),
|
|
5013
|
-
isTouchScrollEnabled: touchScrollEnabledOption,
|
|
5014
4997
|
});
|
|
5015
4998
|
}
|
|
5016
4999
|
};
|
|
5017
|
-
/**
|
|
5018
|
-
* Remove Rive Listeners setup on the canvas
|
|
5019
|
-
*/
|
|
5020
|
-
Rive.prototype.removeRiveListeners = function () {
|
|
5021
|
-
if (this.eventCleanup) {
|
|
5022
|
-
this.eventCleanup();
|
|
5023
|
-
}
|
|
5024
|
-
};
|
|
5025
5000
|
// Initializes runtime with Rive data and preps for playing
|
|
5026
5001
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
|
|
5027
5002
|
var _a;
|