@@ -7,8 +7,6 @@ struct BarChartView: View {
7
7
8
8
@State private var selectedDataPoints : SelectedDataPoints ?
9
9
@State private var isDragging = false
10
- @State private var isLongPressing = false
11
- @State private var longPressLocation : CGPoint ?
12
10
@State private var tappedDataPoint : DataPoint ?
13
11
14
12
@Environment ( \. context) var context
@@ -246,43 +244,15 @@ struct BarChartView: View {
246
244
. onTapGesture { location in
247
245
handleTapGesture ( at: location, proxy: proxy, geometry: geometry)
248
246
}
249
- . onLongPressGesture ( minimumDuration: 0.3 ) {
250
- // Long press completed - keep showing annotation
251
- } onPressingChanged: { isPressing in
252
- if isPressing {
253
- // Long press started - show annotation at current location
254
- if let location = longPressLocation {
255
- isLongPressing = true
256
- selectedDataPoints = getSelectedDataPoints ( at: location, proxy: proxy, geometry: geometry)
257
- }
258
- } else {
259
- // Long press ended - clear annotation
260
- isLongPressing = false
261
- longPressLocation = nil
262
- if !isDragging {
263
- selectedDataPoints = nil
264
- }
265
- tappedDataPoint = nil
266
- }
267
- }
268
247
. simultaneousGesture (
269
- DragGesture ( minimumDistance: 0 )
248
+ DragGesture ( minimumDistance: 16 )
270
249
. onChanged { value in
271
- // Store location for long press
272
- longPressLocation = value. location
273
-
274
- // Handle drag if moved enough
275
- if value. translation. width. magnitude > 8 || value. translation. height. magnitude > 8 {
276
- isDragging = true
277
- selectedDataPoints = getSelectedDataPoints ( at: value. location, proxy: proxy, geometry: geometry)
278
- }
250
+ isDragging = true
251
+ selectedDataPoints = getSelectedDataPoints ( at: value. location, proxy: proxy, geometry: geometry)
279
252
}
280
253
. onEnded { _ in
281
254
isDragging = false
282
- longPressLocation = nil
283
- if !isLongPressing {
284
- selectedDataPoints = nil
285
- }
255
+ selectedDataPoints = nil
286
256
tappedDataPoint = nil
287
257
}
288
258
)
@@ -291,7 +261,7 @@ struct BarChartView: View {
291
261
292
262
private func handleTapGesture( at location: CGPoint , proxy: ChartProxy , geometry: GeometryProxy ) {
293
263
// Only handle tap if not dragging or long pressing
294
- guard !isDragging && !isLongPressing else { return }
264
+ guard !isDragging else { return }
295
265
296
266
guard let onDateSelected,
297
267
data. granularity != . hour,
0 commit comments