vue-drag-resize
Version:
Vue Component for resize and drag elements
111 lines (96 loc) • 2.6 kB
JavaScript
import {
ENABLE_ACTIVE,
DISABLE_ACTIVE,
ENABLE_ASPECT,
DISABLE_ASPECT,
ENABLE_DRAGGABLE,
DISABLE_DRAGGABLE,
ENABLE_RESIZABLE,
DISABLE_RESIZABLE,
ENABLE_PARENT_LIMITATION,
DISABLE_PARENT_LIMITATION,
ENABLE_SNAP_TO_GRID,
DISABLE_SNAP_TO_GRID,
CHANGE_ZINDEX,
ENABLE_BOTH_AXIS,
ENABLE_X_AXIS,
ENABLE_Y_AXIS,
ENABLE_NONE_AXIS,
CHANGE_HEIGHT,
CHANGE_LEFT,
CHANGE_MINH,
CHANGE_MINW,
CHANGE_TOP,
CHANGE_WIDTH
} from './mutation-types';
export default {
[ ](state, id) {
state.rects[id].active = true;
},
[ ](state, id) {
state.rects[id].active = false;
},
[ ](state, id) {
state.rects[id].aspectRatio = true;
},
[ ](state, id) {
state.rects[id].aspectRatio = false;
},
[ ](state, id) {
state.rects[id].draggable = true;
},
[ ](state, id) {
state.rects[id].draggable = false;
},
[ ](state, id) {
state.rects[id].resizable = true;
},
[ ](state, id) {
state.rects[id].resizable = false;
},
[ ](state, id) {
state.rects[id].snapToGrid = true;
},
[ ](state, id) {
state.rects[id].snapToGrid = false;
},
[ ](state, id) {
state.rects[id].axis = 'both';
},
[ ](state, id) {
state.rects[id].axis = 'none';
},
[ ](state, id) {
state.rects[id].axis = 'x';
},
[ ](state, id) {
state.rects[id].axis = 'y';
},
[ ](state, id) {
state.rects[id].parentLim = true;
},
[ ](state, id) {
state.rects[id].parentLim = false;
},
[ ](state, payload) {
state.rects[payload.id].zIndex = payload.zIndex;
},
[ ](state, payload) {
state.rects[payload.id].height = payload.height;
},
[ ](state, payload) {
state.rects[payload.id].width = payload.width;
},
[ ](state, payload) {
state.rects[payload.id].top = payload.top;
},
[ ](state, payload) {
state.rects[payload.id].left = payload.left;
},
[ ](state, payload) {
state.rects[payload.id].minh = payload.minh;
},
[ ](state, payload) {
state.rects[payload.id].minw = payload.minw;
}
};