desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

added positionByTransform option #139

Closed reinert closed 2 years ago

reinert commented 8 years ago

I'm not sure if that will make sense to you, but I'm using your (great!) lib along with some additional logic to make smooth repositioning of cards the same way Google Keep does. It is working great. But to achieve this, all my elements inside the container have left and top zero, and are positioned by the transform property. So I had to add an option to your lib to position the elements on drag end by the transform property instead of top/left properties. This patch doesn't change the default behavior.

reinert commented 8 years ago

Oh! BTW, I'm managing to achieve this https://github.com/desandro/masonry/issues/873

desandro commented 8 years ago

Thanks for this contribution. Rather than adding this code, I think you can achieve the same result by disabling the setLeftTop on dragEnd. See demo http://codepen.io/desandro/pen/83ccea94d5eed8b730a7906b61299898

reinert commented 8 years ago

I had tried this, but the top/left original position of the element is not preserved as you move it many times. You can check it by moving, leaving in another place, and moving again.

franciscolourenco commented 7 years ago

@desandro the codepen doesn't work anymore because of https

franciscolourenco commented 7 years ago

@desandro I'm also interested in this, but @reinert is right. left/top are still being set: https://codepen.io/aristidesfl/pen/GrVddQ

screen shot 2017-02-21 at 16 51 15

franciscolourenco commented 7 years ago

@reinert image dragging is not working in your fork, even without enabling the option https://codepen.io/aristidesfl/pen/KWKqjX

franciscolourenco commented 7 years ago

@reinert same with anchor tags: https://codepen.io/aristidesfl/pen/evYEpj