soiz1's picture
Upload 2891 files
6bcb42f verified
raw
history blame contribute delete
613 Bytes
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
};