Feedback TF build 79: fuera el swipe entre gráficas (navegación = chip bar; el gesto chocaba con scrub/pan/brush). Brush con gesto unificado decidido en touch-down: cerca de un asa (18pt) redimensiona; en cualquier otro punto (dentro de la ventana o sobre el historial atenuado) desliza la ventana entera manteniendo el ancho — seleccionar ene–mar y arrastrar hasta jun–ago. Con ventanas estrechas las asas solo agarran desde fuera, el interior siempre mueve. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L38583J7AYWCVPevkivscj
This commit is contained in:
@@ -615,16 +615,11 @@ struct ChartsContainerView: View {
|
||||
if hasActiveFilters {
|
||||
activeFilterChip
|
||||
}
|
||||
// No swipe-between-charts: it collided with every horizontal
|
||||
// interaction (scrub, pan, brush). The chip bar navigates.
|
||||
chartContent
|
||||
// Swipe left/right to move to the adjacent chart type.
|
||||
// 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),
|
||||
removal: .opacity
|
||||
))
|
||||
.transition(.opacity)
|
||||
if viewModel.hiddenHistoryMonths > 0 {
|
||||
lockedHistoryTeaser
|
||||
}
|
||||
@@ -721,32 +716,11 @@ struct ChartsContainerView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - iPhone swipe between charts
|
||||
|
||||
/// Chart types in the same grouped order as the title switcher menu.
|
||||
private var orderedChartTypes: [ChartsViewModel.ChartType] {
|
||||
Self.chartGroups.flatMap { $0.types }.filter { showForecast || $0 != .prediction }
|
||||
}
|
||||
|
||||
@State private var swipeInsertionEdge: Edge = .trailing
|
||||
|
||||
private var chartSwipeGesture: some Gesture {
|
||||
DragGesture(minimumDistance: 30)
|
||||
.onEnded { value in
|
||||
// Horizontal-dominant swipes only, so vertical scroll still works.
|
||||
guard abs(value.translation.width) > abs(value.translation.height) * 1.5 else { return }
|
||||
let ordered = orderedChartTypes
|
||||
guard let idx = ordered.firstIndex(of: viewModel.selectedChartType) else { return }
|
||||
if value.translation.width < 0, idx < ordered.count - 1 {
|
||||
swipeInsertionEdge = .trailing
|
||||
withAnimation(.snappy) { viewModel.selectChart(ordered[idx + 1]) }
|
||||
} else if value.translation.width > 0, idx > 0 {
|
||||
swipeInsertionEdge = .leading
|
||||
withAnimation(.snappy) { viewModel.selectChart(ordered[idx - 1]) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stocks-style segmented period control above the chart (the chart switcher
|
||||
/// lives in the title menu, filters in the toolbar), plus the global range
|
||||
/// brush toggle. The brush lives HERE — outside chartContent — so its drags
|
||||
|
||||
Reference in New Issue
Block a user