UNPKG

@gorpacrate/core-graphics

Version:

A core library for creating shape-based graphic editors

44 lines 1.78 kB
"use strict"; exports.__esModule = true; var editor_events_1 = require("../editor-events"); var EditorHistoryEventType; (function (EditorHistoryEventType) { EditorHistoryEventType[EditorHistoryEventType["UpdateHistory"] = 0] = "UpdateHistory"; EditorHistoryEventType[EditorHistoryEventType["Undo"] = 1] = "Undo"; EditorHistoryEventType[EditorHistoryEventType["Redo"] = 2] = "Redo"; })(EditorHistoryEventType = exports.EditorHistoryEventType || (exports.EditorHistoryEventType = {})); function isEditorHistoryEvent(base) { return (base.type === editor_events_1.EditorEventType.History); } exports.isEditorHistoryEvent = isEditorHistoryEvent; function isUpdateHistoryEvent(base) { return (base.subType === EditorHistoryEventType.UpdateHistory); } exports.isUpdateHistoryEvent = isUpdateHistoryEvent; function isUndoHistoryEvent(base) { return (base.subType === EditorHistoryEventType.Undo); } exports.isUndoHistoryEvent = isUndoHistoryEvent; function isRedoHistoryEvent(base) { return (base.subType === EditorHistoryEventType.Redo); } exports.isRedoHistoryEvent = isRedoHistoryEvent; function evFact(subType, payload) { return { type: editor_events_1.EditorEventType.History, subType: subType, payload: payload }; } function noPayloadEvFact(subType) { return { type: editor_events_1.EditorEventType.History, subType: subType }; } function updateHistory(value) { return evFact(EditorHistoryEventType.UpdateHistory, { value: value }); } exports.updateHistory = updateHistory; function undoHistory() { return noPayloadEvFact(EditorHistoryEventType.Undo); } exports.undoHistory = undoHistory; function redoHistory() { return noPayloadEvFact(EditorHistoryEventType.Redo); } exports.redoHistory = redoHistory; //# sourceMappingURL=history.js.map