UNPKG

kitchen-simulator

Version:

It is a kitchen simulator (self-contained micro-frontend).

19 lines 826 B
import { BEGIN_DRAGGING_VERTEX, UPDATE_DRAGGING_VERTEX, END_DRAGGING_VERTEX } from "../constants"; import { history } from "../utils/export"; import { Vertex } from "../class/export"; export default function (state, action) { switch (action.type) { case BEGIN_DRAGGING_VERTEX: return Vertex.beginDraggingVertex(state, action.layerID, action.vertexID, action.x, action.y).updatedState; case UPDATE_DRAGGING_VERTEX: return Vertex.updateDraggingVertex(state, action.x, action.y).updatedState; case END_DRAGGING_VERTEX: // Code that saving the scene history (26 ~ 28) state = state.merge({ sceneHistory: history.historyPush(state.sceneHistory, state.scene) }); return Vertex.endDraggingVertex(state, action.x, action.y).updatedState; default: return state; } }