@rive-app/canvas 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/canvas",
3
- "version": "2.12.2",
3
+ "version": "2.13.0",
4
4
  "description": "Rive's canvas 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
@@ -3404,7 +3404,7 @@ Zd();
3404
3404
  /* 2 */
3405
3405
  /***/ ((module) => {
3406
3406
 
3407
- module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.12.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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3407
+ module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.13.0","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3408
3408
 
3409
3409
  /***/ }),
3410
3410
  /* 3 */
@@ -3438,15 +3438,11 @@ var _this = undefined;
3438
3438
  * @param event - Either a TouchEvent or a MouseEvent
3439
3439
  * @returns - Coordinates of the clientX and clientY properties from the touch/mouse event
3440
3440
  */
3441
- var getClientCoordinates = function (event, isTouchScrollEnabled) {
3441
+ var getClientCoordinates = function (event) {
3442
3442
  var _a, _b;
3443
3443
  if (["touchstart", "touchmove"].indexOf(event.type) > -1 &&
3444
3444
  ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length)) {
3445
- // This flag, if false, prevents touch events on the canvas default behavior
3446
- // which may prevent scrolling if a drag motion on the canvas is performed
3447
- if (!isTouchScrollEnabled) {
3448
- event.preventDefault();
3449
- }
3445
+ event.preventDefault();
3450
3446
  return {
3451
3447
  clientX: event.touches[0].clientX,
3452
3448
  clientY: event.touches[0].clientY,
@@ -3471,7 +3467,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled) {
3471
3467
  * the state machine pointer move/up/down functions based on cursor interaction
3472
3468
  */
3473
3469
  var registerTouchInteractions = function (_a) {
3474
- 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;
3470
+ 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;
3475
3471
  if (!canvas ||
3476
3472
  !stateMachines.length ||
3477
3473
  !renderer ||
@@ -3482,7 +3478,7 @@ var registerTouchInteractions = function (_a) {
3482
3478
  }
3483
3479
  var processEventCallback = function (event) {
3484
3480
  var boundingRect = event.currentTarget.getBoundingClientRect();
3485
- var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
3481
+ var _a = getClientCoordinates(event), clientX = _a.clientX, clientY = _a.clientY;
3486
3482
  if (!clientX && !clientY) {
3487
3483
  return;
3488
3484
  }
@@ -4668,7 +4664,6 @@ var Rive = /** @class */ (function () {
4668
4664
  this.durations = [];
4669
4665
  this.frameTimes = [];
4670
4666
  this.frameCount = 0;
4671
- this.isTouchScrollEnabled = false;
4672
4667
  /**
4673
4668
  * Used be draw to track when a second of active rendering time has passed.
4674
4669
  * Used for debugging purposes
@@ -4679,7 +4674,6 @@ var Rive = /** @class */ (function () {
4679
4674
  this.buffer = params.buffer;
4680
4675
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
4681
4676
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
4682
- this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
4683
4677
  this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
4684
4678
  this.enableRiveAssetCDN =
4685
4679
  params.enableRiveAssetCDN === undefined
@@ -4781,22 +4775,12 @@ var Rive = /** @class */ (function () {
4781
4775
  console.error(e);
4782
4776
  });
4783
4777
  };
4784
- /**
4785
- * Setup Rive Listeners on the canvas
4786
- * @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow
4787
- * touch scrolling on the canvas element on touch-enabled devices
4788
- * i.e. { isTouchScrollEnabled: true }
4789
- */
4790
- Rive.prototype.setupRiveListeners = function (riveListenerOptions) {
4778
+ Rive.prototype.setupRiveListeners = function () {
4791
4779
  var _this = this;
4792
4780
  if (!this.shouldDisableRiveListeners) {
4793
4781
  var activeStateMachines = (this.animator.stateMachines || [])
4794
4782
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
4795
4783
  .map(function (sm) { return sm.instance; });
4796
- var touchScrollEnabledOption = this.isTouchScrollEnabled;
4797
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
4798
- touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
4799
- }
4800
4784
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
4801
4785
  canvas: this.canvas,
4802
4786
  artboard: this.artboard,
@@ -4805,18 +4789,9 @@ var Rive = /** @class */ (function () {
4805
4789
  rive: this.runtime,
4806
4790
  fit: this._layout.runtimeFit(this.runtime),
4807
4791
  alignment: this._layout.runtimeAlignment(this.runtime),
4808
- isTouchScrollEnabled: touchScrollEnabledOption,
4809
4792
  });
4810
4793
  }
4811
4794
  };
4812
- /**
4813
- * Remove Rive Listeners setup on the canvas
4814
- */
4815
- Rive.prototype.removeRiveListeners = function () {
4816
- if (this.eventCleanup) {
4817
- this.eventCleanup();
4818
- }
4819
- };
4820
4795
  // Initializes runtime with Rive data and preps for playing
4821
4796
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
4822
4797
  var _a;