mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Update long press gesture animation. (#1195)
This commit is contained in:
@@ -24,9 +24,12 @@ struct LongPressWithFeedback: ViewModifier {
|
|||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content
|
content
|
||||||
.scaleEffect(x: isLongPressing ? 0.93 : 1,
|
.compositingGroup() // Apply the shadow to the view as a whole.
|
||||||
y: isLongPressing ? 0.93 : 1)
|
.shadow(color: .black.opacity(0.2), radius: isLongPressing ? 12 : 0)
|
||||||
.animation(isLongPressing ? .spring(response: 0.8).delay(0.2) : .spring(response: 0.2),
|
.shadow(color: .black.opacity(0.1), radius: isLongPressing ? 3 : 0)
|
||||||
|
.scaleEffect(x: isLongPressing ? 1.05 : 1,
|
||||||
|
y: isLongPressing ? 1.05 : 1)
|
||||||
|
.animation(isLongPressing ? .spring(response: 1.5).delay(0.2) : .spring(response: 0.5),
|
||||||
value: isLongPressing)
|
value: isLongPressing)
|
||||||
.onLongPressGesture(minimumDuration: 0.25) {
|
.onLongPressGesture(minimumDuration: 0.25) {
|
||||||
action()
|
action()
|
||||||
@@ -90,6 +93,7 @@ struct FakeContextMenu_Previews: PreviewProvider {
|
|||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
.padding(.vertical, 4)
|
.padding(.vertical, 4)
|
||||||
.background(Color.compound._bgBubbleOutgoing, in: RoundedRectangle(cornerRadius: 12))
|
.background(Color.compound._bgBubbleOutgoing, in: RoundedRectangle(cornerRadius: 12))
|
||||||
|
.contentShape(.contextMenuPreview, RoundedRectangle(cornerRadius: 12))
|
||||||
.onTapGesture { /* Fix long press gesture blocking the scroll view */ }
|
.onTapGesture { /* Fix long press gesture blocking the scroll view */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Update long press gesture animation
|
||||||
Reference in New Issue
Block a user