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 1x 4x 4x 4x 2x 1x 1x 1x 1x 1x | import { IFactoryContext } from "./factoryContext.js"; import { ISurfaceSettings } from "../controller/surface/surfaceSettings.js"; import { ISurfaceController, SurfaceController } from "../controller/surface/surfaceController.js"; import { IFactory, Factory } from "../models/factory.js"; import { InvalidOperationException } from "../environment/exceptions.js"; export interface IFactorySurface extends IFactory<ISurfaceController> { create(contextFactory?: IFactoryContext): ISurfaceController; } export class FactorySurface extends Factory<ISurfaceController> implements IFactorySurface { private readonly _window: Window; private readonly _surfaceSettings: ISurfaceSettings; public constructor(surfaceSettings: ISurfaceSettings, window: Window) { super(); this._window = window; this._surfaceSettings = surfaceSettings; } public create(contextFactory?: IFactoryContext): ISurfaceController { if (!contextFactory) { throw new InvalidOperationException("IFactoryContext is needed for creation."); } const surface = new SurfaceController(this._surfaceSettings); const context2d = contextFactory.create(); surface.initialize(context2d, this._window); return surface; } } |