@rive-app/webgl 2.24.0 → 2.25.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "Rive's webgl based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -103,6 +103,10 @@ export declare class StateMachineInput {
103
103
  * Fires a trigger; does nothing on Number or Boolean input types
104
104
  */
105
105
  fire(): void;
106
+ /**
107
+ * Deletes the input
108
+ */
109
+ delete(): void;
106
110
  }
107
111
  export declare enum RiveEventType {
108
112
  General = 128,
package/rive.js CHANGED
@@ -4061,7 +4061,7 @@ Je();
4061
4061
  /* 2 */
4062
4062
  /***/ ((module) => {
4063
4063
 
4064
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.24.0","description":"Rive\'s webgl 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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4064
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.25.0","description":"Rive\'s webgl 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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4065
4065
 
4066
4066
  /***/ }),
4067
4067
  /* 3 */
@@ -4344,7 +4344,7 @@ var registerTouchInteractions = function (_a) {
4344
4344
  case "mouseout":
4345
4345
  for (var _i = 0, stateMachines_1 = stateMachines; _i < stateMachines_1.length; _i++) {
4346
4346
  var stateMachine = stateMachines_1[_i];
4347
- stateMachine.pointerMove(transformedX < 0 ? transformedX - 10000 : transformedX + 10000, transformedY < 0 ? transformedY - 10000 : transformedY + 10000);
4347
+ stateMachine.pointerMove(transformedX, transformedY);
4348
4348
  }
4349
4349
  break;
4350
4350
  // Pointer moving/hovering on the canvas
@@ -4855,6 +4855,12 @@ var StateMachineInput = /** @class */ (function () {
4855
4855
  this.runtimeInput.fire();
4856
4856
  }
4857
4857
  };
4858
+ /**
4859
+ * Deletes the input
4860
+ */
4861
+ StateMachineInput.prototype.delete = function () {
4862
+ this.runtimeInput = null;
4863
+ };
4858
4864
  return StateMachineInput;
4859
4865
  }());
4860
4866
 
@@ -4956,6 +4962,10 @@ var StateMachine = /** @class */ (function () {
4956
4962
  * state machine is no more.
4957
4963
  */
4958
4964
  StateMachine.prototype.cleanup = function () {
4965
+ this.inputs.forEach(function (input) {
4966
+ input.delete();
4967
+ });
4968
+ this.inputs.length = 0;
4959
4969
  this.instance.delete();
4960
4970
  };
4961
4971
  return StateMachine;
@@ -5800,6 +5810,8 @@ var Rive = /** @class */ (function () {
5800
5810
  var _a;
5801
5811
  // Tracks if a Rive file is loaded
5802
5812
  this.loaded = false;
5813
+ // Reference of an object that handles any observers for the animation
5814
+ this._observed = null;
5803
5815
  /**
5804
5816
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5805
5817
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5941,6 +5953,8 @@ var Rive = /** @class */ (function () {
5941
5953
  RuntimeLoader.awaitInstance()
5942
5954
  .then(function (runtime) {
5943
5955
  _this.runtime = runtime;
5956
+ _this.removeRiveListeners();
5957
+ _this.deleteRiveRenderer();
5944
5958
  // Get the canvas where you want to render the animation and create a renderer
5945
5959
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5946
5960
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5995,6 +6009,7 @@ var Rive = /** @class */ (function () {
5995
6009
  Rive.prototype.removeRiveListeners = function () {
5996
6010
  if (this.eventCleanup) {
5997
6011
  this.eventCleanup();
6012
+ this.eventCleanup = null;
5998
6013
  }
5999
6014
  };
6000
6015
  /**
@@ -6299,9 +6314,11 @@ var Rive = /** @class */ (function () {
6299
6314
  if (this._observed !== null) {
6300
6315
  observers.remove(this._observed);
6301
6316
  }
6317
+ this.removeRiveListeners();
6302
6318
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6303
6319
  this.riveFile = null;
6304
6320
  this.file = null;
6321
+ this.deleteRiveRenderer();
6305
6322
  };
6306
6323
  /**
6307
6324
  * Cleans up the Renderer object. Only call this API if you no longer