"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateContentSizeUC = void 0;
exports.makeUpdateContentSizeUC = makeUpdateContentSizeUC;
const core_1 = require("@vived/core");
const Dispatcher_1 = require("../../Dispatcher");
const Entity_1 = require("../Entity");
class UpdateContentSizeUC extends core_1.AppObjectUC {
}
exports.UpdateContentSizeUC = UpdateContentSizeUC;
UpdateContentSizeUC.type = "UpdateContentSizeUC";
UpdateContentSizeUC.get = (appObjects) => (0, core_1.getSingletonComponent)(UpdateContentSizeUC.type, appObjects);
function makeUpdateContentSizeUC(appObject) {
    return new UpdateContentSizeUCImp(appObject);
}
class UpdateContentSizeUCImp extends UpdateContentSizeUC {
    get baseApp() {
        return this.getCachedSingleton(Entity_1.BaseAppState.type);
    }
    constructor(appObject) {
        super(appObject, UpdateContentSizeUC.type);
        this.updateContentSize = (size) => {
            if (!this.baseApp) {
                return;
            }
            const newHeight = Math.ceil(size);
            if (newHeight === this.baseApp.slideInfoContentHeight)
                return;
            this.baseApp.slideInfoContentHeight = newHeight;
            (0, Dispatcher_1.dispatchStateChange)(this.appObjects);
        };
    }
}
//# sourceMappingURL=UpdateContentSizeUC.js.map