@rive-app/canvas-lite 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-lite",
3
- "version": "2.12.2",
3
+ "version": "2.13.0",
4
4
  "description": "A lite version of 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
@@ -2252,7 +2252,7 @@ Pc();
2252
2252
  /* 2 */
2253
2253
  /***/ ((module) => {
2254
2254
 
2255
- module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.12.2","description":"A lite version of 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}}');
2255
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.13.0","description":"A lite version of 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}}');
2256
2256
 
2257
2257
  /***/ }),
2258
2258
  /* 3 */
@@ -2286,15 +2286,11 @@ var _this = undefined;
2286
2286
  * @param event - Either a TouchEvent or a MouseEvent
2287
2287
  * @returns - Coordinates of the clientX and clientY properties from the touch/mouse event
2288
2288
  */
2289
- var getClientCoordinates = function (event, isTouchScrollEnabled) {
2289
+ var getClientCoordinates = function (event) {
2290
2290
  var _a, _b;
2291
2291
  if (["touchstart", "touchmove"].indexOf(event.type) > -1 &&
2292
2292
  ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length)) {
2293
- // This flag, if false, prevents touch events on the canvas default behavior
2294
- // which may prevent scrolling if a drag motion on the canvas is performed
2295
- if (!isTouchScrollEnabled) {
2296
- event.preventDefault();
2297
- }
2293
+ event.preventDefault();
2298
2294
  return {
2299
2295
  clientX: event.touches[0].clientX,
2300
2296
  clientY: event.touches[0].clientY,
@@ -2319,7 +2315,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled) {
2319
2315
  * the state machine pointer move/up/down functions based on cursor interaction
2320
2316
  */
2321
2317
  var registerTouchInteractions = function (_a) {
2322
- 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;
2318
+ 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;
2323
2319
  if (!canvas ||
2324
2320
  !stateMachines.length ||
2325
2321
  !renderer ||
@@ -2330,7 +2326,7 @@ var registerTouchInteractions = function (_a) {
2330
2326
  }
2331
2327
  var processEventCallback = function (event) {
2332
2328
  var boundingRect = event.currentTarget.getBoundingClientRect();
2333
- var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
2329
+ var _a = getClientCoordinates(event), clientX = _a.clientX, clientY = _a.clientY;
2334
2330
  if (!clientX && !clientY) {
2335
2331
  return;
2336
2332
  }
@@ -3516,7 +3512,6 @@ var Rive = /** @class */ (function () {
3516
3512
  this.durations = [];
3517
3513
  this.frameTimes = [];
3518
3514
  this.frameCount = 0;
3519
- this.isTouchScrollEnabled = false;
3520
3515
  /**
3521
3516
  * Used be draw to track when a second of active rendering time has passed.
3522
3517
  * Used for debugging purposes
@@ -3527,7 +3522,6 @@ var Rive = /** @class */ (function () {
3527
3522
  this.buffer = params.buffer;
3528
3523
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
3529
3524
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
3530
- this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
3531
3525
  this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
3532
3526
  this.enableRiveAssetCDN =
3533
3527
  params.enableRiveAssetCDN === undefined
@@ -3629,22 +3623,12 @@ var Rive = /** @class */ (function () {
3629
3623
  console.error(e);
3630
3624
  });
3631
3625
  };
3632
- /**
3633
- * Setup Rive Listeners on the canvas
3634
- * @param riveListenerOptions - Enables TouchEvent events on the canvas. Set to true to allow
3635
- * touch scrolling on the canvas element on touch-enabled devices
3636
- * i.e. { isTouchScrollEnabled: true }
3637
- */
3638
- Rive.prototype.setupRiveListeners = function (riveListenerOptions) {
3626
+ Rive.prototype.setupRiveListeners = function () {
3639
3627
  var _this = this;
3640
3628
  if (!this.shouldDisableRiveListeners) {
3641
3629
  var activeStateMachines = (this.animator.stateMachines || [])
3642
3630
  .filter(function (sm) { return sm.playing && _this.runtime.hasListeners(sm.instance); })
3643
3631
  .map(function (sm) { return sm.instance; });
3644
- var touchScrollEnabledOption = this.isTouchScrollEnabled;
3645
- if (riveListenerOptions && 'isTouchScrollEnabled' in riveListenerOptions) {
3646
- touchScrollEnabledOption = riveListenerOptions.isTouchScrollEnabled;
3647
- }
3648
3632
  this.eventCleanup = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.registerTouchInteractions)({
3649
3633
  canvas: this.canvas,
3650
3634
  artboard: this.artboard,
@@ -3653,18 +3637,9 @@ var Rive = /** @class */ (function () {
3653
3637
  rive: this.runtime,
3654
3638
  fit: this._layout.runtimeFit(this.runtime),
3655
3639
  alignment: this._layout.runtimeAlignment(this.runtime),
3656
- isTouchScrollEnabled: touchScrollEnabledOption,
3657
3640
  });
3658
3641
  }
3659
3642
  };
3660
- /**
3661
- * Remove Rive Listeners setup on the canvas
3662
- */
3663
- Rive.prototype.removeRiveListeners = function () {
3664
- if (this.eventCleanup) {
3665
- this.eventCleanup();
3666
- }
3667
- };
3668
3643
  // Initializes runtime with Rive data and preps for playing
3669
3644
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
3670
3645
  var _a;