@rive-app/canvas-lite 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 +1 -1
- package/rive.js +40 -3
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_fallback.wasm +0 -0
package/package.json
CHANGED
package/rive.js
CHANGED
|
@@ -2259,7 +2259,7 @@ Pc();
|
|
|
2259
2259
|
/* 2 */
|
|
2260
2260
|
/***/ ((module) => {
|
|
2261
2261
|
|
|
2262
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.19.
|
|
2262
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.19.4","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_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
2263
2263
|
|
|
2264
2264
|
/***/ }),
|
|
2265
2265
|
/* 3 */
|
|
@@ -2469,7 +2469,40 @@ var registerTouchInteractions = function (_a) {
|
|
|
2469
2469
|
typeof window === "undefined") {
|
|
2470
2470
|
return null;
|
|
2471
2471
|
}
|
|
2472
|
+
/**
|
|
2473
|
+
* After a touchend event, some browsers may fire synthetic mouse events
|
|
2474
|
+
* (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause
|
|
2475
|
+
* any default action (such as scrolling).
|
|
2476
|
+
*
|
|
2477
|
+
* This is done to simulate the behavior of a mouse for applications that do not support
|
|
2478
|
+
* touch events.
|
|
2479
|
+
*
|
|
2480
|
+
* We're keeping track of the previous event to not send the synthetic mouse events if the
|
|
2481
|
+
* touch event was a click (touchstart -> touchend).
|
|
2482
|
+
*
|
|
2483
|
+
* This is only needed when `isTouchScrollEnabled` is false
|
|
2484
|
+
* When true, `preventDefault()` is called which prevents this behaviour.
|
|
2485
|
+
**/
|
|
2486
|
+
var _prevEventType = null;
|
|
2487
|
+
var _syntheticEventsActive = false;
|
|
2472
2488
|
var processEventCallback = function (event) {
|
|
2489
|
+
// Exit early out of all synthetic mouse events
|
|
2490
|
+
// https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers
|
|
2491
|
+
// https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma
|
|
2492
|
+
if (_syntheticEventsActive && event instanceof MouseEvent) {
|
|
2493
|
+
// Synthetic event finished
|
|
2494
|
+
if (event.type == "mouseup") {
|
|
2495
|
+
_syntheticEventsActive = false;
|
|
2496
|
+
}
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
// Test if it's a "touch click". This could cause the browser to send
|
|
2500
|
+
// synthetic mouse events.
|
|
2501
|
+
_syntheticEventsActive =
|
|
2502
|
+
isTouchScrollEnabled &&
|
|
2503
|
+
event.type === "touchend" &&
|
|
2504
|
+
_prevEventType === "touchstart";
|
|
2505
|
+
_prevEventType = event.type;
|
|
2473
2506
|
var boundingRect = event.currentTarget.getBoundingClientRect();
|
|
2474
2507
|
var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
|
|
2475
2508
|
if (!clientX && !clientY) {
|
|
@@ -2549,8 +2582,12 @@ var registerTouchInteractions = function (_a) {
|
|
|
2549
2582
|
canvas.addEventListener("mousemove", callback);
|
|
2550
2583
|
canvas.addEventListener("mousedown", callback);
|
|
2551
2584
|
canvas.addEventListener("mouseup", callback);
|
|
2552
|
-
canvas.addEventListener("touchmove", callback
|
|
2553
|
-
|
|
2585
|
+
canvas.addEventListener("touchmove", callback, {
|
|
2586
|
+
passive: isTouchScrollEnabled,
|
|
2587
|
+
});
|
|
2588
|
+
canvas.addEventListener("touchstart", callback, {
|
|
2589
|
+
passive: isTouchScrollEnabled,
|
|
2590
|
+
});
|
|
2554
2591
|
canvas.addEventListener("touchend", callback);
|
|
2555
2592
|
return function () {
|
|
2556
2593
|
canvas.removeEventListener("mouseover", callback);
|