angular2-draggable icon indicating copy to clipboard operation
angular2-draggable copied to clipboard

Resize bounds on a draggable element inside a containment is off.

Open aviad123 opened this issue 6 years ago • 10 comments

When adding ngDraggable to a resizable div with a containment, after moving the div the resize bounds are off (goes outside the containment).

aviad123 avatar Aug 20 '18 13:08 aviad123

@aviad123 Thank you for reporting this issue. Dragging div is implemented by CSS transform functions. Resize bounds remain there, but the directive doesn't check the transformed properties. Need to fix this issue.

xieziyu avatar Aug 21 '18 08:08 xieziyu

The same situation for me. Containment doesn't work correct with ngDraggable and ngResizable.

miikkikiikki avatar Sep 05 '18 10:09 miikkikiikki

Is there any timeline as to when this will be fixed?

smaranh avatar Sep 12 '18 20:09 smaranh

@aviad123 @miikkikiikki @smaranh Sorry for the late response. Please try the latest version: [email protected]

xieziyu avatar Sep 14 '18 03:09 xieziyu

@xieziyu Thanks for such a quick fix but I found another issue. Not sure if this is only happening to me. The first time I click on the DragHandle or the Resize handle in the bottom right, the component jumps and tries to snap to the edge of the container inside which it is contained. Any idea why this is? This only happens for draggable if bounds is set and only happens for reSizable if rzContainment is set.

This only happens the first time and after that, it works properly.

I will post a gif soon.

smaranh avatar Sep 15 '18 01:09 smaranh

@xieziyu Here is the gif

jumponclick

smaranh avatar Sep 15 '18 01:09 smaranh

@smaranh I still can't reproduce this issue.

xieziyu avatar Sep 17 '18 02:09 xieziyu

@xieziyu I finally figured out why the jump is happening. If you have the resizable or draggable container with position:absolute it is a problem since it conflicts with the draggable and resizable style which is position:relative. Here is the sample

https://stackblitz.com/edit/angular-cli-esri-map2-qyyzpu?file=src/app/app.component.html

Do you think I should close this issue and create a new one for this?

smaranh avatar Sep 19 '18 22:09 smaranh

@smaranh Thank you, it's very helpful. I will double check it.

I found that the issue came out because your rzContainment element has no position style defined. If you add position: relative or any other non-static style to .title class, the issue should be fixed.

The reason is that the draggable and resizable directives need to calculate the position inside the containment, which requires the containment not static.

xieziyu avatar Sep 20 '18 01:09 xieziyu

Thanks @xieziyu you are a life saver

smaranh avatar Sep 25 '18 14:09 smaranh