Skip to content

Commit

Permalink
chore(): prepare for beta3 and cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ks89 committed Oct 28, 2018
1 parent bd2f088 commit c607844
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion projects/ks89/angular-modal-gallery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ks89/angular-modal-gallery",
"version": "7.0.0-beta.2",
"version": "7.0.0-beta.3",
"description": "Modal image gallery for Angular >=6",
"license": "MIT",
"author": "Stefano Cappa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,40 +162,30 @@ export class CarouselPreviewsComponent extends AccessibleComponent implements On
this.breakpointSubscription = breakpointObserver
.observe([Breakpoints.XSmall, Breakpoints.Small, Breakpoints.Medium, Breakpoints.Large, Breakpoints.XLarge])
.subscribe((result: BreakpointState) => {
console.log('configPreview', this.configPreview);
console.log('previewConfig', this.previewConfig);

if (!this.configPreview) {
return;
}
if (result.breakpoints[Breakpoints.XSmall]) {
console.log('XSmall');
this.updateHeight(this.configPreview.breakpoints.xSmall);
} else if (result.breakpoints[Breakpoints.Small]) {
console.log('Small');
this.updateHeight(this.configPreview.breakpoints.small);
} else if (result.breakpoints[Breakpoints.Medium]) {
console.log('Medium');
this.updateHeight(this.configPreview.breakpoints.medium);
} else if (result.breakpoints[Breakpoints.Large]) {
console.log('Large');
this.updateHeight(this.configPreview.breakpoints.large);
} else if (result.breakpoints[Breakpoints.XLarge]) {
console.log('XLarge');
this.updateHeight(this.configPreview.breakpoints.xLarge);
}
});
}

private updateHeight(configBreakpointHeight: number) {
const newConfigPreview = Object.assign({}, this.configPreview);
console.log('updateHeight this.previewConfig ', this.previewConfig);
if (this.previewConfig && this.previewConfig.maxHeight) {
const heightNum: number = +this.previewConfig.maxHeight.replace('px', '').replace('%', '');
newConfigPreview.maxHeight = Math.min(configBreakpointHeight, heightNum) + 'px';
} else {
const heightNum: number = +this.defaultMaxHeight.replace('px', '').replace('%', '');
console.log('no preview configm but this.configPreview', this.configPreview);
newConfigPreview.maxHeight = Math.min(configBreakpointHeight, heightNum) + 'px';
}
this.configPreview = newConfigPreview;
Expand Down Expand Up @@ -245,25 +235,15 @@ export class CarouselPreviewsComponent extends AccessibleComponent implements On
const isMediumScreen = this.breakpointObserver.isMatched(Breakpoints.Medium);
const isLargeScreen = this.breakpointObserver.isMatched(Breakpoints.Large);
const isxLargeScreen = this.breakpointObserver.isMatched(Breakpoints.XLarge);
console.log('>>>>>>>>>>> ', isXsmallScreen);
console.log('>>>>>>>>>>> ', isSmallScreen);
console.log('>>>>>>>>>>> ', isMediumScreen);
console.log('>>>>>>>>>>> ', isLargeScreen);
console.log('>>>>>>>>>>> ', isxLargeScreen);
if (isXsmallScreen) {
console.log('isXsmallScreen', this.configPreview);
this.updateHeight(this.configPreview.breakpoints.xSmall);
} else if (isSmallScreen) {
console.log('isSmallScreen', this.configPreview);
this.updateHeight(this.configPreview.breakpoints.small);
} else if (isMediumScreen) {
console.log('isMediumScreen', this.configPreview);
this.updateHeight(this.configPreview.breakpoints.medium);
} else if (isLargeScreen) {
console.log('isLargeScreen', this.configPreview);
this.updateHeight(this.configPreview.breakpoints.large);
} else if (isxLargeScreen) {
console.log('isxLargeScreen', this.configPreview);
this.updateHeight(this.configPreview.breakpoints.xLarge);
}
}
Expand Down

0 comments on commit c607844

Please sign in to comment.