"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetOverlayColorUndoRedo = void 0;
const Dispatcher_1 = require("../../Dispatcher");
const UndoRedo_1 = require("../../UndoRedo");
const Entities_1 = require("../Entities");
class SetOverlayColorUndoRedo {
    constructor(prevColor, curColor, appObject) {
        this.prevColor = prevColor;
        this.curColor = curColor;
        this.appObject = appObject;
        this.undoAction = () => {
            if (!this.overlayColor)
                return;
            this.overlayColor.overlayColor = this.prevColor;
            (0, Dispatcher_1.dispatchStateChange)(this.appObject.appObjectRepo);
        };
        this.redoAction = () => {
            if (!this.overlayColor)
                return;
            this.overlayColor.overlayColor = this.curColor;
            (0, Dispatcher_1.dispatchStateChange)(this.appObject.appObjectRepo);
        };
        this.overlayColor = Entities_1.OverlayColor.get(appObject);
        if (!this.overlayColor) {
            appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find Overlay Color Entity");
            return;
        }
        const undoRedo = UndoRedo_1.UndoRedoEntity.get(appObject.appObjectRepo);
        if (!undoRedo) {
            appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find UndoRedoEntity");
            return;
        }
        undoRedo.submitAction(this);
    }
}
exports.SetOverlayColorUndoRedo = SetOverlayColorUndoRedo;
//# sourceMappingURL=SetOverlayColorUndoRedo.js.map