import { AppObjectPM } from "@vived/core";
import { LandmarkEntity } from "../Entities/LandmarkEntity";
export class LandmarkSizePM extends AppObjectPM {
    static get(id, appObjects) {
        return appObjects
            .get(id)
            ?.getComponent(LandmarkSizePM.type);
    }
}
LandmarkSizePM.type = "LandmarkSizePM";
export function makeLandmarkSizePM(appObject) {
    return new LandmarkSizePMImp(appObject);
}
class LandmarkSizePMImp extends LandmarkSizePM {
    get landmarkEntity() {
        return this.getCachedLocalComponent(LandmarkEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, LandmarkSizePM.type);
        this.onRepoChange = () => {
            if (!this.landmarkEntity)
                return;
            this.doUpdateView(this.landmarkEntity.size);
        };
        this.dispose = () => {
            super.dispose();
            this.landmarkEntity?.removeChangeObserver(this.onRepoChange);
            this.landmarkEntity?.removeOnDisposeObserver(this.dispose);
        };
        this.landmarkEntity?.addChangeObserver(this.onRepoChange);
        this.onRepoChange();
    }
}
//# sourceMappingURL=LandmarkSizePM.js.map