@mui/x-internal-gestures
Version:
The core engine of GestureEvents, a modern and robust multi-pointer gesture detection library for JavaScript.
62 lines (60 loc) • 1.76 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MockGoodGesture = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _core = require("../../core");
class MockGoodGesture extends _core.Gesture {
constructor(...args) {
super(...args);
// Define state for the gesture
this.state = {
isDragging: false,
startPosition: {
x: 0,
y: 0
},
currentDistance: 0,
customValue: ''
};
this.isSinglePhase = void 0;
this.eventType = void 0;
this.optionsType = void 0;
this.mutableOptionsType = void 0;
this.mutableStateType = void 0;
// Extra property for coverage
// eslint-disable-next-line class-methods-use-this
this.extra = () => {};
// Add custom properties for testing complex options
this.complexOption = void 0;
this.arrayOption = void 0;
}
resetState() {
this.state = {
isDragging: false,
startPosition: {
x: 0,
y: 0
},
currentDistance: 0,
customValue: ''
};
}
clone(overrides) {
return new MockGoodGesture((0, _extends2.default)({
name: this.name,
preventDefault: this.preventDefault,
stopPropagation: this.stopPropagation,
preventIf: this.preventIf
}, overrides));
}
// Override the updateOptions method to handle our custom properties
updateOptions(options) {
super.updateOptions(options);
this.complexOption = options.complexOption ?? this.complexOption;
this.arrayOption = options.arrayOption ?? this.arrayOption;
}
}
exports.MockGoodGesture = MockGoodGesture;