diff --git a/projects/systelab-components/package.json b/projects/systelab-components/package.json index cb9d200f7..523cdc75d 100644 --- a/projects/systelab-components/package.json +++ b/projects/systelab-components/package.json @@ -1,6 +1,6 @@ { "name": "systelab-components", - "version": "17.4.5", + "version": "17.4.6", "license": "MIT", "keywords": [ "Angular", diff --git a/projects/systelab-components/src/lib/image-viewer/image-viewer.component.ts b/projects/systelab-components/src/lib/image-viewer/image-viewer.component.ts index fe900c5a7..f34a90a4b 100644 --- a/projects/systelab-components/src/lib/image-viewer/image-viewer.component.ts +++ b/projects/systelab-components/src/lib/image-viewer/image-viewer.component.ts @@ -403,20 +403,7 @@ export class ImageViewerComponent implements OnInit { const imageWidth = this.image.naturalWidth; const imageHeight = this.image.naturalHeight; - let newZoom: number; - if (imageWidth > imageHeight) { - if (imageWidth < availableWidth) { - newZoom = (availableHeight / imageHeight) * 100; - } else { - newZoom = (availableWidth / imageWidth) * 100; - } - } else { - if (imageHeight < availableHeight) { - newZoom = (availableWidth / imageWidth) * 100; - } else { - newZoom = (availableHeight / imageHeight) * 100; - } - } + const newZoom = Math.min(availableWidth / imageWidth, availableHeight / imageHeight) * 100; return Math.min(newZoom, this.sliderZoomMax); } }