"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZSpaceViewerScalePM = void 0;
exports.makeZSpaceViewerScalePM = makeZSpaceViewerScalePM;
const core_1 = require("@vived/core");
const ZSpaceEntity_1 = require("../Entities/ZSpaceEntity");
class ZSpaceViewerScalePM extends core_1.AppObjectPM {
}
exports.ZSpaceViewerScalePM = ZSpaceViewerScalePM;
ZSpaceViewerScalePM.type = "ZSpaceViewerScalePM";
ZSpaceViewerScalePM.get = (appObjects) => (0, core_1.getSingletonComponent)(ZSpaceViewerScalePM.type, appObjects);
function makeZSpaceViewerScalePM(appObject) {
    return new ZSpaceViewerScalePMImp(appObject);
}
class ZSpaceViewerScalePMImp extends ZSpaceViewerScalePM {
    get zSpace() {
        return this.getCachedSingleton(ZSpaceEntity_1.ZSpaceEntity.type);
    }
    vmsAreEqual(a, b) {
        return a === b;
    }
    constructor(appObject) {
        super(appObject, ZSpaceViewerScalePM.type);
        this.onZSpaceChange = () => {
            if (!this.zSpace)
                return;
            this.doUpdateView(this.zSpace.viewerScale);
        };
        this.zSpace?.addChangeObserver(this.onZSpaceChange);
        this.onZSpaceChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=ZSpaceViewerScalePM.js.map