Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mounted() {
const container = document.querySelector('.gallery-container')
this.droppable = new Droppable(container, {
draggable: '.gallery--draggable .gallery-item--selected',
dropzone: '.gallery--dropzone',
delay: 250,
mirror: {
constrainDimensions: true,
xAxis: (this.view == 'grid'),
cursorOffsetX: 50,
cursorOffsetY: 57,
},
})
// Draggable events..
this.droppable.on('drag:start', (evt) => {
this.drag = evt.originalSource.dataset.draggable
this.drop = false
})
export default function PluginsCollidable() {
const containerSelector = '#Collidable .BlockLayout';
const containers = document.querySelectorAll(containerSelector);
const wallClass = 'CollidableWall';
const walls = document.querySelectorAll(`.${wallClass}`);
if (containers.length === 0) {
return false;
}
const droppable = new Droppable(containers, {
draggable: '.Block--isDraggable',
dropzone: '.BlockWrapper--isDropzone',
collidables: '.CollidableObstacle',
mirror: {
appendTo: containerSelector,
constrainDimensions: true,
},
plugins: [Plugins.Collidable],
});
// --- Draggable events --- //
droppable.on('collidable:in', ({collidingElement}) => {
if (collidingElement.classList.contains(wallClass)) {
walls.forEach((wall) => wall.classList.add('isColliding'));
} else {
collidingElement.classList.add('isColliding');
export default function UniqueDropzone() {
const containers = document.querySelectorAll('#UniqueDropzone .BlockLayout');
if (containers.length === 0) {
return false;
}
const droppable = new Droppable(containers, {
draggable: '.Block--isDraggable',
dropzone: '.BlockWrapper--isDropzone',
mirror: {
constrainDimensions: true,
},
});
let droppableOrigin;
// --- Draggable events --- //
droppable.on('drag:start', (evt) => {
droppableOrigin = evt.originalSource.parentNode.dataset.dropzone;
});
droppable.on('droppable:dropped', (evt) => {
if (droppableOrigin !== evt.dropzone.dataset.dropzone) {
if (classes) {
options.classes = classes;
}
if (appendTo) {
options.appendTo = appendTo;
}
options = _.assign({}, options, {
delay,
sensors,
plugins,
});
if (this.ownInstance) {
switch (draggableType) {
case 'droppable':
this.draggableInstance = new Droppable(this.ownInstance, options);
break;
case 'swappable':
this.draggableInstance = new Swappable(this.ownInstance, options);
break;
case 'sortable':
this.draggableInstance = new Sortable(this.ownInstance, options);
break;
case 'draggable':
default:
this.draggableInstance = new Draggable(this.ownInstance, options);
break;
}
}
}