I know this package is discontinued, but I really like it because it's so lightweight (eg. no dependencies to @angular/material which I don't use). However, there's one piece of information I was missing, and that was how to change the cursor while dragging when the Ctrl-key is pressed/released. I found the solution, and maybe this little bit of information could be included in the documentation ?
I tested in Chrome & Edge.
I'm submitting a ...
[ ] bug report
[ ] feature request
[x ] other : request for additional information how to change the cursor while dragging and Ctrl-key is pressed
What is the current behavior?
When you drag a draggable element, the cursor is set to "move". When you press the Ctrl-key, it doesn't change to "copy".
But that's easily done :
On the draggable element, in the html, bind to the (OnDragStart), (OnDragOver) and (OnDragLeave) events (e.g. (onDragStart) = "onItemDragStart($event)" (onDragOver)="onItemDragOver($event)" (onDragLeave)="onItemDragLeave($event))
@WineBewes I am amazed as to how many downloads this package gets, even after 3 years since I deprecated this.
Would you mind sending a PR with the proposed changes?
I know this package is discontinued, but I really like it because it's so lightweight (eg. no dependencies to @angular/material which I don't use). However, there's one piece of information I was missing, and that was how to change the cursor while dragging when the Ctrl-key is pressed/released. I found the solution, and maybe this little bit of information could be included in the documentation ? I tested in Chrome & Edge.
I'm submitting a ... [ ] bug report [ ] feature request [x ] other : request for additional information how to change the cursor while dragging and Ctrl-key is pressed
What is the current behavior? When you drag a draggable element, the cursor is set to "move". When you press the Ctrl-key, it doesn't change to "copy". But that's easily done :
On the draggable element, in the html, bind to the (OnDragStart), (OnDragOver) and (OnDragLeave) events (e.g. (onDragStart) = "onItemDragStart($event)" (onDragOver)="onItemDragOver($event)" (onDragLeave)="onItemDragLeave($event))
In the component.ts file, add the following :
onItemDragStart(event) { event.dataTransfer.dropEffect = event.ctrlKey ? 'copy' : 'move'; } onItemDragOver(event) { event.dataTransfer.dropEffect = event.ctrlKey ? 'copy' : 'move'; } onItemDragLeave(event) { event.dataTransfer.dropEffect = event.ctrlKey ? 'copy' : 'move'; }
This will change the cursor when you press/release the ctrl-key.
I don't find this information in the documentation. Perhaps you can add it ?
What is the expected behavior? Have the information above in the documentation
Please tell us about your environment:
Angular version: 9.1.1
Angular CLI Version: 9.1.0
Browser: Chrome 87.0.4280.88, Edge 87.0.664.66