feat: fine tune photo preview

This commit is contained in:
dscyrescotti
2024-07-03 00:32:41 +07:00
parent dbe1c22c96
commit 23fa2dbf90
3 changed files with 6 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ struct ElementToolbar: View {
.fill(.regularMaterial)
}
.padding(.bottom, 10)
.frame(maxWidth: .infinity)
.transition(.move(edge: .bottom).combined(with: .blurReplace))
} else {
compactToolbar
@@ -196,6 +197,7 @@ struct ElementToolbar: View {
.fill(.regularMaterial)
}
.padding(10)
.frame(maxWidth: .infinity)
.transition(.move(edge: .bottom).combined(with: .blurReplace))
}

View File

@@ -92,6 +92,7 @@ struct MemoView: View {
case .photo:
if let photoItem = tool.selectedPhotoItem {
PhotoPreview(photoItem: photoItem, tool: tool)
.frame(maxWidth: .infinity, alignment: .trailing)
.transition(.move(edge: .trailing))
}
default:

View File

@@ -8,6 +8,8 @@
import SwiftUI
struct PhotoPreview: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
let photoItem: PhotoItem
@ObservedObject var tool: Tool
@@ -15,7 +17,7 @@ struct PhotoPreview: View {
Image(uiImage: photoItem.previewImage)
.resizable()
.scaledToFit()
.frame(height: 100)
.frame(width: horizontalSizeClass == .compact ? 80 : nil, height: horizontalSizeClass == .compact ? nil : 100)
.cornerRadius(5)
.overlay {
RoundedRectangle(cornerRadius: 5)