ObaidUrRehman / ng-drag-drop

Drag & Drop for Angular - based on HTML5 with no external dependencies. :tada:
MIT License
240 stars 123 forks source link

dragImage - what if I have a spritesheet? #66

Open seiyria opened 7 years ago

seiyria commented 7 years ago

In my case, I use a big spritesheet of images for my drag and drop items. You can move them from one grid to another. If I drag/drop them, the resulting placeholder image is the WHOLE spritesheet - is it possible to make it just the current image (or maybe copy the div that it's in and use that to drag)?

ObaidUrRehman commented 7 years ago

@seiyria I am not sure if I understand your requirement. Are you using the image sprite as dragImage source and want to use one image from it?

btw, you can totally not use the dragImage and the default behaviour would show the ghost image of the dragged image.

seiyria commented 7 years ago

Yeah, it's hard to reproduce but here's a bit better of a desc. In my project, I have a spritesheet that contains all of my assets here.

A screenshot of the ui here: http://i.imgur.com/2TwjMiE.png

Items are added using object-fit and object/position to get it in the right spot.

You can see that each item displays separately. However...

I get the cursor:grabbing attribute but there is nothing under the cursor. Sometimes, there will be a ghost image of the entire spritesheet on the cursor, but not just the individual item here.

Most of the time, there is no drag preview, unfortunately.