CirclonGroup / angular-tree-component

A simple yet powerful tree component for Angular (>=2)
https://angular2-tree.readme.io/docs
MIT License
1.1k stars 492 forks source link

Change cursor for drag and drop #774

Closed mutzl closed 4 years ago

mutzl commented 4 years ago

How can I change the cursor while dragging a node?

The default looks like in the screenshot (with a small rectangle below), but I need to change that to a cursor with a plus sign for a copy operation.

image

mutzl commented 4 years ago

Finally solved it.

    allowDrop: (node, { parent, index }, $event?: any) => {
      if ($event.ctrlKey) {
        $event.dataTransfer.dropEffect = 'copy';
      } else if ($event.shiftKey) {
        $event.dataTransfer.dropEffect = 'link';
      } else {
        $event.dataTransfer.dropEffect = 'move';
      }

      const canMoveCopyLink = true;  // optional logic
      return canMoveCopyLink;
    },