@mui/x-internal-gestures
Version:
The core engine of GestureEvents, a modern and robust multi-pointer gesture detection library for JavaScript.
54 lines (53 loc) • 1.48 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { Gesture } from "../../core/index.js";
export class MockGoodGesture extends 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(_extends({
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;
}
}