import { AppObjectEntity, getSingletonComponent, MemoizedNumber, } from "@vived/core";
export class FramedScreenEntity extends AppObjectEntity {
}
FramedScreenEntity.type = "FramedScreenEntity";
FramedScreenEntity.get = (appObjects) => getSingletonComponent(FramedScreenEntity.type, appObjects);
export 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 MemoizedNumber(0, this.notifyOnChange);
        this.memoizeHeight = new MemoizedNumber(0, this.notifyOnChange);
        this._containerLookup = new Map();
    }
}
//# sourceMappingURL=FramedScreenEntity.js.map