import { dispatchStateChange } from "../../Dispatcher";
import { UndoRedoEntity } from "../../UndoRedo";
import { OverlayColor } from "../Entities";
export 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;
            dispatchStateChange(this.appObject.appObjectRepo);
        };
        this.redoAction = () => {
            if (!this.overlayColor)
                return;
            this.overlayColor.overlayColor = this.curColor;
            dispatchStateChange(this.appObject.appObjectRepo);
        };
        this.overlayColor = OverlayColor.get(appObject);
        if (!this.overlayColor) {
            appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find Overlay Color Entity");
            return;
        }
        const undoRedo = UndoRedoEntity.get(appObject.appObjectRepo);
        if (!undoRedo) {
            appObject.appObjectRepo.submitWarning("SetOverlayColorUndoRedo", "Unable to find UndoRedoEntity");
            return;
        }
        undoRedo.submitAction(this);
    }
}
//# sourceMappingURL=SetOverlayColorUndoRedo.js.map