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

resetSize() method not getting height of div correctly

Open canbax opened this issue 4 years ago • 1 comments

Firstly I have to thank you for this useful library.

I have a div like this <div #resizeableDiv="ngResizable" [ngResizable]="isResizeable" [ngClass]="{'draggable-content': isResizeable}">

inside div, there is a button to change the boolean variable isResizeable.

<a href="#" (click)="resetDiv(resizeableDiv)">...</a>

here is resetDiv function

resetDiv(block: AngularResizableDirective) {
    this.isResizeable= !this.isResizeable;
    if (!this.isResizeable) {
      block.resetSize();
    }
}

isResizeable is false by default, so when I click for the second time it will call the function resetSize(). On the first call, it seems like it is OK. But at the second call, it does not resize the div to its original size.

XMlO15XBtQ

When I debug inside resetSize() function I see that _initSize have height:17 which is WRONG!. chrome_ZmYm5bylU0

I have a bunch of ngIf statements inside resizeableDiv I think this might be the reason. I'm not sure how it seems like working at the first call to the function resetSize()

canbax avatar Dec 13 '19 06:12 canbax

For the record, I solved my problem by setting the size of HTML element manually using JS

canbax avatar Feb 14 '20 07:02 canbax