zooming of image is modified

This commit is contained in:
richard-loafle 2020-02-10 16:08:04 +09:00
parent 17f9af17aa
commit 5512723950
2 changed files with 11 additions and 8 deletions

View File

@ -171,14 +171,7 @@
*ngIf="fileDownloadUrl"
[src]="fileDownloadUrl"
[style.width]="'auto'"
[style.height]="
naturalHeight > imageContainer.clientHeight
? ((imageContainer.clientHeight - 20) / naturalHeight) *
(zoomRatio / 100) *
naturalHeight +
'px'
: naturalHeight + 'px'
"
[style.height]="getImageHeight(imageContainer.clientHeight)"
(load)="onLoadFileDownloadUrl(downloadImage)"
/>
</div>

View File

@ -82,4 +82,14 @@ export class ImageViewerComponent implements OnInit {
this.changeDetectorRef.detectChanges();
}
getImageHeight(containerHeight: number): string {
const realContainerHeight = containerHeight - 20;
const oriHeight =
this.naturalHeight > realContainerHeight
? realContainerHeight
: this.naturalHeight;
return oriHeight * (this.zoomRatio / 100) + 'px';
}
}