From acdd65b9031b9819a33750ac9492a4883ab1eab5 Mon Sep 17 00:00:00 2001 From: Anthony Li Date: Sun, 24 Mar 2024 13:21:47 -0400 Subject: [PATCH 1/4] Replace aspectRatio with scaledToFill --- Sources/PennForms/FormComponents/ImagePicker.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/PennForms/FormComponents/ImagePicker.swift b/Sources/PennForms/FormComponents/ImagePicker.swift index a281e30..0794baa 100644 --- a/Sources/PennForms/FormComponents/ImagePicker.swift +++ b/Sources/PennForms/FormComponents/ImagePicker.swift @@ -40,7 +40,7 @@ public struct ImagePicker: FormComponent { image .resizable() - .aspectRatio(contentMode: .fill) + .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) @@ -58,7 +58,7 @@ public struct ImagePicker: FormComponent { Image(uiImage: selectedImages[0]) .resizable() - .aspectRatio(contentMode: .fill) + .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) From 52664462b5f57f572e560f3dfe67a8bb795af93a Mon Sep 17 00:00:00 2001 From: Anthony Li Date: Sun, 24 Mar 2024 13:25:16 -0400 Subject: [PATCH 2/4] Add contentShape modifiers --- Sources/PennForms/FormComponents/ImagePicker.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/PennForms/FormComponents/ImagePicker.swift b/Sources/PennForms/FormComponents/ImagePicker.swift index 0794baa..b7edb9f 100644 --- a/Sources/PennForms/FormComponents/ImagePicker.swift +++ b/Sources/PennForms/FormComponents/ImagePicker.swift @@ -43,6 +43,7 @@ public struct ImagePicker: FormComponent { .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) + .contentShape(RoundedRectangle(cornerRadius: 8) } }, @@ -61,6 +62,7 @@ public struct ImagePicker: FormComponent { .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) + .contentShape(RoundedRectangle(cornerRadius: 8) } From 1f23c02548094141f786e2737f7f7b2d01329b70 Mon Sep 17 00:00:00 2001 From: Anthony Li Date: Sun, 24 Mar 2024 13:26:21 -0400 Subject: [PATCH 3/4] Fix parentheses --- Sources/PennForms/FormComponents/ImagePicker.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/PennForms/FormComponents/ImagePicker.swift b/Sources/PennForms/FormComponents/ImagePicker.swift index b7edb9f..a796b0e 100644 --- a/Sources/PennForms/FormComponents/ImagePicker.swift +++ b/Sources/PennForms/FormComponents/ImagePicker.swift @@ -43,7 +43,7 @@ public struct ImagePicker: FormComponent { .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) - .contentShape(RoundedRectangle(cornerRadius: 8) + .contentShape(RoundedRectangle(cornerRadius: 8)) } }, @@ -62,7 +62,7 @@ public struct ImagePicker: FormComponent { .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) - .contentShape(RoundedRectangle(cornerRadius: 8) + .contentShape(RoundedRectangle(cornerRadius: 8)) } From 762d6bd2d9cbca68063b0376ebdb2dd576d87bfd Mon Sep 17 00:00:00 2001 From: Anthony Li Date: Sun, 24 Mar 2024 13:32:48 -0400 Subject: [PATCH 4/4] Disable hit testing on image entirely --- Sources/PennForms/FormComponents/ImagePicker.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/PennForms/FormComponents/ImagePicker.swift b/Sources/PennForms/FormComponents/ImagePicker.swift index a796b0e..452ac73 100644 --- a/Sources/PennForms/FormComponents/ImagePicker.swift +++ b/Sources/PennForms/FormComponents/ImagePicker.swift @@ -43,7 +43,7 @@ public struct ImagePicker: FormComponent { .scaledToFill() .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) - .contentShape(RoundedRectangle(cornerRadius: 8)) + .allowsHitTesting(false) } }, @@ -63,6 +63,7 @@ public struct ImagePicker: FormComponent { .frame(width: 350, height: 200) .clipShape(RoundedRectangle(cornerRadius: 8)) .contentShape(RoundedRectangle(cornerRadius: 8)) + .allowsHitTesting(false) }