mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-04-24 01:28:40 +02:00
feat: add scroll transition
This commit is contained in:
@@ -21,6 +21,10 @@ struct PenToolView: View {
|
|||||||
ForEach(tool.pens) { pen in
|
ForEach(tool.pens) { pen in
|
||||||
penView(pen)
|
penView(pen)
|
||||||
.id(pen.id)
|
.id(pen.id)
|
||||||
|
.scrollTransition { content, phase in
|
||||||
|
content
|
||||||
|
.scaleEffect(phase.isIdentity ? 1 : 0.04, anchor: .trailing)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.vertical, 10)
|
.padding(.vertical, 10)
|
||||||
@@ -64,7 +68,6 @@ struct PenToolView: View {
|
|||||||
}
|
}
|
||||||
.frame(width: width * factor, height: height * factor)
|
.frame(width: width * factor, height: height * factor)
|
||||||
.padding(.vertical, 5)
|
.padding(.vertical, 5)
|
||||||
.padding(.leading, 10)
|
|
||||||
.contentShape(.rect(cornerRadii: .init(topLeading: 10, bottomLeading: 10)))
|
.contentShape(.rect(cornerRadii: .init(topLeading: 10, bottomLeading: 10)))
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if tool.selectedPen === pen {
|
if tool.selectedPen === pen {
|
||||||
@@ -108,6 +111,7 @@ struct PenToolView: View {
|
|||||||
.contentShape(.dragPreview, .rect(cornerRadius: 10))
|
.contentShape(.dragPreview, .rect(cornerRadius: 10))
|
||||||
}
|
}
|
||||||
.onDrop(of: [.item], delegate: PenDropDelegate(id: pen.id, tool: tool))
|
.onDrop(of: [.item], delegate: PenDropDelegate(id: pen.id, tool: tool))
|
||||||
|
.padding(.leading, 10)
|
||||||
.offset(x: tool.selectedPen === pen ? 0 : 28)
|
.offset(x: tool.selectedPen === pen ? 0 : 28)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user