@rive-app/webgl2 2.19.3 → 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/package.json
CHANGED
package/rive.js
CHANGED
|
@@ -3520,7 +3520,7 @@ Yd();
|
|
|
3520
3520
|
/* 2 */
|
|
3521
3521
|
/***/ ((module) => {
|
|
3522
3522
|
|
|
3523
|
-
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.19.
|
|
3523
|
+
module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.19.4","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3524
3524
|
|
|
3525
3525
|
/***/ }),
|
|
3526
3526
|
/* 3 */
|
|
@@ -3730,7 +3730,40 @@ var registerTouchInteractions = function (_a) {
|
|
|
3730
3730
|
typeof window === "undefined") {
|
|
3731
3731
|
return null;
|
|
3732
3732
|
}
|
|
3733
|
+
/**
|
|
3734
|
+
* After a touchend event, some browsers may fire synthetic mouse events
|
|
3735
|
+
* (mouseover, mousedown, mousemove, mouseup) if the touch interaction did not cause
|
|
3736
|
+
* any default action (such as scrolling).
|
|
3737
|
+
*
|
|
3738
|
+
* This is done to simulate the behavior of a mouse for applications that do not support
|
|
3739
|
+
* touch events.
|
|
3740
|
+
*
|
|
3741
|
+
* We're keeping track of the previous event to not send the synthetic mouse events if the
|
|
3742
|
+
* touch event was a click (touchstart -> touchend).
|
|
3743
|
+
*
|
|
3744
|
+
* This is only needed when `isTouchScrollEnabled` is false
|
|
3745
|
+
* When true, `preventDefault()` is called which prevents this behaviour.
|
|
3746
|
+
**/
|
|
3747
|
+
var _prevEventType = null;
|
|
3748
|
+
var _syntheticEventsActive = false;
|
|
3733
3749
|
var processEventCallback = function (event) {
|
|
3750
|
+
// Exit early out of all synthetic mouse events
|
|
3751
|
+
// https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers
|
|
3752
|
+
// https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma
|
|
3753
|
+
if (_syntheticEventsActive && event instanceof MouseEvent) {
|
|
3754
|
+
// Synthetic event finished
|
|
3755
|
+
if (event.type == "mouseup") {
|
|
3756
|
+
_syntheticEventsActive = false;
|
|
3757
|
+
}
|
|
3758
|
+
return;
|
|
3759
|
+
}
|
|
3760
|
+
// Test if it's a "touch click". This could cause the browser to send
|
|
3761
|
+
// synthetic mouse events.
|
|
3762
|
+
_syntheticEventsActive =
|
|
3763
|
+
isTouchScrollEnabled &&
|
|
3764
|
+
event.type === "touchend" &&
|
|
3765
|
+
_prevEventType === "touchstart";
|
|
3766
|
+
_prevEventType = event.type;
|
|
3734
3767
|
var boundingRect = event.currentTarget.getBoundingClientRect();
|
|
3735
3768
|
var _a = getClientCoordinates(event, isTouchScrollEnabled), clientX = _a.clientX, clientY = _a.clientY;
|
|
3736
3769
|
if (!clientX && !clientY) {
|
|
@@ -3810,8 +3843,12 @@ var registerTouchInteractions = function (_a) {
|
|
|
3810
3843
|
canvas.addEventListener("mousemove", callback);
|
|
3811
3844
|
canvas.addEventListener("mousedown", callback);
|
|
3812
3845
|
canvas.addEventListener("mouseup", callback);
|
|
3813
|
-
canvas.addEventListener("touchmove", callback
|
|
3814
|
-
|
|
3846
|
+
canvas.addEventListener("touchmove", callback, {
|
|
3847
|
+
passive: isTouchScrollEnabled,
|
|
3848
|
+
});
|
|
3849
|
+
canvas.addEventListener("touchstart", callback, {
|
|
3850
|
+
passive: isTouchScrollEnabled,
|
|
3851
|
+
});
|
|
3815
3852
|
canvas.addEventListener("touchend", callback);
|
|
3816
3853
|
return function () {
|
|
3817
3854
|
canvas.removeEventListener("mouseover", callback);
|