@rive-app/webgl 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl",
3
- "version": "2.12.2",
3
+ "version": "2.13.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
@@ -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
@@ -4104,7 +4104,7 @@ Ie();
4104
4104
  /* 2 */
4105
4105
  /***/ ((module) => {
4106
4106
 
4107
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.12.2","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.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4107
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.13.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.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4108
4108
 
4109
4109
  /***/ }),
4110
4110
  /* 3 */
@@ -4138,15 +4138,11 @@ var _this = undefined;
4138
4138
  * @param event - Either a TouchEvent or a MouseEvent
4139
4139
  * @returns - Coordinates of the clientX and clientY properties from the touch/mouse event
4140
4140
  */
4141
- var getClientCoordinates = function (event, isTouchScrollEnabled) {
4141
+ var getClientCoordinates = function (event) {
4142
4142
  var _a, _b;
4143
4143
  if (["touchstart", "touchmove"].indexOf(event.type) > -1 &&
4144
4144
  ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length)) {
4145
- // This flag, if false, prevents touch events on the canvas default behavior
4146
- // which may prevent scrolling if a drag motion on the canvas is performed
4147
- if (!isTouchScrollEnabled) {
4148
- event.preventDefault();
4149
- }
4145
+ event.preventDefault();
4150
4146
  return {
4151
4147
  clientX: event.touches[0].clientX,
4152
4148
  clientY: event.touches[0].clientY,
@@ -4171,7 +4167,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled) {
4171
4167
  * the state machine pointer move/up/down functions based on cursor interaction
4172
4168
  */
4173
4169
  var registerTouchInteractions = function (_a) {
4174
- 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, _c = _a.isTouchScrollEnabled, isTouchScrollEnabled = _c === void 0 ? false : _c;
4170
+ 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;
4175
4171
  if (!canvas ||
4176
4172
  !stateMachines.length ||
4177
4173
  !renderer ||
@@ -4182,7 +4178,7 @@ var registerTouchInteractions = function (_a) {
4182
4178
  }
4183
4179
  var processEventCallback = function (event) {
4184
4180
  var boundingRect = event.currentTarget.getBoundingClientRect();
4185
- var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
4181
+ var _a = getClientCoordinates(event), clientX = _a.clientX, clientY = _a.clientY;
4186
4182
  if (!clientX && !clientY) {
4187
4183
  return;
4188
4184
  }
@@ -5368,7 +5364,6 @@ var Rive = /** @class */ (function () {
5368
5364
  this.durations = [];
5369
5365
  this.frameTimes = [];
5370
5366
  this.frameCount = 0;
5371
- this.isTouchScrollEnabled = false;
5372
5367
  /**
5373
5368
  * Used be draw to track when a second of active rendering time has passed.
5374
5369
  * Used for debugging purposes
@@ -5379,7 +5374,6 @@ var Rive = /** @class */ (function () {
5379
5374
  this.buffer = params.buffer;
5380
5375
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
5381
5376
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
5382
- this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
5383
5377
  this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
5384
5378
  this.enableRiveAssetCDN =
5385
5379
  params.enableRiveAssetCDN === undefined
@@ -5481,22 +5475,12 @@ var Rive = /** @class */ (function () {
5481
5475
  console.error(e);
5482
5476
  });
5483
5477
  };
5484
- /**
5485
- * Setup Rive Listeners on the canvas
5486
- * @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow
5487
- * touch scrolling on the canvas element on touch-enabled devices
5488
- * i.e. { isTouchScrollEnabled: true }
5489
- */
5490
- Rive.prototype.setupRiveListeners = function (riveListenerOptions) {
5478
+ Rive.prototype.setupRiveListeners = function () {
5491
5479
  var _this = this;
5492
5480
  if (!this.shouldDisableRiveListeners) {
5493
5481
  var activeStateMachines = (this.animator.stateMachines || [])
5494
5482
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
5495
5483
  .map(function (sm) { return sm.instance; });
5496
- var touchScrollEnabledOption = this.isTouchScrollEnabled;
5497
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
5498
- touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
5499
- }
5500
5484
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
5501
5485
  canvas: this.canvas,
5502
5486
  artboard: this.artboard,
@@ -5505,18 +5489,9 @@ var Rive = /** @class */ (function () {
5505
5489
  rive: this.runtime,
5506
5490
  fit: this._layout.runtimeFit(this.runtime),
5507
5491
  alignment: this._layout.runtimeAlignment(this.runtime),
5508
- isTouchScrollEnabled: touchScrollEnabledOption,
5509
5492
  });
5510
5493
  }
5511
5494
  };
5512
- /**
5513
- * Remove Rive Listeners setup on the canvas
5514
- */
5515
- Rive.prototype.removeRiveListeners = function () {
5516
- if (this.eventCleanup) {
5517
- this.eventCleanup();
5518
- }
5519
- };
5520
5495
  // Initializes runtime with Rive data and preps for playing
5521
5496
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
5522
5497
  var _a;