commit 0ba7f1e6a04ba74ec5bad38383b01ca07946668a
parent 5efd66c9dfa5561c434f00af61ba6b6436342bca
Author: Marc Stibane <marc@taler.net>
Date: Sun, 13 Apr 2025 08:07:11 +0200
match target
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/TalerWallet1/Views/OIM/OIMcurrencyViews2.swift b/TalerWallet1/Views/OIM/OIMcurrencyViews2.swift
@@ -30,7 +30,10 @@ struct OIMnoteStackV: View {
ForEach(0...maxIndex, id: \.self) { index in
let match = tappedVal == value && index == maxIndex
let isFlying = flying > 0
- let id = match && !isFlying ? value : -value
+ let matchNotFlying = match && !isFlying
+ let isTarget = matchNotFlying // && isTop
+ let targetId = isTarget ? String(value)
+ : String(value) + "+" + String(index)
let xOffset = CGFloat(10 * index)
let yOffset = CGFloat(20 * index)
let shakeOffset: CGFloat = shake && !match ? .random(in: 10...25)
@@ -45,7 +48,7 @@ struct OIMnoteStackV: View {
action: action)
.offset(x: xOffset + (direction ? shakeOffset : -shakeOffset),
y: yOffset)
- .matchedGeometryEffect(id: id, in: wrapper.namespace, isSource: false)
+ .matchedGeometryEffect(id: targetId, in: wrapper.namespace, isSource: false)
.onAppear {
// print("start flying \(id), shaking \(shakeOffset)")
withAnimation(.fly1) {
@@ -80,7 +83,10 @@ struct OIMcoinStackV: View {
ForEach(0...maxIndex, id: \.self) { index in
let match = tappedVal == value && index == maxIndex
let isFlying = flying > 0
- let id = match && !isFlying ? value : -value
+ let matchNotFlying = match && !isFlying
+ let isTarget = matchNotFlying // && isTop
+ let targetId = isTarget ? String(value)
+ : String(value) + "+" + String(index)
let yOffset = offset * CGFloat(index)
let xOffset = yOffset / 2
let shakeOffset: CGFloat = shake && !match ? .random(in: 5...10)
@@ -94,7 +100,7 @@ struct OIMcoinStackV: View {
action: action)
.offset(x: xOffset + (direction ? shakeOffset : -shakeOffset),
y: yOffset)
- .matchedGeometryEffect(id: id, in: wrapper.namespace, isSource: false)
+ .matchedGeometryEffect(id: targetId, in: wrapper.namespace, isSource: false)
.onAppear {
// print("start flying \(id), shaking \(shakeOffset)")
withAnimation(.fly1) {