UNPKG

kitchen-simulator

Version:

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

35 lines (34 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = _default; var _export = require("../class/export"); var _export2 = require("../utils/export"); var _constants = require("../constants"); function _default(state, action) { var saveHistory = function saveHistory() { return state = state.merge({ sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene) }); }; switch (action.type) { case _constants.ADD_LAYER: saveHistory(); return _export.Layer.create(state, action.name, action.altitude).updatedState; case _constants.SELECT_LAYER: saveHistory(); return _export.Layer.select(state, action.layerID).updatedState; case _constants.SET_LAYER_PROPERTIES: saveHistory(); return _export.Layer.setProperties(state, action.layerID, action.properties).updatedState; case _constants.REMOVE_LAYER: saveHistory(); return _export.Layer.remove(state, action.layerID).updatedState; case _constants.UPDATE_MOVING_STATE: return _export.Layer.updateMovingState(state, action.showflag).updatedState; default: return state; } } module.exports = exports.default;