"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDragStartListener = makeDragStartListener;
exports.listenDragStart = listenDragStart;
const pointer_1 = require("../pointer");
function makeDragStartListener(listener, _global = false) {
    return (component) => {
        return listenDragStart(component, listener, _global);
    };
}
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, _event);
    };
    $element.addEventListener('dragstart', dragStartListener, _global);
    return () => {
        $element.removeEventListener('dragstart', dragStartListener, _global);
    };
}
//# sourceMappingURL=dragstart.js.map