"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.listenDragStart = exports.makeDragStartListener = void 0;
const pointer_1 = require("../pointer");
function makeDragStartListener(listener, _global = false) {
    return (component) => {
        return listenDragStart(component, listener, _global);
    };
}
exports.makeDragStartListener = makeDragStartListener;
function listenDragStart(component, listener, _global = false) {
    const { $element } = component;
    const dragStartListener = (_event) => {
        const { $context } = component;
        const event = (0, pointer_1.applyContextTransformToPointerEvent)($context, _event);
        listener(event);
    };
    $element.addEventListener('dragstart', dragStartListener, _global);
    return () => {
        $element.removeEventListener('dragstart', dragStartListener, _global);
    };
}
exports.listenDragStart = listenDragStart;
//# sourceMappingURL=dragstart.js.map