Files
discord-decomp/_bundle/Gesture.js
T
2026-11-01 12:12:55 +02:00

274 lines
7.1 KiB
JavaScript

// Metro module 5312 (f5313).
import _possibleConstructorReturn from "./_possibleConstructorReturn";
import _getPrototypeOf from "./_getPrototypeOf";
import _inherits from "./_inherits";
import _createClass from "./_createClass";
import _classCallCheck from "./_classCallCheck";
import { getNextHandlerTag } from "./Module5294";
import { isRemoteDebuggingEnabled } from "./deepEqual";
let c3209_6, Gesture;
let BaseGesture;
let ContinousBaseGesture;
let env3209 = {};
env3209[5] = function _isNativeReflectConstruct() {
let c14791_0;
try {
c14791_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c14791_0;
};
env3209[5] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
c3209_6 = {
UNDEFINED: 0,
BEGAN: 1,
START: 2,
UPDATE: 3,
CHANGE: 4,
END: 5,
FINALIZE: 6,
TOUCHES_DOWN: 7,
TOUCHES_MOVE: 8,
TOUCHES_UP: 9,
TOUCHES_CANCELLED: 10
};
Gesture = function Gesture() {
_classCallCheck(this, Gesture);
};
const r28 = _createClass(Gesture);
env3209[7] = 0;
BaseGesture = function BaseGesture() {
_classCallCheck(this, BaseGesture);
const r10 = _getPrototypeOf(BaseGesture);
const r21 = _possibleConstructorReturn(this, (0, env3209[5])() ? Reflect.construct(r10, [], _getPrototypeOf(this).constructor) : r10.apply(this, void 0));
r21.gestureId = -1;
r21.handlerTag = -1;
r21.handlerName = "";
r21.config = {};
r21.handlers = {
gestureId: -1,
handlerTag: -1,
isWorklet: []
};
const gestureId = +env3209[7];
env3209[7] = gestureId + 1;
r21.gestureId = gestureId;
r21.handlers.gestureId = r21.gestureId;
return r21;
};
_inherits(BaseGesture, r28);
const r83 = _createClass(BaseGesture, [{
key: "addDependency",
value: function addDependency(a0, a1) {
const r6 = this.config[a0];
this.config[a0] = r6 ? Array().concat(r6, a1) : [a1];
}
}, {
key: "withRef",
value: function withRef(a0) {
this.config.ref = a0;
return this;
}
}, {
key: "isWorklet",
value: function isWorklet(a0) {
return a0.__workletHash !== void 0;
}
}, {
key: "onBegin",
value: function onBegin(a0) {
this.handlers.onBegin = a0;
this.handlers.isWorklet[c3209_6.BEGAN] = this.isWorklet(a0);
return this;
}
}, {
key: "onStart",
value: function onStart(a0) {
this.handlers.onStart = a0;
this.handlers.isWorklet[c3209_6.START] = this.isWorklet(a0);
return this;
}
}, {
key: "onEnd",
value: function onEnd(a0) {
this.handlers.onEnd = a0;
this.handlers.isWorklet[c3209_6.END] = this.isWorklet(a0);
return this;
}
}, {
key: "onFinalize",
value: function onFinalize(a0) {
this.handlers.onFinalize = a0;
this.handlers.isWorklet[c3209_6.FINALIZE] = this.isWorklet(a0);
return this;
}
}, {
key: "onTouchesDown",
value: function onTouchesDown(a0) {
this.config.needsPointerData = true;
this.handlers.onTouchesDown = a0;
this.handlers.isWorklet[c3209_6.TOUCHES_DOWN] = this.isWorklet(a0);
return this;
}
}, {
key: "onTouchesMove",
value: function onTouchesMove(a0) {
this.config.needsPointerData = true;
this.handlers.onTouchesMove = a0;
this.handlers.isWorklet[c3209_6.TOUCHES_MOVE] = this.isWorklet(a0);
return this;
}
}, {
key: "onTouchesUp",
value: function onTouchesUp(a0) {
this.config.needsPointerData = true;
this.handlers.onTouchesUp = a0;
this.handlers.isWorklet[c3209_6.TOUCHES_UP] = this.isWorklet(a0);
return this;
}
}, {
key: "onTouchesCancelled",
value: function onTouchesCancelled(a0) {
this.config.needsPointerData = true;
this.handlers.onTouchesCancelled = a0;
this.handlers.isWorklet[c3209_6.TOUCHES_CANCELLED] = this.isWorklet(a0);
return this;
}
}, {
key: "enabled",
value: function enabled(a0) {
this.config.enabled = a0;
return this;
}
}, {
key: "shouldCancelWhenOutside",
value: function shouldCancelWhenOutside(a0) {
this.config.shouldCancelWhenOutside = a0;
return this;
}
}, {
key: "hitSlop",
value: function hitSlop(a0) {
this.config.hitSlop = a0;
return this;
}
}, {
key: "activeCursor",
value: function activeCursor(a0) {
this.config.activeCursor = a0;
return this;
}
}, {
key: "mouseButton",
value: function mouseButton(a0) {
this.config.mouseButton = a0;
return this;
}
}, {
key: "runOnJS",
value: function runOnJS(a0) {
this.config.runOnJS = a0;
return this;
}
}, {
key: "simultaneousWithExternalGesture",
value: function simultaneousWithExternalGesture() {
for (const item of Array.prototype.slice.call(arguments, 0)) {
if (item) {
this.addDependency("simultaneousWith", item);
}
}
return this;
}
}, {
key: "requireExternalGestureToFail",
value: function requireExternalGestureToFail() {
for (const item of Array.prototype.slice.call(arguments, 0)) {
if (item) {
this.addDependency("requireToFail", item);
}
}
return this;
}
}, {
key: "blocksExternalGesture",
value: function blocksExternalGesture() {
for (const item of Array.prototype.slice.call(arguments, 0)) {
if (item) {
this.addDependency("blocksHandlers", item);
}
}
return this;
}
}, {
key: "withTestId",
value: function withTestId(a0) {
this.config.testId = a0;
return this;
}
}, {
key: "cancelsTouchesInView",
value: function cancelsTouchesInView(a0) {
this.config.cancelsTouchesInView = a0;
return this;
}
}, {
key: "initialize",
value: function initialize() {
this.handlerTag = getNextHandlerTag();
this.handlers = {
...this.handlers,
handlerTag: this.handlerTag
};
if (this.config.ref) {
this.config.ref.current = this;
}
}
}, {
key: "toGestureArray",
value: function toGestureArray() {
return [this];
}
}, {
key: "prepare",
value: function prepare() {}
}, {
key: "shouldUseReanimated",
get: function get() {
return this.config.runOnJS !== true && !this.handlers.isWorklet.includes(false) && !isRemoteDebuggingEnabled();
}
}]);
ContinousBaseGesture = function ContinousBaseGesture() {
_classCallCheck(this, ContinousBaseGesture);
const r8 = _getPrototypeOf(ContinousBaseGesture);
return _possibleConstructorReturn(this, (0, env3209[5])() ? Reflect.construct(r8, arguments, _getPrototypeOf(this).constructor) : r8.apply(this, arguments));
};
_inherits(ContinousBaseGesture, r83);
const r94 = _createClass(ContinousBaseGesture, [{
key: "onUpdate",
value: function onUpdate(a0) {
this.handlers.onUpdate = a0;
this.handlers.isWorklet[c3209_6.UPDATE] = this.isWorklet(a0);
return this;
}
}, {
key: "onChange",
value: function onChange(a0) {
this.handlers.onChange = a0;
this.handlers.isWorklet[c3209_6.CHANGE] = this.isWorklet(a0);
return this;
}
}, {
key: "manualActivation",
value: function manualActivation(a0) {
this.config.manualActivation = a0;
return this;
}
}]);
export { c3209_6 as CALLBACK_TYPE };
export { r28 as Gesture };
export { r83 as BaseGesture };
export { r94 as ContinousBaseGesture };