mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-07-12 15:52:41 +02:00
feat: fine tune element toolbar
This commit is contained in:
@@ -26,18 +26,20 @@ struct ElementToolbar: View {
|
|||||||
if horizontalSizeClass == .regular {
|
if horizontalSizeClass == .regular {
|
||||||
regularToolbar
|
regularToolbar
|
||||||
} else {
|
} else {
|
||||||
ZStack(alignment: .bottomLeading) {
|
ZStack(alignment: .bottom) {
|
||||||
compactToolbar
|
|
||||||
if tool.selection == .photo {
|
if tool.selection == .photo {
|
||||||
photoOption
|
photoOption
|
||||||
.background {
|
.background {
|
||||||
RoundedRectangle(cornerRadius: 8)
|
RoundedRectangle(cornerRadius: 8)
|
||||||
.fill(.regularMaterial)
|
.fill(.regularMaterial)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.padding(.bottom, 10)
|
||||||
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||||
|
} else {
|
||||||
|
compactToolbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding(.bottom, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.fullScreenCover(isPresented: $opensCamera) {
|
.fullScreenCover(isPresented: $opensCamera) {
|
||||||
@@ -193,8 +195,8 @@ struct ElementToolbar: View {
|
|||||||
RoundedRectangle(cornerRadius: 8)
|
RoundedRectangle(cornerRadius: 8)
|
||||||
.fill(.regularMaterial)
|
.fill(.regularMaterial)
|
||||||
}
|
}
|
||||||
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
|
||||||
.padding(10)
|
.padding(10)
|
||||||
|
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
|
|
||||||
var photoOption: some View {
|
var photoOption: some View {
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ struct MemoView: View {
|
|||||||
switch tool.selection {
|
switch tool.selection {
|
||||||
case .pen:
|
case .pen:
|
||||||
PenDock(tool: tool, canvas: canvas, size: size)
|
PenDock(tool: tool, canvas: canvas, size: size)
|
||||||
.transition(.move(edge: .trailing))
|
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||||
case .photo:
|
case .photo:
|
||||||
if let photoItem = tool.selectedPhotoItem {
|
if let photoItem = tool.selectedPhotoItem {
|
||||||
PhotoPreview(photoItem: photoItem, tool: tool)
|
PhotoPreview(photoItem: photoItem, tool: tool)
|
||||||
.transition(.move(edge: .trailing))
|
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
EmptyView()
|
EmptyView()
|
||||||
@@ -88,7 +88,7 @@ struct MemoView: View {
|
|||||||
switch tool.selection {
|
switch tool.selection {
|
||||||
case .pen:
|
case .pen:
|
||||||
PenDock(tool: tool, canvas: canvas, size: size)
|
PenDock(tool: tool, canvas: canvas, size: size)
|
||||||
.transition(.move(edge: .bottom))
|
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||||
case .photo:
|
case .photo:
|
||||||
if let photoItem = tool.selectedPhotoItem {
|
if let photoItem = tool.selectedPhotoItem {
|
||||||
PhotoPreview(photoItem: photoItem, tool: tool)
|
PhotoPreview(photoItem: photoItem, tool: tool)
|
||||||
@@ -99,9 +99,27 @@ struct MemoView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.overlay(alignment: .bottom) {
|
.overlay(alignment: .bottom) {
|
||||||
if tool.selection == .hand {
|
if tool.selection != .pen {
|
||||||
ElementToolbar(size: size, tool: tool, canvas: canvas)
|
ElementToolbar(size: size, tool: tool, canvas: canvas)
|
||||||
.transition(.move(edge: .bottom))
|
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.overlay(alignment: .bottom) {
|
||||||
|
if tool.selection != .hand {
|
||||||
|
Button {
|
||||||
|
withAnimation {
|
||||||
|
tool.selectTool(.hand)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "chevron.compact.down")
|
||||||
|
.font(.headline)
|
||||||
|
.frame(width: 80)
|
||||||
|
.padding(5)
|
||||||
|
.background(.regularMaterial)
|
||||||
|
.clipShape(.capsule)
|
||||||
|
.contentShape(.capsule)
|
||||||
|
}
|
||||||
|
.offset(y: 5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,32 +61,17 @@ struct PenDock: View {
|
|||||||
.fill(.regularMaterial)
|
.fill(.regularMaterial)
|
||||||
.frame(height: height * factor - 18)
|
.frame(height: height * factor - 18)
|
||||||
}
|
}
|
||||||
.padding([.horizontal, .bottom], 10)
|
.padding(.horizontal, 10)
|
||||||
|
.padding(.bottom, 20)
|
||||||
.frame(maxWidth: min(proxy.size.height, proxy.size.width), maxHeight: .infinity, alignment: .bottom)
|
.frame(maxWidth: min(proxy.size.height, proxy.size.width), maxHeight: .infinity, alignment: .bottom)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
.overlay(alignment: .bottom) {
|
|
||||||
Button {
|
|
||||||
withAnimation {
|
|
||||||
tool.selectTool(.hand)
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "chevron.compact.down")
|
|
||||||
.font(.headline)
|
|
||||||
.frame(width: 80)
|
|
||||||
.padding(10)
|
|
||||||
.background(.regularMaterial)
|
|
||||||
.clipShape(.capsule)
|
|
||||||
.contentShape(.capsule)
|
|
||||||
}
|
|
||||||
.offset(y: 5)
|
|
||||||
}
|
|
||||||
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
lockButton
|
lockButton
|
||||||
.frame(maxWidth: .infinity, alignment: .bottomTrailing)
|
.frame(maxWidth: .infinity, alignment: .bottomTrailing)
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.offset(y: canvas.locksCanvas ? 0 : -(height * factor - size + 20))
|
.offset(y: canvas.locksCanvas ? 0 : -(height * factor - size + 30))
|
||||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user