Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
fix(directive): open viewer in fullscreen on desktop
Browse files Browse the repository at this point in the history
- set necessary css variables in viewer-modal
- remove styles from componentes
  • Loading branch information
SimonGolms committed Jan 15, 2020
1 parent b162aad commit 6e078b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ import { ViewerModalComponent } from './viewer-modal/viewer-modal.component';
@Component({
selector: 'ion-img-viewer',
templateUrl: './ngx-ionic-image-viewer.component.html',
styles: [
`
.modal-fullscreen {
--border-radius: 0;
border-radius: 0;
}
.modal-fullscreen .modal-wrapper {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
}
`
],
encapsulation: ViewEncapsulation.None
})
export class NgxIonicImageViewerComponent implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ export class ViewerModalComponent implements OnInit {
ngOnInit() {
this.options = { ...this.defaultSlideOptions, ...this.slideOptions };
this.src = this.srcHighRes || this.src;
this.setStyle();
this.setScheme(this.scheme);

this.slides.update();
}

setStyle() {
const el: HTMLElement = document.querySelector('.modal-fullscreen');
el.style.setProperty('--height', '100%');
el.style.setProperty('--width', '100%');
el.style.setProperty('--border-radius', '0');
}

setScheme(scheme: string) {
if (scheme === 'auto') {
return;
Expand Down

0 comments on commit 6e078b9

Please sign in to comment.