zooming of image is modified
This commit is contained in:
parent
17f9af17aa
commit
5512723950
|
@ -171,14 +171,7 @@
|
||||||
*ngIf="fileDownloadUrl"
|
*ngIf="fileDownloadUrl"
|
||||||
[src]="fileDownloadUrl"
|
[src]="fileDownloadUrl"
|
||||||
[style.width]="'auto'"
|
[style.width]="'auto'"
|
||||||
[style.height]="
|
[style.height]="getImageHeight(imageContainer.clientHeight)"
|
||||||
naturalHeight > imageContainer.clientHeight
|
|
||||||
? ((imageContainer.clientHeight - 20) / naturalHeight) *
|
|
||||||
(zoomRatio / 100) *
|
|
||||||
naturalHeight +
|
|
||||||
'px'
|
|
||||||
: naturalHeight + 'px'
|
|
||||||
"
|
|
||||||
(load)="onLoadFileDownloadUrl(downloadImage)"
|
(load)="onLoadFileDownloadUrl(downloadImage)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -82,4 +82,14 @@ export class ImageViewerComponent implements OnInit {
|
||||||
|
|
||||||
this.changeDetectorRef.detectChanges();
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user