motion-v
Version:
<h1 align="center"> <img width="35" height="35" alt="Motion logo" src="https://github.com/user-attachments/assets/00d6d1c3-72c4-4c2f-a664-69da13182ffc" /><br />Motion for Vue</h1>
23 lines (22 loc) • 705 B
JavaScript
import { Feature } from "../../feature.mjs";
import { VisualElementDragControls } from "./VisualElementDragControls.mjs";
import { noop } from "motion-utils";
var DragGesture = class extends Feature {
static #_ = this.key = "drag";
constructor(state) {
super(state);
this.removeGroupControls = noop;
this.removeListeners = noop;
this.controls = new VisualElementDragControls(state);
}
mount() {
const { dragControls } = this.state.options;
if (dragControls) this.removeGroupControls = dragControls.subscribe(this.controls);
this.removeListeners = this.controls.addListeners() || noop;
}
unmount() {
this.removeGroupControls();
this.removeListeners();
}
};
export { DragGesture };