"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FramedScreenEntity = void 0;
exports.makeFramedScreen = makeFramedScreen;
const core_1 = require("@vived/core");
class FramedScreenEntity extends core_1.AppObjectEntity {
}
exports.FramedScreenEntity = FramedScreenEntity;
FramedScreenEntity.type = "FramedScreenEntity";
FramedScreenEntity.get = (appObjects) => (0, core_1.getSingletonComponent)(FramedScreenEntity.type, appObjects);
function makeFramedScreen(appObject) {
    return new FramedScreenImp(appObject);
}
class FramedScreenImp extends FramedScreenEntity {
    get screenWidth() {
        return this.memoizeWidth.val;
    }
    set screenWidth(val) {
        this.memoizeWidth.val = val;
    }
    get screenHeight() {
        return this.memoizeHeight.val;
    }
    set screenHeight(val) {
        this.memoizeHeight.val = val;
    }
    get containers() {
        return Array.from(this._containerLookup.values());
    }
    addContainer(container) {
        this._containerLookup.set(container.id, container);
        this.notifyOnChange();
    }
    removeContainer(id) {
        const container = this._containerLookup.get(id);
        if (container) {
            this._containerLookup.delete(id);
            this.notifyOnChange();
        }
    }
    hasContainer(id) {
        return this._containerLookup.has(id);
    }
    getContainerByID(id) {
        return this._containerLookup.get(id);
    }
    constructor(appObject) {
        super(appObject, FramedScreenEntity.type);
        this.memoizeWidth = new core_1.MemoizedNumber(0, this.notifyOnChange);
        this.memoizeHeight = new core_1.MemoizedNumber(0, this.notifyOnChange);
        this._containerLookup = new Map();
    }
}
//# sourceMappingURL=FramedScreenEntity.js.map