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