reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
299 stars 118 forks source link

How to conditionally allow drop based on direction of drag #55

Closed stherrienaspnet closed 2 years ago

stherrienaspnet commented 5 years ago

Hello I'm using the the dragdrop feature in horizontal context. How could I disable drop on left direction? I'm looking a way to do as material design drag drop cdk. My use case is the following: user need to drop a single controller module index 0 and add expansion module after. He can change expansion module order but not controller module. Just to clarify my case... Let say I have a list of 4 items horizontally, I pick second item and want to display dropplaceholder when I drag to the right direction and hide dropplaceholder when I drag to the left. Any idea how to achieve this? Thanks for your help :)

reppners commented 5 years ago

Hi

that's quite a specific requirement but should be doable by inspecting the coordinates on the drop zone dndDragover events which enables to calculate the direction and then disabling the dropzone accordingly by updating a bool value bound to dndDisableIf.

reppners commented 2 years ago

Closing because of inactivity and possible implementation on application level by using the available events and coordinates.