Skip to content

Commit

Permalink
feat: add top and left to Dialog resize event detail (#8064)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCardoso authored Oct 31, 2024
1 parent 8cdf914 commit c322567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/dialog/src/vaadin-dialog-resizable-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const DialogResizableMixin = (superClass) =>
*/
_getResizeDimensions() {
const scrollPosition = this.$.overlay.$.resizerContainer.scrollTop;
const { width, height } = getComputedStyle(this.$.overlay.$.overlay);
const { width, height, top, left } = getComputedStyle(this.$.overlay.$.overlay);
const content = this.$.overlay.$.content;
content.setAttribute(
'style',
Expand All @@ -158,7 +158,7 @@ export const DialogResizableMixin = (superClass) =>
const { width: contentWidth, height: contentHeight } = getComputedStyle(content);
content.removeAttribute('style');
this.$.overlay.$.resizerContainer.scrollTop = scrollPosition;
return { width, height, contentWidth, contentHeight };
return { width, height, contentWidth, contentHeight, top, left };
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/dialog/src/vaadin-dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export type DialogResizeDimensions = {
height: string;
contentWidth: string;
contentHeight: string;
top: string;
left: string;
};

export type DialogPosition = {
Expand Down
2 changes: 2 additions & 0 deletions packages/dialog/test/draggable-resizable.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ describe('resizable', () => {
expect(onResize.calledOnce).to.be.true;
expect(Math.floor(resizedBounds.width)).to.be.eql(parseInt(detail.width));
expect(Math.floor(resizedBounds.height)).to.be.eql(parseInt(detail.height));
expect(Math.floor(resizedBounds.left)).to.be.eql(parseInt(detail.left));
expect(Math.floor(resizedBounds.top)).to.be.eql(parseInt(detail.top));
expect(parseInt(detail.contentWidth)).to.be.eql(parseInt(contentStyles.width));
expect(parseInt(detail.contentHeight)).to.be.eql(parseInt(contentStyles.height) - verticalPadding);
});
Expand Down

0 comments on commit c322567

Please sign in to comment.