Skip to content

Commit

Permalink
Update gutter for aura
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Apr 22, 2024
1 parent 9d9f492 commit 7c47c3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/components/confirmpopup/confirmpopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export class ConfirmPopup implements AfterContentInit, OnDestroy {
if (!this.confirmation) {
return;
}
DomHandler.absolutePosition(this.container, this.confirmation?.target);
DomHandler.absolutePosition(this.container, this.confirmation?.target, false);

const containerOffset = DomHandler.getOffset(this.container);
const targetOffset = DomHandler.getOffset(this.confirmation?.target);
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/dom/domhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class DomHandler {
}
}

public static relativePosition(element: any, target: any): void {
public static relativePosition(element: any, target: any, gutter: boolean = true): void {
const getClosestRelativeElement = (el) => {
if (!el) return;

Expand Down Expand Up @@ -161,9 +161,10 @@ export class DomHandler {

element.style.top = top + 'px';
element.style.left = left + 'px';
gutter && (element.style.marginTop = origin === 'bottom' ? 'calc(var(--p-anchor-gutter) * -1)' : 'calc(var(--p-anchor-gutter))');
}

public static absolutePosition(element: any, target: any): void {
public static absolutePosition(element: any, target: any, gutter: boolean = true): void {
const elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element);
const elementOuterHeight = elementDimensions.height;
const elementOuterWidth = elementDimensions.width;
Expand Down Expand Up @@ -192,6 +193,7 @@ export class DomHandler {

element.style.top = top + 'px';
element.style.left = left + 'px';
gutter && (element.style.marginTop = origin === 'bottom' ? 'calc(var(--p-anchor-gutter) * -1)' : 'calc(var(--p-anchor-gutter))');
}

static getParents(element: any, parents: any = []): any {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/overlaypanel/overlaypanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export class OverlayPanel implements AfterContentInit, OnDestroy {
ZIndexUtils.set('overlay', this.container, this.baseZIndex + this.config.zIndex.overlay);
}

DomHandler.absolutePosition(this.container, this.target);
DomHandler.absolutePosition(this.container, this.target, false);

const containerOffset = DomHandler.getOffset(this.container);
const targetOffset = DomHandler.getOffset(this.target);
Expand Down

0 comments on commit 7c47c3f

Please sign in to comment.