From f7dec4cf23b516053e4045a1df203c28d52e70e2 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 21 Jul 2020 18:25:54 -0500 Subject: [PATCH] Don't scale up icons anymore. It was causing a weird effect where in some visible views the source icon was larger than in other. --- Multiplatform/Shared/Images/IconImageView.swift | 6 +----- Multiplatform/iOS/Article/IconView.swift | 4 ---- Multiplatform/macOS/Article/IconView.swift | 4 ---- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Multiplatform/Shared/Images/IconImageView.swift b/Multiplatform/Shared/Images/IconImageView.swift index 77e4f87d2..9ef973b1b 100644 --- a/Multiplatform/Shared/Images/IconImageView.swift +++ b/Multiplatform/Shared/Images/IconImageView.swift @@ -39,11 +39,7 @@ struct IconImageView: View { let newSize: CGSize if imageSize.height == imageSize.width { - if imageSize.height >= viewSize.height * 0.75 { - newSize = CGSize(width: viewSize.width, height: viewSize.height) - } else { - newSize = CGSize(width: imageSize.width, height: imageSize.height) - } + return imageSize } else if imageSize.height > imageSize.width { let factor = viewSize.height / imageSize.height let width = imageSize.width * factor diff --git a/Multiplatform/iOS/Article/IconView.swift b/Multiplatform/iOS/Article/IconView.swift index 2ec29a12e..aa7c095b8 100644 --- a/Multiplatform/iOS/Article/IconView.swift +++ b/Multiplatform/iOS/Article/IconView.swift @@ -100,10 +100,6 @@ private extension IconView { let imageSize = image.size let viewSize = bounds.size if imageSize.height == imageSize.width { - if imageSize.height >= viewSize.height * 0.75 { - // Close enough to viewSize to scale up the image. - return CGRect(x: 0.0, y: 0.0, width: viewSize.width, height: viewSize.height) - } let offset = floor((viewSize.height - imageSize.height) / 2.0) return CGRect(x: offset, y: offset, width: imageSize.width, height: imageSize.height) } diff --git a/Multiplatform/macOS/Article/IconView.swift b/Multiplatform/macOS/Article/IconView.swift index e3b6e528c..7616af3f4 100644 --- a/Multiplatform/macOS/Article/IconView.swift +++ b/Multiplatform/macOS/Article/IconView.swift @@ -107,10 +107,6 @@ private extension IconView { let imageSize = image.size let viewSize = bounds.size if imageSize.height == imageSize.width { - if imageSize.height >= viewSize.height * 0.75 { - // Close enough to viewSize to scale up the image. - return NSMakeRect(0.0, 0.0, viewSize.width, viewSize.height) - } let offset = floor((viewSize.height - imageSize.height) / 2.0) return NSMakeRect(offset, offset, imageSize.width, imageSize.height) }