All files / src/factories factoryContext.js

100% Statements 21/21
100% Branches 4/4
100% Functions 2/2
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  1x 1x 1x     4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x       2x 2x 2x 2x 2x     1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FactoryContext = void 0;
const factory_1 = require("../models/factory");
class FactoryContext extends factory_1.Factory {
    constructor(engineCanvas, document) {
        super();
        this._document = document;
        this._engineCanvas = engineCanvas;
        this._engineCanvas.style.width = "100%";
        this._engineCanvas.style.height = "100%";
        this._shadowRoot = this._engineCanvas.attachShadow({ mode: 'closed' });
        const container = this._document.createElement('div');
        container.style.width = "100%";
        container.style.height = "100%";
        container.tabIndex = 0;
        this._shadowRoot.innerHTML = "<style>div:focus{outline: none;}</style>";
        this._shadowRoot.appendChild(container);
    }
    create() {
        var _a;
        const canvas = this._document.createElement("canvas");
        canvas.style.position = "absolute";
        canvas.style.pointerEvents = "none";
        (_a = this._shadowRoot.lastChild) === null || _a === void 0 ? void 0 : _a.appendChild(canvas);
        return canvas.getContext("2d");
    }
}
exports.FactoryContext = FactoryContext;