@rive-app/canvas 2.19.2 → 2.19.4

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.19.2",
3
+ "version": "2.19.4",
4
4
  "description": "Rive's canvas based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.js CHANGED
@@ -736,7 +736,7 @@ function Ya(a, b) {
736
736
  return Xa(c, a, b);
737
737
  }));
738
738
  }
739
- var Za, $a, db = {433900:(a, b, c, d, e) => {
739
+ var Za, $a, db = {433532:(a, b, c, d, e) => {
740
740
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
741
741
  return 0;
742
742
  }
@@ -799,9 +799,9 @@ var Za, $a, db = {433900:(a, b, c, d, e) => {
799
799
  }
800
800
  window.h.Aa += 1;
801
801
  return 1;
802
- }, 436078:() => {
802
+ }, 435710:() => {
803
803
  "undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
804
- }, 436242:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 436346:() => {
804
+ }, 435874:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 435978:() => {
805
805
  try {
806
806
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
807
807
  a.close();
@@ -809,7 +809,7 @@ var Za, $a, db = {433900:(a, b, c, d, e) => {
809
809
  } catch (c) {
810
810
  return 0;
811
811
  }
812
- }, 436517:(a, b, c, d, e, f) => {
812
+ }, 436149:(a, b, c, d, e, f) => {
813
813
  if ("undefined" === typeof window.h) {
814
814
  return -1;
815
815
  }
@@ -855,7 +855,7 @@ var Za, $a, db = {433900:(a, b, c, d, e) => {
855
855
  a == window.h.H.ya && g.Z.connect(g.I.destination);
856
856
  g.pb = f;
857
857
  return window.h.yc(g);
858
- }, 439394:a => window.h.ra(a).I.sampleRate, 439467:a => {
858
+ }, 439026:a => window.h.ra(a).I.sampleRate, 439099:a => {
859
859
  a = window.h.ra(a);
860
860
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
861
861
  }, a.Z.disconnect(), a.Z = void 0);
@@ -863,13 +863,13 @@ var Za, $a, db = {433900:(a, b, c, d, e) => {
863
863
  a.I.close();
864
864
  a.I = void 0;
865
865
  a.pb = void 0;
866
- }, 439867:a => {
866
+ }, 439499:a => {
867
867
  window.h.Cb(a);
868
- }, 439917:a => {
868
+ }, 439549:a => {
869
869
  a = window.h.ra(a);
870
870
  a.I.resume();
871
871
  a.state = window.h.ga.xb;
872
- }, 440056:a => {
872
+ }, 439688:a => {
873
873
  a = window.h.ra(a);
874
874
  a.I.suspend();
875
875
  a.state = window.h.ga.stopped;
@@ -3355,7 +3355,7 @@ Zd();
3355
3355
  /* 2 */
3356
3356
  /***/ ((module) => {
3357
3357
 
3358
- module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.19.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_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3358
+ module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.19.4","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_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3359
3359
 
3360
3360
  /***/ }),
3361
3361
  /* 3 */
@@ -3565,7 +3565,40 @@ var registerTouchInteractions = function (_a) {
3565
3565
  typeof window === "undefined") {
3566
3566
  return null;
3567
3567
  }
3568
+ /**
3569
+ * After a touchend event, some browsers may fire synthetic mouse events
3570
+ * (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause
3571
+ * any default action (such as scrolling).
3572
+ *
3573
+ * This is done to simulate the behavior of a mouse for applications that do not support
3574
+ * touch events.
3575
+ *
3576
+ * We're keeping track of the previous event to not send the synthetic mouse events if the
3577
+ * touch event was a click (touchstart -> touchend).
3578
+ *
3579
+ * This is only needed when `isTouchScrollEnabled` is false
3580
+ * When true, `preventDefault()` is called which prevents this behaviour.
3581
+ **/
3582
+ var _prevEventType = null;
3583
+ var _syntheticEventsActive = false;
3568
3584
  var processEventCallback = function (event) {
3585
+ // Exit early out of all synthetic mouse events
3586
+ // https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers
3587
+ // https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma
3588
+ if (_syntheticEventsActive && event instanceof MouseEvent) {
3589
+ // Synthetic event finished
3590
+ if (event.type == "mouseup") {
3591
+ _syntheticEventsActive = false;
3592
+ }
3593
+ return;
3594
+ }
3595
+ // Test if it's a "touch click". This could cause the browser to send
3596
+ // synthetic mouse events.
3597
+ _syntheticEventsActive =
3598
+ isTouchScrollEnabled &&
3599
+ event.type === "touchend" &&
3600
+ _prevEventType === "touchstart";
3601
+ _prevEventType = event.type;
3569
3602
  var boundingRect = event.currentTarget.getBoundingClientRect();
3570
3603
  var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
3571
3604
  if (!clientX && !clientY) {
@@ -3645,8 +3678,12 @@ var registerTouchInteractions = function (_a) {
3645
3678
  canvas.addEventListener("mousemove", callback);
3646
3679
  canvas.addEventListener("mousedown", callback);
3647
3680
  canvas.addEventListener("mouseup", callback);
3648
- canvas.addEventListener("touchmove", callback);
3649
- canvas.addEventListener("touchstart", callback);
3681
+ canvas.addEventListener("touchmove", callback, {
3682
+ passive: isTouchScrollEnabled,
3683
+ });
3684
+ canvas.addEventListener("touchstart", callback, {
3685
+ passive: isTouchScrollEnabled,
3686
+ });
3650
3687
  canvas.addEventListener("touchend", callback);
3651
3688
  return function () {
3652
3689
  canvas.removeEventListener("mouseover", callback);