Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aviad123 opened this issue Aug 20, 2018 · 10 comments
Open

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

aviad123 opened this issue Aug 20, 2018 · 10 comments

Comments

@aviad123
Copy link

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

@xieziyu
Copy link
Owner

xieziyu commented Aug 21, 2018

@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.

@miikkikiikki
Copy link

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

@smaranh
Copy link

smaranh commented Sep 12, 2018

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

xieziyu pushed a commit that referenced this issue Sep 14, 2018
Bugfix: issue #100
@xieziyu
Copy link
Owner

xieziyu commented Sep 14, 2018

@aviad123 @miikkikiikki @smaranh
Sorry for the late response. Please try the latest version: angular2-draggable@2.1.4

@smaranh
Copy link

smaranh commented Sep 15, 2018

@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
Copy link

smaranh commented Sep 15, 2018

@xieziyu Here is the gif

jumponclick

@xieziyu
Copy link
Owner

xieziyu commented Sep 17, 2018

@smaranh
I still can't reproduce this issue.

@smaranh
Copy link

smaranh commented Sep 19, 2018

@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?

@xieziyu
Copy link
Owner

xieziyu commented Sep 20, 2018

@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.

@smaranh
Copy link

smaranh commented Sep 25, 2018

Thanks @xieziyu you are a life saver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants