core-graphics
Version:
A core library for creating shape-based graphic editors
49 lines (46 loc) • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EditorHistoryEventType = undefined;
exports.isEditorHistoryEvent = isEditorHistoryEvent;
exports.isUpdateHistoryEvent = isUpdateHistoryEvent;
exports.isUndoHistoryEvent = isUndoHistoryEvent;
exports.isRedoHistoryEvent = isRedoHistoryEvent;
exports.updateHistory = updateHistory;
exports.undoHistory = undoHistory;
exports.redoHistory = redoHistory;
var _editorEvents = require("../editor-events");
var EditorHistoryEventType = exports.EditorHistoryEventType = undefined;
(function (EditorHistoryEventType) {
EditorHistoryEventType[EditorHistoryEventType["UpdateHistory"] = 0] = "UpdateHistory";
EditorHistoryEventType[EditorHistoryEventType["Undo"] = 1] = "Undo";
EditorHistoryEventType[EditorHistoryEventType["Redo"] = 2] = "Redo";
})(EditorHistoryEventType || (exports.EditorHistoryEventType = EditorHistoryEventType = {}));
function isEditorHistoryEvent(base) {
return base.type === _editorEvents.EditorEventType.History;
}
function isUpdateHistoryEvent(base) {
return base.subType === EditorHistoryEventType.UpdateHistory;
}
function isUndoHistoryEvent(base) {
return base.subType === EditorHistoryEventType.Undo;
}
function isRedoHistoryEvent(base) {
return base.subType === EditorHistoryEventType.Redo;
}
function evFact(subType, payload) {
return { type: _editorEvents.EditorEventType.History, subType: subType, payload: payload };
}
function noPayloadEvFact(subType) {
return { type: _editorEvents.EditorEventType.History, subType: subType };
}
function updateHistory(value) {
return evFact(EditorHistoryEventType.UpdateHistory, { value: value });
}
function undoHistory() {
return noPayloadEvFact(EditorHistoryEventType.Undo);
}
function redoHistory() {
return noPayloadEvFact(EditorHistoryEventType.Redo);
}