All files / src/factories factorySurface.js

100% Statements 15/15
100% Branches 2/2
100% Functions 2/2
100% Lines 15/15

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  1x 1x 1x 1x 1x     4x 4x 4x     2x 1x   1x 1x 1x 1x     1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FactorySurface = void 0;
const surfaceController_1 = require("../controller/surface/surfaceController");
const factory_1 = require("../models/factory");
const exceptions_1 = require("../environment/exceptions");
class FactorySurface extends factory_1.Factory {
    constructor(surfaceSettings, window) {
        super();
        this._window = window;
        this._surfaceSettings = surfaceSettings;
    }
    create(contextFactory) {
        if (!contextFactory) {
            throw new exceptions_1.InvalidOperationException("IFactoryContext is needed for creation.");
        }
        const surface = new surfaceController_1.SurfaceController(this._surfaceSettings);
        const context2d = contextFactory.create();
        surface.initialize(context2d, this._window);
        return surface;
    }
}
exports.FactorySurface = FactorySurface;