Spaces:
Running
Running
File size: 613 Bytes
6bcb42f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
const DRAG_UPDATE = 'scratch-gui/asset-drag/DRAG_UPDATE';
const initialState = {
dragging: false,
currentOffset: null,
img: null
};
const reducer = function (state, action) {
if (typeof state === 'undefined') state = initialState;
switch (action.type) {
case DRAG_UPDATE:
return Object.assign({}, state, action.state);
default:
return state;
}
};
const updateAssetDrag = function (state) {
return {
type: DRAG_UPDATE,
state: state
};
};
export {
reducer as default,
initialState as assetDragInitialState,
updateAssetDrag
};
|