fix: 修复 ResultView Live Photo 预览宽度铺满问题
PHLivePhotoView 无 intrinsic content size,SwiftUI 的 .aspectRatio() 对 UIViewRepresentable 无效。 改用 Color.clear + aspectRatio 撑出正确比例容器, 再用 .overlay 放入 Live Photo 预览。 同时移除 .frame(maxWidth: .infinity) 避免强制撑满。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,13 +83,16 @@ struct ResultView: View {
|
||||
let photoSize = livePhoto.size
|
||||
let ratio = photoSize.width / max(photoSize.height, 1)
|
||||
SoftCard(padding: DesignTokens.Spacing.md) {
|
||||
LivePhotoPreviewView(livePhoto: livePhoto)
|
||||
// PHLivePhotoView 无 intrinsic size,用 Color.clear 撑出正确比例
|
||||
Color.clear
|
||||
.aspectRatio(ratio, contentMode: .fit)
|
||||
.frame(maxHeight: 360)
|
||||
.overlay {
|
||||
LivePhotoPreviewView(livePhoto: livePhoto)
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: DesignTokens.Radius.lg))
|
||||
.accessibilityLabel(String(localized: "result.livePhotoPreview.accessibilityLabel"))
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
Text(String(localized: "result.livePhotoPreview.hint"))
|
||||
|
||||
Reference in New Issue
Block a user