packery icon indicating copy to clipboard operation
packery copied to clipboard

packery draggabilly: prevent from dropping over a .stamp.non-drop item.

Open jayenne opened this issue 3 years ago • 2 comments

I have a case where I'd like to force an element to always be the first* item where it can not move or be dropped over.

I have tried with stamp but can still drag'n'drop over the stamped item. ideally, it may be nice if 'stamp' could have a non-drop option which prevents any item being dragged fro mdropping over it (on drop, it would revert back to the position from where it was picked up). Whilst draggon over an "non-movable stamped item" the item being dragged would have a class classed that may be styled to visually indicate to the user that this item is within a non-drop zone.

thanks in advance,

jayenne avatar Nov 16 '21 15:11 jayenne

+1 The workaround is to perform layout in dragItemPositioned event if order was not changed, for example:

container.on('dragItemPositioned', function() {
  if (!orderChanged()) {
    setTimeout(function() {
      container.packery('layout');
    }, 16);
    return;
  }
  saveOrder();
});

rawthriver avatar Dec 08 '21 05:12 rawthriver

Using this in addition solves the problem, but I would like some standard solution https://github.com/desandro/draggabilly/issues/177

rawthriver avatar Dec 13 '21 07:12 rawthriver