Skip to content

Commit

Permalink
fix: contents-dialog should now resize on objects without toc (#436)
Browse files Browse the repository at this point in the history
Contents dialog now correctly resizes on objects without TOC
  • Loading branch information
jimarthurnilsen authored Dec 7, 2022
1 parent 1439be3 commit 52da246
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ElementRef,
HostListener,
OnDestroy,
OnInit,
OnInit
} from '@angular/core';
import { MediaObserver } from '@angular/flex-layout';
import { MatDialogRef } from '@angular/material/dialog';
Expand All @@ -21,7 +21,7 @@ import { Manifest } from './../core/models/manifest';
selector: 'mime-contents',
templateUrl: './contents-dialog.component.html',
styleUrls: ['./contents-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ContentsDialogComponent implements OnInit, OnDestroy {
public manifest: Manifest | null = null;
Expand Down Expand Up @@ -58,7 +58,6 @@ export class ContentsDialogComponent implements OnInit, OnDestroy {
this.manifest !== null &&
this.manifest.structures !== undefined &&
this.manifest.structures.length > 0;
this.changeDetectorRef.detectChanges();
}
)
);
Expand All @@ -82,19 +81,18 @@ export class ContentsDialogComponent implements OnInit, OnDestroy {
}

private resizeTabHeight(): void {
const dimensions = this.mimeDomHelper.getBoundingClientRect(this.el);
let height = this.mimeHeight;

if (this.mediaObserver.isActive('lt-md')) {
height -= 104;
this.tabHeight = {
maxHeight: window.innerHeight - 128 + 'px',
maxHeight: window.innerHeight - 128 + 'px'
};
} else {
height -= 278;
this.tabHeight = {
maxHeight: height + 'px',
maxHeight: height + 'px'
};
}
this.changeDetectorRef.markForCheck();
}
}

0 comments on commit 52da246

Please sign in to comment.