Swipe fiable en card del Home y Charts: simultaneousGesture sobre la gráfica (build 63)

El swipe entre páginas del Home (build 62) y entre charts (build 60) no
funcionaba encima de la gráfica: su DragGesture de scrub (minimumDistance 0)
consumía el gesto. Cambiado a .simultaneousGesture — ambos se reconocen; la
dominancia horizontal en onEnded evita romper el scroll vertical. Ahora el swipe
funciona en toda la card, también sobre el chart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WoScpmHdVj1aUf4rAp6hbe
This commit is contained in:
alexandrev-tibco
2026-07-11 10:50:52 +02:00
parent d8bd625327
commit 41e2a22a64
3 changed files with 19 additions and 12 deletions
@@ -605,7 +605,9 @@ struct ChartsContainerView: View {
iPhonePeriodControl
chartContent
// Swipe left/right to move to the adjacent chart type.
.gesture(chartSwipeGesture)
// simultaneousGesture so charts with their own scrub drag
// don't swallow the swipe.
.simultaneousGesture(chartSwipeGesture)
.id(viewModel.selectedChartType)
.transition(.asymmetric(
insertion: .move(edge: swipeInsertionEdge).combined(with: .opacity),
@@ -78,13 +78,18 @@ struct EvolutionChartCard: View {
insertion: .move(edge: pageInsertionEdge).combined(with: .opacity),
removal: .opacity
))
.gesture(pageSwipeGesture)
if pages.count > 1 { pageIndicator }
}
.padding()
.background(Color(.systemBackground))
.cornerRadius(AppConstants.UI.cornerRadius)
.shadow(color: .black.opacity(0.05), radius: 8, y: 2)
.contentShape(Rectangle())
// simultaneousGesture so the swipe is recognized even over the chart,
// whose own scrub DragGesture would otherwise consume it. Horizontal
// dominance is enforced in onEnded so vertical scroll still works; a
// single page is a harmless no-op (bounds prevent movement).
.simultaneousGesture(pageSwipeGesture)
}
@ViewBuilder