import { State } from "@intelligentgraphics/ig.gfx.core";
/**
 * Manages the enabled status for postprocessing
 *
 * Postprocessing will be deactivated while gfx updates are in progress
 *
 * @export
 * @class SceneUpdatePostprocessingManager
 */
export class SceneUpdatePostprocessingManager {
    constructor(plannerManager) {
        plannerManager.hooks.sceneUpdateStart.tap("SceneUpdatePostprocessingManager", () => {
            this.togglePostprocessing(false);
        });
        plannerManager.hooks.sceneUpdateDone.tap("SceneUpdatePostprocessingManager", () => {
            this.togglePostprocessing(!plannerManager.hasPendingUpdates() &&
                plannerManager.getSceneStatus() !== "preview");
        });
    }
    togglePostprocessing(enable) {
        State.postprocessingOptions.globalEnable = enable;
        State.API.RedrawScene();
    }
}
