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

ngResizable with not working properly when position has floating values #138

Closed
dioseltorre opened this issue Jan 11, 2019 · 2 comments
Closed

Comments

@dioseltorre
Copy link

dioseltorre commented Jan 11, 2019

Hi,

I used ngDraggable and ngResizable at the same time in our application. The app enables the user to drag and resize elements (div) anywhere inside a div containment and it has a rzMinWidth and rzMinHeight of 40. With this, the position can have a floating values (e.g translate(48.5px, 134.281px)). The problem is when the position became a floating values and resize is performed, it will automatically resize to a given minimum values and you cannot resize it anymore unless you will drag it back to 0, 0 position.

I want to know if this is some kind of a bug.

Thanks.

@sergekk
Copy link

sergekk commented Apr 10, 2019

I run into same problem.

ngDraggable and ngResizable on same element caused problems if bounds input property set
and browser zoom is not 100%.

Reason: getBoundingClientRect may return float values. See details here :
https://stackoverflow.com/questions/40879171/in-javascript-why-does-getboundingclientrect-sometimes-return-floating-point

Suggested fix: in AngularDraggableDirective.boundsCheck round values returned from getBoundingClientRect. For example : this.tempTrans.y -= Math.round(elem.top) - Math.round(boundary.top);

@dioseltorre
Copy link
Author

fixed in this PR #151

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

2 participants