From 5f5f38664bef3b516456f8e29864070cd32ec6c0 Mon Sep 17 00:00:00 2001 From: Alex Grebenyuk Date: Wed, 10 Sep 2025 16:22:21 -0400 Subject: [PATCH] Fix an issue with BarChartView preveting scrolling --- .../JetpackStats/Charts/BarChartView.swift | 40 +++---------------- RELEASE-NOTES.txt | 1 + 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/Modules/Sources/JetpackStats/Charts/BarChartView.swift b/Modules/Sources/JetpackStats/Charts/BarChartView.swift index f6fba3c498ab..68c272a0938b 100644 --- a/Modules/Sources/JetpackStats/Charts/BarChartView.swift +++ b/Modules/Sources/JetpackStats/Charts/BarChartView.swift @@ -7,8 +7,6 @@ struct BarChartView: View { @State private var selectedDataPoints: SelectedDataPoints? @State private var isDragging = false - @State private var isLongPressing = false - @State private var longPressLocation: CGPoint? @State private var tappedDataPoint: DataPoint? @Environment(\.context) var context @@ -246,43 +244,15 @@ struct BarChartView: View { .onTapGesture { location in handleTapGesture(at: location, proxy: proxy, geometry: geometry) } - .onLongPressGesture(minimumDuration: 0.3) { - // Long press completed - keep showing annotation - } onPressingChanged: { isPressing in - if isPressing { - // Long press started - show annotation at current location - if let location = longPressLocation { - isLongPressing = true - selectedDataPoints = getSelectedDataPoints(at: location, proxy: proxy, geometry: geometry) - } - } else { - // Long press ended - clear annotation - isLongPressing = false - longPressLocation = nil - if !isDragging { - selectedDataPoints = nil - } - tappedDataPoint = nil - } - } .simultaneousGesture( - DragGesture(minimumDistance: 0) + DragGesture(minimumDistance: 16) .onChanged { value in - // Store location for long press - longPressLocation = value.location - - // Handle drag if moved enough - if value.translation.width.magnitude > 8 || value.translation.height.magnitude > 8 { - isDragging = true - selectedDataPoints = getSelectedDataPoints(at: value.location, proxy: proxy, geometry: geometry) - } + isDragging = true + selectedDataPoints = getSelectedDataPoints(at: value.location, proxy: proxy, geometry: geometry) } .onEnded { _ in isDragging = false - longPressLocation = nil - if !isLongPressing { - selectedDataPoints = nil - } + selectedDataPoints = nil tappedDataPoint = nil } ) @@ -291,7 +261,7 @@ struct BarChartView: View { private func handleTapGesture(at location: CGPoint, proxy: ChartProxy, geometry: GeometryProxy) { // Only handle tap if not dragging or long pressing - guard !isDragging && !isLongPressing else { return } + guard !isDragging else { return } guard let onDateSelected, data.granularity != .hour, diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index b69ca72e07b2..276ed7ac3a12 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,7 @@ 26.3 ----- * [*] Fix an issue with Notification Settings button not working in the Reader Subscriptions context menus for subscriptions [#24778] +* [*] Fix an issue with tooltip in bar charts in Stats preventing scrolling [#24822] * [*] Fix rare crash in Reader when loading posts [#24815] 26.2