@rive-app/webgl 2.19.3 → 2.19.5

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.19.3",
3
+ "version": "2.19.5",
4
4
  "description": "Rive's webgl based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.js CHANGED
@@ -400,7 +400,7 @@ function Qa(a, b) {
400
400
  return Pa(c, a, b);
401
401
  }));
402
402
  }
403
- var Ra, Sa, Wa = {688588:(a, b, c, d, e) => {
403
+ var Ra, Sa, Wa = {689596:(a, b, c, d, e) => {
404
404
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
405
405
  return 0;
406
406
  }
@@ -463,9 +463,9 @@ var Ra, Sa, Wa = {688588:(a, b, c, d, e) => {
463
463
  }
464
464
  window.h.Ea += 1;
465
465
  return 1;
466
- }, 690766:() => {
466
+ }, 691774:() => {
467
467
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
468
- }, 690930:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 691034:() => {
468
+ }, 691938:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 692042:() => {
469
469
  try {
470
470
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
471
471
  a.close();
@@ -473,7 +473,7 @@ var Ra, Sa, Wa = {688588:(a, b, c, d, e) => {
473
473
  } catch (c) {
474
474
  return 0;
475
475
  }
476
- }, 691205:(a, b, c, d, e, f) => {
476
+ }, 692213:(a, b, c, d, e, f) => {
477
477
  if ("undefined" === typeof window.h) {
478
478
  return -1;
479
479
  }
@@ -519,7 +519,7 @@ var Ra, Sa, Wa = {688588:(a, b, c, d, e) => {
519
519
  a == window.h.H.Ca && g.X.connect(g.I.destination);
520
520
  g.lb = f;
521
521
  return window.h.nc(g);
522
- }, 694082:a => window.h.ta(a).I.sampleRate, 694155:a => {
522
+ }, 695090:a => window.h.ta(a).I.sampleRate, 695163:a => {
523
523
  a = window.h.ta(a);
524
524
  void 0 !== a.X && (a.X.onaudioprocess = function() {
525
525
  }, a.X.disconnect(), a.X = void 0);
@@ -527,13 +527,13 @@ var Ra, Sa, Wa = {688588:(a, b, c, d, e) => {
527
527
  a.I.close();
528
528
  a.I = void 0;
529
529
  a.lb = void 0;
530
- }, 694555:a => {
530
+ }, 695563:a => {
531
531
  window.h.xb(a);
532
- }, 694605:a => {
532
+ }, 695613:a => {
533
533
  a = window.h.ta(a);
534
534
  a.I.resume();
535
535
  a.state = window.h.ha.sb;
536
- }, 694744:a => {
536
+ }, 695752:a => {
537
537
  a = window.h.ta(a);
538
538
  a.I.suspend();
539
539
  a.state = window.h.ha.stopped;
@@ -4053,7 +4053,7 @@ Ie();
4053
4053
  /* 2 */
4054
4054
  /***/ ((module) => {
4055
4055
 
4056
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.19.3","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}}');
4056
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.19.5","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}}');
4057
4057
 
4058
4058
  /***/ }),
4059
4059
  /* 3 */
@@ -4263,7 +4263,40 @@ var registerTouchInteractions = function (_a) {
4263
4263
  typeof window === "undefined") {
4264
4264
  return null;
4265
4265
  }
4266
+ /**
4267
+ * After a touchend event, some browsers may fire synthetic mouse events
4268
+ * (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause
4269
+ * any default action (such as scrolling).
4270
+ *
4271
+ * This is done to simulate the behavior of a mouse for applications that do not support
4272
+ * touch events.
4273
+ *
4274
+ * We're keeping track of the previous event to not send the synthetic mouse events if the
4275
+ * touch event was a click (touchstart -> touchend).
4276
+ *
4277
+ * This is only needed when `isTouchScrollEnabled` is false
4278
+ * When true, `preventDefault()` is called which prevents this behaviour.
4279
+ **/
4280
+ var _prevEventType = null;
4281
+ var _syntheticEventsActive = false;
4266
4282
  var processEventCallback = function (event) {
4283
+ // Exit early out of all synthetic mouse events
4284
+ // https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers
4285
+ // https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma
4286
+ if (_syntheticEventsActive && event instanceof MouseEvent) {
4287
+ // Synthetic event finished
4288
+ if (event.type == "mouseup") {
4289
+ _syntheticEventsActive = false;
4290
+ }
4291
+ return;
4292
+ }
4293
+ // Test if it's a "touch click". This could cause the browser to send
4294
+ // synthetic mouse events.
4295
+ _syntheticEventsActive =
4296
+ isTouchScrollEnabled &&
4297
+ event.type === "touchend" &&
4298
+ _prevEventType === "touchstart";
4299
+ _prevEventType = event.type;
4267
4300
  var boundingRect = event.currentTarget.getBoundingClientRect();
4268
4301
  var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
4269
4302
  if (!clientX && !clientY) {
@@ -4343,8 +4376,12 @@ var registerTouchInteractions = function (_a) {
4343
4376
  canvas.addEventListener("mousemove", callback);
4344
4377
  canvas.addEventListener("mousedown", callback);
4345
4378
  canvas.addEventListener("mouseup", callback);
4346
- canvas.addEventListener("touchmove", callback);
4347
- canvas.addEventListener("touchstart", callback);
4379
+ canvas.addEventListener("touchmove", callback, {
4380
+ passive: isTouchScrollEnabled,
4381
+ });
4382
+ canvas.addEventListener("touchstart", callback, {
4383
+ passive: isTouchScrollEnabled,
4384
+ });
4348
4385
  canvas.addEventListener("touchend", callback);
4349
4386
  return function () {
4350
4387
  canvas.removeEventListener("mouseover", callback);