"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const _ids_1 = require("../../../../_ids");
class SetPointerCapture extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['element', 'pointerId'],
            fo: [],
            i: [],
            o: [],
        }, {
            input: {
                element: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_SET_POINTER_CAPTURE);
        this._capturing = false;
        this._element = null;
    }
    f({ element, pointerId }) {
        if (!this._capturing) {
            this._capturing = true;
            this._pointerId = pointerId;
            this._element = element;
            element.emit('call', {
                method: 'setPointerCapture',
                data: [pointerId],
            });
        }
    }
    d() {
        if (this._capturing) {
            const pointerId = this._pointerId;
            this._done();
            this._element.emit('call', {
                method: 'releasePointerCapture',
                data: [pointerId],
            });
            this._capturing = false;
            this._pointerId = undefined;
            this._element = null;
        }
    }
}
exports.default = SetPointerCapture;
//# sourceMappingURL=index.js.map