react-native-livechart 4.26.0 → 4.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CustomReferenceLineOverlay.d.ts +8 -1
- package/dist/components/CustomReferenceLineOverlay.d.ts.map +1 -1
- package/dist/components/CustomTooltipOverlay.d.ts +3 -2
- package/dist/components/CustomTooltipOverlay.d.ts.map +1 -1
- package/dist/components/LiveChart.d.ts +1 -1
- package/dist/components/LiveChart.d.ts.map +1 -1
- package/dist/components/LiveChartSeries.d.ts.map +1 -1
- package/dist/components/MultiSeriesDots.d.ts +1 -1
- package/dist/components/MultiSeriesDots.d.ts.map +1 -1
- package/dist/components/MultiSeriesValueLabels.d.ts +1 -1
- package/dist/components/MultiSeriesValueLabels.d.ts.map +1 -1
- package/dist/components/MultiSeriesValueLines.d.ts +1 -1
- package/dist/components/MultiSeriesValueLines.d.ts.map +1 -1
- package/dist/components/ReferenceLineOverlay.d.ts +4 -0
- package/dist/components/ReferenceLineOverlay.d.ts.map +1 -1
- package/dist/components/ReferenceValueBadge.d.ts +15 -0
- package/dist/components/ReferenceValueBadge.d.ts.map +1 -0
- package/dist/components/XAxisOverlay.d.ts +17 -0
- package/dist/components/XAxisOverlay.d.ts.map +1 -1
- package/dist/core/liveChartEngineTick.d.ts +4 -0
- package/dist/core/liveChartEngineTick.d.ts.map +1 -1
- package/dist/core/liveChartSeriesEngineTick.d.ts +15 -2
- package/dist/core/liveChartSeriesEngineTick.d.ts.map +1 -1
- package/dist/core/resolveConfig.d.ts +28 -1
- package/dist/core/resolveConfig.d.ts.map +1 -1
- package/dist/core/useLiveChartEngine.d.ts +9 -0
- package/dist/core/useLiveChartEngine.d.ts.map +1 -1
- package/dist/core/useLiveChartSeriesEngine.d.ts +18 -4
- package/dist/core/useLiveChartSeriesEngine.d.ts.map +1 -1
- package/dist/draw/grid.d.ts +6 -4
- package/dist/draw/grid.d.ts.map +1 -1
- package/dist/draw/line.d.ts +21 -3
- package/dist/draw/line.d.ts.map +1 -1
- package/dist/hooks/crosshairSeries.d.ts +2 -2
- package/dist/hooks/crosshairSeries.d.ts.map +1 -1
- package/dist/hooks/crosshairShared.d.ts +16 -1
- package/dist/hooks/crosshairShared.d.ts.map +1 -1
- package/dist/hooks/referenceBadgeFont.d.ts +5 -0
- package/dist/hooks/referenceBadgeFont.d.ts.map +1 -0
- package/dist/hooks/resolveChartLayout.d.ts +18 -2
- package/dist/hooks/resolveChartLayout.d.ts.map +1 -1
- package/dist/hooks/useBadge.d.ts +16 -1
- package/dist/hooks/useBadge.d.ts.map +1 -1
- package/dist/hooks/useChartSkiaFont.d.ts +1 -0
- package/dist/hooks/useChartSkiaFont.d.ts.map +1 -1
- package/dist/hooks/useCrosshair.d.ts +7 -2
- package/dist/hooks/useCrosshair.d.ts.map +1 -1
- package/dist/hooks/useCrosshairSeries.d.ts +6 -1
- package/dist/hooks/useCrosshairSeries.d.ts.map +1 -1
- package/dist/hooks/useLatestCallback.d.ts +6 -0
- package/dist/hooks/useLatestCallback.d.ts.map +1 -0
- package/dist/hooks/useMarkers.d.ts.map +1 -1
- package/dist/hooks/useMultiSeriesDegen.d.ts +1 -1
- package/dist/hooks/useMultiSeriesDegen.d.ts.map +1 -1
- package/dist/hooks/useMultiSeriesLinePaths.d.ts.map +1 -1
- package/dist/hooks/usePanScroll.d.ts +3 -1
- package/dist/hooks/usePanScroll.d.ts.map +1 -1
- package/dist/hooks/usePinchZoom.d.ts +7 -4
- package/dist/hooks/usePinchZoom.d.ts.map +1 -1
- package/dist/hooks/useReferenceDrag.d.ts +20 -5
- package/dist/hooks/useReferenceDrag.d.ts.map +1 -1
- package/dist/hooks/useReferenceLine.d.ts +24 -12
- package/dist/hooks/useReferenceLine.d.ts.map +1 -1
- package/dist/hooks/useReferenceLinePress.d.ts +4 -2
- package/dist/hooks/useReferenceLinePress.d.ts.map +1 -1
- package/dist/hooks/useReferenceTagStack.d.ts +31 -0
- package/dist/hooks/useReferenceTagStack.d.ts.map +1 -0
- package/dist/hooks/useScrubMarkers.d.ts +12 -0
- package/dist/hooks/useScrubMarkers.d.ts.map +1 -0
- package/dist/hooks/useXAxis.d.ts +1 -1
- package/dist/hooks/useXAxis.d.ts.map +1 -1
- package/dist/hooks/useYAxis.d.ts +1 -1
- package/dist/hooks/useYAxis.d.ts.map +1 -1
- package/dist/hooks/useYAxisLabelWidth.d.ts +6 -0
- package/dist/hooks/useYAxisLabelWidth.d.ts.map +1 -0
- package/dist/hooks/useYAxisScaleGesture.d.ts +34 -0
- package/dist/hooks/useYAxisScaleGesture.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/math/axisBadgeLayout.d.ts +16 -0
- package/dist/math/axisBadgeLayout.d.ts.map +1 -0
- package/dist/math/markers.d.ts +3 -0
- package/dist/math/markers.d.ts.map +1 -1
- package/dist/math/range.d.ts +1 -1
- package/dist/math/range.d.ts.map +1 -1
- package/dist/math/referenceLines.d.ts.map +1 -1
- package/dist/math/referenceTagStack.d.ts +36 -0
- package/dist/math/referenceTagStack.d.ts.map +1 -0
- package/dist/math/scrubMarkers.d.ts +12 -0
- package/dist/math/scrubMarkers.d.ts.map +1 -0
- package/dist/types.d.ts +262 -37
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomReferenceLineOverlay.tsx +50 -8
- package/src/components/CustomTooltipOverlay.tsx +5 -1
- package/src/components/LiveChart.tsx +580 -138
- package/src/components/LiveChartSeries.tsx +139 -19
- package/src/components/MultiSeriesDots.tsx +4 -2
- package/src/components/MultiSeriesValueLabels.tsx +4 -2
- package/src/components/MultiSeriesValueLines.tsx +4 -2
- package/src/components/ReferenceLineOverlay.tsx +62 -26
- package/src/components/ReferenceValueBadge.tsx +102 -0
- package/src/components/XAxisOverlay.tsx +104 -1
- package/src/core/liveChartEngineTick.ts +49 -4
- package/src/core/liveChartSeriesEngineTick.ts +107 -14
- package/src/core/resolveConfig.ts +103 -7
- package/src/core/useLiveChartEngine.ts +45 -9
- package/src/core/useLiveChartSeriesEngine.ts +47 -6
- package/src/draw/grid.ts +17 -13
- package/src/draw/line.ts +46 -5
- package/src/hooks/crosshairSeries.ts +37 -5
- package/src/hooks/crosshairShared.ts +56 -1
- package/src/hooks/referenceBadgeFont.ts +35 -0
- package/src/hooks/resolveChartLayout.ts +51 -3
- package/src/hooks/useBadge.ts +44 -5
- package/src/hooks/useChartSkiaFont.ts +1 -1
- package/src/hooks/useCrosshair.ts +444 -310
- package/src/hooks/useCrosshairSeries.ts +57 -20
- package/src/hooks/useLatestCallback.ts +15 -0
- package/src/hooks/useMarkers.ts +51 -39
- package/src/hooks/useMultiSeriesDegen.ts +10 -5
- package/src/hooks/useMultiSeriesLinePaths.ts +2 -0
- package/src/hooks/usePanScroll.ts +155 -127
- package/src/hooks/usePinchZoom.ts +94 -66
- package/src/hooks/useReferenceDrag.ts +409 -156
- package/src/hooks/useReferenceLine.ts +453 -277
- package/src/hooks/useReferenceLineGrouping.ts +1 -1
- package/src/hooks/useReferenceLinePress.ts +121 -53
- package/src/hooks/useReferenceTagStack.ts +81 -0
- package/src/hooks/useScrubMarkers.ts +79 -0
- package/src/hooks/useXAxis.ts +11 -2
- package/src/hooks/useYAxis.ts +1 -1
- package/src/hooks/useYAxisLabelWidth.ts +26 -0
- package/src/hooks/useYAxisScaleGesture.ts +263 -0
- package/src/index.ts +11 -0
- package/src/math/axisBadgeLayout.ts +37 -0
- package/src/math/markers.ts +28 -3
- package/src/math/range.ts +35 -0
- package/src/math/referenceLines.ts +5 -0
- package/src/math/referenceTagStack.ts +112 -0
- package/src/math/scrubMarkers.ts +55 -0
- package/src/types.ts +263 -37
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SkFont } from "@shopify/react-native-skia";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
2
3
|
import { Gesture } from "react-native-gesture-handler";
|
|
3
4
|
import {
|
|
4
5
|
useAnimatedReaction,
|
|
@@ -22,6 +23,7 @@ import type {
|
|
|
22
23
|
CandleGap,
|
|
23
24
|
CandlePoint,
|
|
24
25
|
LiveChartPalette,
|
|
26
|
+
Marker,
|
|
25
27
|
ScrubActionPoint,
|
|
26
28
|
ScrubPoint,
|
|
27
29
|
} from "../types";
|
|
@@ -57,6 +59,9 @@ import {
|
|
|
57
59
|
resetDelayedPanGuard,
|
|
58
60
|
shouldStartDelayedPan,
|
|
59
61
|
} from "./delayedPanGuard";
|
|
62
|
+
import { useScrubMarkers, type ScrubMarkerOptions } from "./useScrubMarkers";
|
|
63
|
+
|
|
64
|
+
import { useLatestCallback } from "./useLatestCallback";
|
|
60
65
|
|
|
61
66
|
const ACTION_HIT_SLOP = 6;
|
|
62
67
|
const RETICLE_HIT = 14;
|
|
@@ -114,6 +119,10 @@ export interface CrosshairChartOpts {
|
|
|
114
119
|
bridgeUnknown?: boolean;
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
/** Stable empty gap list so the crosshair worklets that capture it aren't
|
|
123
|
+
* re-registered on every render when the chart has no gaps. */
|
|
124
|
+
const EMPTY_GAPS: CandleGap[] = [];
|
|
125
|
+
|
|
117
126
|
function resolveCrosshairSettings(
|
|
118
127
|
chartOpts: CrosshairChartOpts | undefined,
|
|
119
128
|
scrubAction: ResolvedScrubActionConfig | null | undefined,
|
|
@@ -135,7 +144,7 @@ function resolveCrosshairSettings(
|
|
|
135
144
|
candlesSV: chartOpts?.candles,
|
|
136
145
|
liveCandleSV: chartOpts?.liveCandle,
|
|
137
146
|
candleWidthSecs: chartOpts?.candleWidthSecs ?? 60,
|
|
138
|
-
chartGaps: chartOpts?.gaps ??
|
|
147
|
+
chartGaps: chartOpts?.gaps ?? EMPTY_GAPS,
|
|
139
148
|
bridgeNoTrades: chartOpts?.bridgeNoTrades ?? false,
|
|
140
149
|
bridgeUnavailable: chartOpts?.bridgeUnavailable ?? false,
|
|
141
150
|
bridgeUnknown: chartOpts?.bridgeUnknown ?? false,
|
|
@@ -147,7 +156,7 @@ function resolveCrosshairSettings(
|
|
|
147
156
|
*/
|
|
148
157
|
export function useCrosshair(
|
|
149
158
|
engine: SingleEngineState,
|
|
150
|
-
|
|
159
|
+
paddingInput: ChartPadding,
|
|
151
160
|
_palette: LiveChartPalette,
|
|
152
161
|
formatValue: (v: number) => string,
|
|
153
162
|
formatTime: (t: number) => string,
|
|
@@ -204,7 +213,19 @@ export function useCrosshair(
|
|
|
204
213
|
* Default `false`.
|
|
205
214
|
*/
|
|
206
215
|
snapToCandles = false,
|
|
216
|
+
/** Candle mode: fires once per candle the crosshair enters, `null` on exit. */
|
|
217
|
+
onScrubCandleChange?: (candle: CandlePoint | null) => void,
|
|
218
|
+
markerOptions?: ScrubMarkerOptions,
|
|
219
|
+
/** Price-axis ownership also guards against stale native long-press events. */
|
|
220
|
+
axisScaleActive?: SharedValue<boolean>,
|
|
207
221
|
): CrosshairState {
|
|
222
|
+
// Config objects may be recreated without changing the plot geometry. Keep
|
|
223
|
+
// worklet closures and gestures stable until an actual inset changes.
|
|
224
|
+
const { top, right, bottom, left } = paddingInput;
|
|
225
|
+
const padding = useMemo(
|
|
226
|
+
() => ({ top, right, bottom, left }),
|
|
227
|
+
[top, right, bottom, left],
|
|
228
|
+
);
|
|
208
229
|
const scrubX = useSharedValue(-1);
|
|
209
230
|
const scrubActive = useSharedValue(false);
|
|
210
231
|
// Tracks whether the active scrub phase actually began, so a tap that never
|
|
@@ -420,6 +441,15 @@ export function useCrosshair(
|
|
|
420
441
|
},
|
|
421
442
|
);
|
|
422
443
|
|
|
444
|
+
const scrubMarkers = useScrubMarkers(
|
|
445
|
+
markerOptions, scrubActive, scrubTime, engine.timestamp, engine.displayWindow,
|
|
446
|
+
engine.canvasWidth, padding.left + padding.right,
|
|
447
|
+
isCandleMode, scrubCandle, candleWidthSecs, scrubGap,
|
|
448
|
+
);
|
|
449
|
+
// Cache marker details on JS so ordinary scrub frames only bridge the scalar
|
|
450
|
+
// point. A new selection / marker input carries a fresh payload once.
|
|
451
|
+
const jsScrubMarkers = useRef<Marker[]>([]);
|
|
452
|
+
|
|
423
453
|
// ── Scrub-action lock derivations ──────────────────────────────────────────
|
|
424
454
|
const lockPrice = useSharedValue<number | null>(null);
|
|
425
455
|
const lockY = useSharedValue(-1);
|
|
@@ -521,51 +551,62 @@ export function useCrosshair(
|
|
|
521
551
|
);
|
|
522
552
|
|
|
523
553
|
/* istanbul ignore next -- invoked only via scheduleOnRN from UI-thread gesture */
|
|
524
|
-
|
|
554
|
+
const handleScrubAction = useLatestCallback((
|
|
525
555
|
price: number,
|
|
526
556
|
time: number,
|
|
527
557
|
x: number,
|
|
528
558
|
y: number,
|
|
529
559
|
candleJson: string | null,
|
|
530
|
-
) {
|
|
560
|
+
) => {
|
|
531
561
|
const candle: CandlePoint | undefined = candleJson
|
|
532
562
|
? (JSON.parse(candleJson) as CandlePoint)
|
|
533
563
|
: undefined;
|
|
534
564
|
onScrubAction?.({ price, time, x, y, candle });
|
|
535
|
-
}
|
|
565
|
+
});
|
|
536
566
|
|
|
537
567
|
/* istanbul ignore next -- invoked only via scheduleOnRN from UI-thread gesture */
|
|
538
|
-
|
|
568
|
+
const handleScrub = useLatestCallback((
|
|
539
569
|
x: number,
|
|
540
570
|
y: number,
|
|
541
571
|
time: number,
|
|
542
572
|
value: number,
|
|
543
573
|
candleJson: string | null,
|
|
544
574
|
gapJson: string | null,
|
|
545
|
-
|
|
575
|
+
markerUpdate: Marker[] | undefined,
|
|
576
|
+
) => {
|
|
546
577
|
const candle: CandlePoint | undefined = candleJson
|
|
547
578
|
? (JSON.parse(candleJson) as CandlePoint)
|
|
548
579
|
: undefined;
|
|
549
580
|
const gap: CandleGap | undefined = gapJson
|
|
550
581
|
? (JSON.parse(gapJson) as CandleGap)
|
|
551
582
|
: undefined;
|
|
552
|
-
|
|
553
|
-
|
|
583
|
+
if (markerUpdate !== undefined) jsScrubMarkers.current = markerUpdate;
|
|
584
|
+
onScrub?.({
|
|
585
|
+
time, value, x, y, candle, gap,
|
|
586
|
+
...(markerOptions ? { markers: jsScrubMarkers.current } : {}),
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const handleScrubCandleChange = useLatestCallback((candleJson: string | null) => {
|
|
591
|
+
onScrubCandleChange?.(
|
|
592
|
+
candleJson ? (JSON.parse(candleJson) as CandlePoint) : null,
|
|
593
|
+
);
|
|
594
|
+
});
|
|
554
595
|
|
|
555
596
|
/* istanbul ignore next */
|
|
556
|
-
|
|
597
|
+
const handleScrubEnd = useLatestCallback(() => {
|
|
557
598
|
onScrub?.(null);
|
|
558
|
-
}
|
|
599
|
+
});
|
|
559
600
|
|
|
560
601
|
/* istanbul ignore next */
|
|
561
|
-
|
|
602
|
+
const handleGestureStart = useLatestCallback(() => {
|
|
562
603
|
onGestureStart?.();
|
|
563
|
-
}
|
|
604
|
+
});
|
|
564
605
|
|
|
565
606
|
/* istanbul ignore next */
|
|
566
|
-
|
|
607
|
+
const handleGestureEnd = useLatestCallback(() => {
|
|
567
608
|
onGestureEnd?.();
|
|
568
|
-
}
|
|
609
|
+
});
|
|
569
610
|
|
|
570
611
|
const hasOnScrub = onScrub != null;
|
|
571
612
|
const hasOnGestureStart = onGestureStart != null;
|
|
@@ -597,20 +638,26 @@ export function useCrosshair(
|
|
|
597
638
|
}
|
|
598
639
|
const gap = scrubGap.get();
|
|
599
640
|
const gapJson = gap ? JSON.stringify(gap) : null;
|
|
600
|
-
return
|
|
641
|
+
return {
|
|
642
|
+
point: JSON.stringify([time, val, x, dotY, candleJson, gapJson]),
|
|
643
|
+
markers: markerOptions ? scrubMarkers.get() : undefined,
|
|
644
|
+
};
|
|
601
645
|
},
|
|
602
646
|
(curr, prev) => {
|
|
603
647
|
"worklet";
|
|
604
648
|
if (!hasOnScrub) return;
|
|
605
|
-
if (
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
curr === "__pending__"
|
|
609
|
-
|
|
649
|
+
if (typeof curr === "string") {
|
|
650
|
+
// No ScrubPoint can represent an unpriced gap. Clear opt-in trade
|
|
651
|
+
// readouts once when leaving a valid point rather than leave stale data.
|
|
652
|
+
if (markerOptions && curr === "__pending__" && prev && typeof prev === "object") {
|
|
653
|
+
scheduleOnRN(handleScrubEnd);
|
|
654
|
+
}
|
|
610
655
|
return;
|
|
611
656
|
}
|
|
612
|
-
|
|
613
|
-
const
|
|
657
|
+
const previous = typeof prev === "object" ? prev : null;
|
|
658
|
+
const markersChanged = curr.markers !== previous?.markers;
|
|
659
|
+
if (curr.point === previous?.point && !markersChanged) return;
|
|
660
|
+
const row = JSON.parse(curr.point) as [
|
|
614
661
|
number,
|
|
615
662
|
number,
|
|
616
663
|
number,
|
|
@@ -618,7 +665,31 @@ export function useCrosshair(
|
|
|
618
665
|
string | null,
|
|
619
666
|
string | null,
|
|
620
667
|
];
|
|
621
|
-
scheduleOnRN(handleScrub, row[2], row[3], row[0], row[1], row[4], row[5]
|
|
668
|
+
scheduleOnRN(handleScrub, row[2], row[3], row[0], row[1], row[4], row[5],
|
|
669
|
+
markersChanged ? curr.markers : undefined);
|
|
670
|
+
},
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
const hasOnScrubCandleChange = onScrubCandleChange != null;
|
|
674
|
+
|
|
675
|
+
// Keyed on the candle's bucket time rather than the candle itself, so the
|
|
676
|
+
// forming candle's ticks don't re-fire it: one bridge crossing per candle.
|
|
677
|
+
useAnimatedReaction(
|
|
678
|
+
() => {
|
|
679
|
+
"worklet";
|
|
680
|
+
if (!hasOnScrubCandleChange || !isCandleMode || !scrubActive.get()) {
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
return scrubCandle.get()?.time ?? null;
|
|
684
|
+
},
|
|
685
|
+
(curr, prev) => {
|
|
686
|
+
"worklet";
|
|
687
|
+
if (!hasOnScrubCandleChange || curr === prev) return;
|
|
688
|
+
const candle = curr === null ? null : scrubCandle.get();
|
|
689
|
+
scheduleOnRN(
|
|
690
|
+
handleScrubCandleChange,
|
|
691
|
+
candle ? JSON.stringify(candle) : null,
|
|
692
|
+
);
|
|
622
693
|
},
|
|
623
694
|
);
|
|
624
695
|
|
|
@@ -634,311 +705,374 @@ export function useCrosshair(
|
|
|
634
705
|
? SCRUB_ACTION_PRESS_HOLD_MS
|
|
635
706
|
: panGestureDelay;
|
|
636
707
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
708
|
+
const {
|
|
709
|
+
canvasWidth: canvasWidthSV,
|
|
710
|
+
canvasHeight: canvasHeightSV,
|
|
711
|
+
displayMin: displayMinSV,
|
|
712
|
+
displayMax: displayMaxSV,
|
|
713
|
+
timestamp: timestampSV,
|
|
714
|
+
displayWindow: displayWindowSV,
|
|
715
|
+
} = engine;
|
|
716
|
+
const { gesture, tapGesture } = useMemo(() => {
|
|
717
|
+
// `scrub.snapToCandles`: quantize the scrub X to the hovered candle's center
|
|
718
|
+
// before it enters `scrubX`, so the crosshair — and everything derived from
|
|
719
|
+
// it (time, tooltip, dim edge) — jumps candle-to-candle instead of gliding.
|
|
720
|
+
// Line mode and gaps between candles pass the raw X through.
|
|
721
|
+
/* istanbul ignore next -- worklet, called only from UI-thread gesture handlers */
|
|
722
|
+
const snapCandleX = (x: number): number => {
|
|
723
|
+
"worklet";
|
|
724
|
+
if (!snapToCandles || !isCandleMode || !candlesSV) return x;
|
|
725
|
+
return snapScrubXToCandleCenter(
|
|
726
|
+
x,
|
|
727
|
+
candlesSV.get(),
|
|
728
|
+
liveCandleSV?.get() ?? null,
|
|
729
|
+
candleWidthSecs,
|
|
730
|
+
padding,
|
|
731
|
+
canvasWidthSV.get(),
|
|
732
|
+
timestampSV.get(),
|
|
733
|
+
displayWindowSV.get(),
|
|
734
|
+
chartGaps,
|
|
735
|
+
);
|
|
736
|
+
};
|
|
657
737
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
longPressMs,
|
|
674
|
-
e,
|
|
675
|
-
fingerDown,
|
|
676
|
-
downX,
|
|
677
|
-
downY,
|
|
678
|
-
downAtMs,
|
|
679
|
-
holdBroken,
|
|
680
|
-
);
|
|
681
|
-
},
|
|
682
|
-
)
|
|
683
|
-
// Stationary hold: drift beyond the slop while the long-press is still
|
|
684
|
-
// pending fails the pan, so a drag can never mature into a scrub.
|
|
685
|
-
.onTouchesMove(
|
|
686
|
-
/* istanbul ignore next */ (e, manager) => {
|
|
687
|
-
"worklet";
|
|
688
|
-
delayedPanTouchMove(
|
|
689
|
-
longPressMs,
|
|
690
|
-
e,
|
|
691
|
-
manager,
|
|
692
|
-
panActivated,
|
|
693
|
-
downX,
|
|
694
|
-
downY,
|
|
695
|
-
holdBroken,
|
|
696
|
-
);
|
|
697
|
-
},
|
|
698
|
-
)
|
|
699
|
-
.onTouchesUp(
|
|
700
|
-
/* istanbul ignore next */ (e, manager) => {
|
|
701
|
-
"worklet";
|
|
702
|
-
delayedPanTouchUp(longPressMs, e, manager, fingerDown, panActivated);
|
|
703
|
-
},
|
|
704
|
-
)
|
|
705
|
-
.onTouchesCancelled(
|
|
706
|
-
/* istanbul ignore next */ () => {
|
|
707
|
-
"worklet";
|
|
708
|
-
delayedPanTouchCancelled(longPressMs, fingerDown);
|
|
709
|
-
},
|
|
710
|
-
)
|
|
711
|
-
// Start scrubbing on ACTIVE (onStart), not on touch-down (onBegin):
|
|
712
|
-
// `activateAfterLongPress` only delays activation, so onBegin still fires
|
|
713
|
-
// immediately — using it would scrub instantly and ignore panGestureDelay,
|
|
714
|
-
// and leave scrubActive stuck for taps that never reach the long-press.
|
|
715
|
-
.onStart(
|
|
716
|
-
/* istanbul ignore next */ (e) => {
|
|
717
|
-
"worklet";
|
|
718
|
-
if (
|
|
719
|
-
!shouldStartDelayedPan(
|
|
738
|
+
let gesture = Gesture.Pan()
|
|
739
|
+
.maxPointers(1)
|
|
740
|
+
.shouldCancelWhenOutside(false)
|
|
741
|
+
.onTouchesDown(
|
|
742
|
+
/* istanbul ignore next */ (e) => {
|
|
743
|
+
"worklet";
|
|
744
|
+
// Overlay drags decide ownership at touch-down. Preserve that point
|
|
745
|
+
// even without a hold: the finger can enter a grabRange before the
|
|
746
|
+
// scrub reaches its horizontal activation threshold.
|
|
747
|
+
const touch = e.changedTouches[0];
|
|
748
|
+
if (touch) {
|
|
749
|
+
downX.set(touch.x);
|
|
750
|
+
downY.set(touch.y);
|
|
751
|
+
}
|
|
752
|
+
delayedPanTouchDown(
|
|
720
753
|
longPressMs,
|
|
754
|
+
e,
|
|
721
755
|
fingerDown,
|
|
722
|
-
|
|
756
|
+
downX,
|
|
757
|
+
downY,
|
|
723
758
|
downAtMs,
|
|
724
759
|
holdBroken,
|
|
725
|
-
scrollActiveSV,
|
|
726
|
-
)
|
|
727
|
-
)
|
|
728
|
-
return;
|
|
729
|
-
if (!enabled) return;
|
|
730
|
-
// Scrub-action: once a reticle is placed, drag adjusts it (2D — the Y is
|
|
731
|
-
// the price). The ephemeral live-scrub never engages, so scrubActive
|
|
732
|
-
// stays false and the live crosshair hides itself.
|
|
733
|
-
if (hasScrubAction && lockActive.get()) {
|
|
734
|
-
lockX.set(
|
|
735
|
-
clampPlotX(
|
|
736
|
-
e.x,
|
|
737
|
-
padding.left,
|
|
738
|
-
engine.canvasWidth.get(),
|
|
739
|
-
padding.right,
|
|
740
|
-
),
|
|
741
760
|
);
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
761
|
+
},
|
|
762
|
+
)
|
|
763
|
+
// Stationary hold: drift beyond the slop while the long-press is still
|
|
764
|
+
// pending fails the pan, so a drag can never mature into a scrub.
|
|
765
|
+
.onTouchesMove(
|
|
766
|
+
/* istanbul ignore next */ (e, manager) => {
|
|
767
|
+
"worklet";
|
|
768
|
+
delayedPanTouchMove(
|
|
769
|
+
longPressMs,
|
|
770
|
+
e,
|
|
771
|
+
manager,
|
|
772
|
+
panActivated,
|
|
773
|
+
downX,
|
|
774
|
+
downY,
|
|
775
|
+
holdBroken,
|
|
776
|
+
);
|
|
777
|
+
},
|
|
778
|
+
)
|
|
779
|
+
.onTouchesUp(
|
|
780
|
+
/* istanbul ignore next */ (e, manager) => {
|
|
781
|
+
"worklet";
|
|
782
|
+
delayedPanTouchUp(longPressMs, e, manager, fingerDown, panActivated);
|
|
783
|
+
},
|
|
784
|
+
)
|
|
785
|
+
.onTouchesCancelled(
|
|
786
|
+
/* istanbul ignore next */ () => {
|
|
787
|
+
"worklet";
|
|
788
|
+
delayedPanTouchCancelled(longPressMs, fingerDown);
|
|
789
|
+
},
|
|
790
|
+
)
|
|
791
|
+
// Start scrubbing on ACTIVE (onStart), not on touch-down (onBegin):
|
|
792
|
+
// `activateAfterLongPress` only delays activation, so onBegin still fires
|
|
793
|
+
// immediately — using it would scrub instantly and ignore panGestureDelay,
|
|
794
|
+
// and leave scrubActive stuck for taps that never reach the long-press.
|
|
795
|
+
.onStart(
|
|
796
|
+
/* istanbul ignore next */ (e) => {
|
|
797
|
+
"worklet";
|
|
798
|
+
if (axisScaleActive?.get()) return;
|
|
799
|
+
if (
|
|
800
|
+
!shouldStartDelayedPan(
|
|
801
|
+
longPressMs,
|
|
802
|
+
fingerDown,
|
|
803
|
+
panActivated,
|
|
804
|
+
downAtMs,
|
|
805
|
+
holdBroken,
|
|
806
|
+
scrollActiveSV,
|
|
807
|
+
)
|
|
808
|
+
)
|
|
809
|
+
return;
|
|
810
|
+
if (!enabled) return;
|
|
811
|
+
// Scrub-action: once a reticle is placed, drag adjusts it (2D — the Y is
|
|
812
|
+
// the price). The ephemeral live-scrub never engages, so scrubActive
|
|
813
|
+
// stays false and the live crosshair hides itself.
|
|
814
|
+
if (hasScrubAction && lockActive.get()) {
|
|
815
|
+
lockX.set(
|
|
816
|
+
clampPlotX(
|
|
817
|
+
e.x,
|
|
818
|
+
padding.left,
|
|
819
|
+
canvasWidthSV.get(),
|
|
820
|
+
padding.right,
|
|
821
|
+
),
|
|
752
822
|
);
|
|
753
|
-
|
|
823
|
+
// Freeze the chosen price (value at the pointer Y); the line's Y is
|
|
824
|
+
// re-derived from it so the level stays put in PRICE as the axis rescales.
|
|
825
|
+
{
|
|
826
|
+
const p = computeValueAtY(
|
|
827
|
+
e.y,
|
|
828
|
+
displayMinSV.get(),
|
|
829
|
+
displayMaxSV.get(),
|
|
830
|
+
canvasHeightSV.get(),
|
|
831
|
+
padding.top,
|
|
832
|
+
padding.bottom,
|
|
833
|
+
);
|
|
834
|
+
if (p !== null) lockPriceValue.set(p);
|
|
835
|
+
}
|
|
836
|
+
return;
|
|
754
837
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
scrubActive,
|
|
774
|
-
gestureStarted,
|
|
775
|
-
);
|
|
776
|
-
if (hasOnGestureStart) scheduleOnRN(handleGestureStart);
|
|
777
|
-
},
|
|
778
|
-
)
|
|
779
|
-
.onUpdate(
|
|
780
|
-
/* istanbul ignore next */ (e) => {
|
|
781
|
-
"worklet";
|
|
782
|
-
if (!enabled) return;
|
|
783
|
-
if (hasScrubAction && lockActive.get()) {
|
|
784
|
-
lockX.set(
|
|
785
|
-
clampPlotX(
|
|
786
|
-
e.x,
|
|
787
|
-
padding.left,
|
|
788
|
-
engine.canvasWidth.get(),
|
|
789
|
-
padding.right,
|
|
790
|
-
),
|
|
838
|
+
// Defer to a marker / pressable badge under the finger: don't start a
|
|
839
|
+
// live scrub (or drop a crosshair) where the press is routed to an
|
|
840
|
+
// overlay tap. `scrubActive` is only set here, so bailing in `onStart`
|
|
841
|
+
// also keeps a follow-on drag from showing a crosshair — no `onUpdate`
|
|
842
|
+
// guard needed. (Plain-scrub counterpart of the scrub-action tap defer.)
|
|
843
|
+
if (
|
|
844
|
+
deferTapHit !== undefined &&
|
|
845
|
+
deferTapHit(downX.get(), downY.get())
|
|
846
|
+
)
|
|
847
|
+
return;
|
|
848
|
+
startPlainScrub(
|
|
849
|
+
snapCandleX(e.x),
|
|
850
|
+
padding,
|
|
851
|
+
canvasWidthSV.get(),
|
|
852
|
+
clampPlainScrubToPlot,
|
|
853
|
+
scrubX,
|
|
854
|
+
scrubActive,
|
|
855
|
+
gestureStarted,
|
|
791
856
|
);
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
857
|
+
if (hasOnGestureStart) scheduleOnRN(handleGestureStart);
|
|
858
|
+
},
|
|
859
|
+
)
|
|
860
|
+
.onUpdate(
|
|
861
|
+
/* istanbul ignore next */ (e) => {
|
|
862
|
+
"worklet";
|
|
863
|
+
if (axisScaleActive?.get()) return;
|
|
864
|
+
if (!enabled) return;
|
|
865
|
+
if (hasScrubAction && lockActive.get()) {
|
|
866
|
+
lockX.set(
|
|
867
|
+
clampPlotX(
|
|
868
|
+
e.x,
|
|
869
|
+
padding.left,
|
|
870
|
+
canvasWidthSV.get(),
|
|
871
|
+
padding.right,
|
|
872
|
+
),
|
|
802
873
|
);
|
|
803
|
-
|
|
874
|
+
// Freeze the chosen price (value at the pointer Y); the line's Y is
|
|
875
|
+
// re-derived from it so the level stays put in PRICE as the axis rescales.
|
|
876
|
+
{
|
|
877
|
+
const p = computeValueAtY(
|
|
878
|
+
e.y,
|
|
879
|
+
displayMinSV.get(),
|
|
880
|
+
displayMaxSV.get(),
|
|
881
|
+
canvasHeightSV.get(),
|
|
882
|
+
padding.top,
|
|
883
|
+
padding.bottom,
|
|
884
|
+
);
|
|
885
|
+
if (p !== null) lockPriceValue.set(p);
|
|
886
|
+
}
|
|
887
|
+
return;
|
|
804
888
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
889
|
+
updatePlainScrub(
|
|
890
|
+
snapCandleX(e.x),
|
|
891
|
+
padding,
|
|
892
|
+
canvasWidthSV.get(),
|
|
893
|
+
clampPlainScrubToPlot,
|
|
894
|
+
scrubX,
|
|
895
|
+
scrubActive,
|
|
896
|
+
);
|
|
897
|
+
},
|
|
898
|
+
)
|
|
899
|
+
.onFinalize(
|
|
900
|
+
/* istanbul ignore next */ () => {
|
|
901
|
+
"worklet";
|
|
902
|
+
resetDelayedPanGuard(fingerDown, panActivated, holdBroken);
|
|
903
|
+
// A lock-adjust drag leaves the reticle in place (scrubActive was never
|
|
904
|
+
// set); a live-scrub clears its crosshair. Always clear scrubActive so a
|
|
905
|
+
// stray scrub can never linger behind a placed reticle.
|
|
906
|
+
if (scrubActive.get()) {
|
|
907
|
+
scrubActive.set(false);
|
|
908
|
+
if (hasOnScrub) scheduleOnRN(handleScrubEnd);
|
|
909
|
+
}
|
|
910
|
+
if (gestureStarted.get()) {
|
|
911
|
+
gestureStarted.set(false);
|
|
912
|
+
if (hasOnGestureEnd) scheduleOnRN(handleGestureEnd);
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
);
|
|
916
|
+
|
|
917
|
+
// Passing zero-valued activation modifiers lets RNGH's iOS pan recognizer
|
|
918
|
+
// activate before the axis constraints classify the drag. Only configure a
|
|
919
|
+
// hold when one is requested, and reserve minDistance(0) for scrub-action's
|
|
920
|
+
// deliberate press-hold interaction.
|
|
921
|
+
if (longPressMs > 0) {
|
|
922
|
+
gesture = gesture.activateAfterLongPress(longPressMs);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
if (hasScrubAction) {
|
|
926
|
+
gesture = gesture.minDistance(0);
|
|
927
|
+
} else {
|
|
928
|
+
// Lock mode needs free vertical drag (Y = price), so the failOffsetY clamp —
|
|
929
|
+
// which would kill a vertical adjust — is applied only outside scrub-action.
|
|
930
|
+
gesture = gesture
|
|
931
|
+
.activeOffsetX([-SCRUB_ACTIVATE_X_PX, SCRUB_ACTIVATE_X_PX])
|
|
932
|
+
.failOffsetY([-SCRUB_FAIL_Y_PX, SCRUB_FAIL_Y_PX]);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// Restrict recognition by touch-down position. This rejects before ACTIVE,
|
|
936
|
+
// leaving outside starts to competing/parent gestures. Once accepted,
|
|
937
|
+
// `shouldCancelWhenOutside(false)` keeps tracking beyond these bounds.
|
|
938
|
+
const scrubHitSlop = resolveScrubHitSlop(
|
|
939
|
+
padding,
|
|
940
|
+
clampPlainScrubToPlot,
|
|
941
|
+
scrubBottomExclude,
|
|
833
942
|
);
|
|
943
|
+
if (scrubHitSlop) gesture = gesture.hitSlop(scrubHitSlop);
|
|
834
944
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
// Built only in scrub-action mode (the plain-scrub path never constructs a Tap).
|
|
866
|
-
/* istanbul ignore next -- gesture worklet runs on the UI thread, not in Jest */
|
|
867
|
-
const handleActionTap = (e: { x: number; y: number }, success: boolean) => {
|
|
868
|
-
"worklet";
|
|
869
|
-
if (!enabled || !hasScrubAction || !success) return;
|
|
870
|
-
if (lockActive.get()) {
|
|
871
|
-
// 1. Action-badge press → fire onScrubAction with the chosen price.
|
|
872
|
-
const rect = actionBadge.get();
|
|
873
|
-
if (rect.visible && pointInRect(e.x, e.y, rect, ACTION_HIT_SLOP)) {
|
|
874
|
-
const price = lockPrice.get();
|
|
875
|
-
if (price !== null) {
|
|
876
|
-
let candleJson: string | null = null;
|
|
877
|
-
if (isCandleMode) {
|
|
878
|
-
const c = lockCandle.get();
|
|
879
|
-
if (c) candleJson = JSON.stringify(c);
|
|
945
|
+
// Tap: place/move the reticle, press the action badge, or dismiss the lock.
|
|
946
|
+
// Composed ahead of the pan by the controller, so a tap is never swallowed.
|
|
947
|
+
// Built only in scrub-action mode (the plain-scrub path never constructs a Tap).
|
|
948
|
+
/* istanbul ignore next -- gesture worklet runs on the UI thread, not in Jest */
|
|
949
|
+
const handleActionTap = (e: { x: number; y: number }, success: boolean) => {
|
|
950
|
+
"worklet";
|
|
951
|
+
if (!enabled || !hasScrubAction || !success) return;
|
|
952
|
+
if (lockActive.get()) {
|
|
953
|
+
// 1. Action-badge press → fire onScrubAction with the chosen price.
|
|
954
|
+
const rect = actionBadge.get();
|
|
955
|
+
if (rect.visible && pointInRect(e.x, e.y, rect, ACTION_HIT_SLOP)) {
|
|
956
|
+
const price = lockPrice.get();
|
|
957
|
+
if (price !== null) {
|
|
958
|
+
let candleJson: string | null = null;
|
|
959
|
+
if (isCandleMode) {
|
|
960
|
+
const c = lockCandle.get();
|
|
961
|
+
if (c) candleJson = JSON.stringify(c);
|
|
962
|
+
}
|
|
963
|
+
if (hasOnScrubAction)
|
|
964
|
+
scheduleOnRN(
|
|
965
|
+
handleScrubAction,
|
|
966
|
+
price,
|
|
967
|
+
lockTime.get(),
|
|
968
|
+
lockX.get(),
|
|
969
|
+
lockY.get(),
|
|
970
|
+
candleJson,
|
|
971
|
+
);
|
|
972
|
+
// Clear the reticle once the action fires, so no crosshair lingers after
|
|
973
|
+
// the order is placed via the badge.
|
|
974
|
+
if (dismissOnAction) lockActive.set(false);
|
|
880
975
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
// Clear the reticle once the action fires, so no crosshair lingers after
|
|
891
|
-
// the order is placed via the badge.
|
|
892
|
-
if (dismissOnAction) lockActive.set(false);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
// 2. Dismiss: tap the reticle itself, or any empty tap when configured.
|
|
979
|
+
const onReticle =
|
|
980
|
+
Math.abs(e.x - lockX.get()) <= RETICLE_HIT &&
|
|
981
|
+
Math.abs(e.y - lockY.get()) <= RETICLE_HIT;
|
|
982
|
+
if (onReticle || dismissOnTapOutside) {
|
|
983
|
+
lockActive.set(false);
|
|
984
|
+
return;
|
|
893
985
|
}
|
|
894
|
-
return;
|
|
895
|
-
}
|
|
896
|
-
// 2. Dismiss: tap the reticle itself, or any empty tap when configured.
|
|
897
|
-
const onReticle =
|
|
898
|
-
Math.abs(e.x - lockX.get()) <= RETICLE_HIT &&
|
|
899
|
-
Math.abs(e.y - lockY.get()) <= RETICLE_HIT;
|
|
900
|
-
if (onReticle || dismissOnTapOutside) {
|
|
901
|
-
lockActive.set(false);
|
|
902
|
-
return;
|
|
903
986
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
};
|
|
987
|
+
// 2.5. Defer to a marker / reference-line badge under the tap: when one
|
|
988
|
+
// coexists, the tap fires both this handler and that overlay's tap
|
|
989
|
+
// (Simultaneous) — yield so it acts instead of dropping a reticle on top.
|
|
990
|
+
if (deferTapHit !== undefined && deferTapHit(e.x, e.y)) return;
|
|
991
|
+
// 3. Place / move the reticle. Clear any in-progress live-scrub so its
|
|
992
|
+
// crosshair never shows behind the placed reticle.
|
|
993
|
+
scrubActive.set(false);
|
|
994
|
+
lockX.set(
|
|
995
|
+
clampPlotX(e.x, padding.left, canvasWidthSV.get(), padding.right),
|
|
996
|
+
);
|
|
997
|
+
// Freeze the chosen price at the tap Y; the line's Y derives from it (see
|
|
998
|
+
// `lockY`). No-op until the canvas is laid out (price === null).
|
|
999
|
+
const placedPrice = computeValueAtY(
|
|
1000
|
+
e.y,
|
|
1001
|
+
displayMinSV.get(),
|
|
1002
|
+
displayMaxSV.get(),
|
|
1003
|
+
canvasHeightSV.get(),
|
|
1004
|
+
padding.top,
|
|
1005
|
+
padding.bottom,
|
|
1006
|
+
);
|
|
1007
|
+
if (placedPrice === null) return;
|
|
1008
|
+
lockPriceValue.set(placedPrice);
|
|
1009
|
+
lockActive.set(true);
|
|
1010
|
+
};
|
|
929
1011
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1012
|
+
let tapGesture = hasScrubAction
|
|
1013
|
+
? Gesture.Tap()
|
|
1014
|
+
.maxDuration(250)
|
|
1015
|
+
.maxDistance(SCRUB_ACTION_TAP_SLOP)
|
|
1016
|
+
.onEnd(handleActionTap)
|
|
1017
|
+
: undefined;
|
|
1018
|
+
// Keep the bottom axis scroll-only. Do not apply horizontal plot bounds here:
|
|
1019
|
+
// the action badge is intentionally tappable in the right gutter.
|
|
1020
|
+
const tapHitSlop = resolveScrubHitSlop(padding, false, scrubBottomExclude);
|
|
1021
|
+
if (tapGesture && tapHitSlop) tapGesture = tapGesture.hitSlop(tapHitSlop);
|
|
1022
|
+
return { gesture, tapGesture };
|
|
1023
|
+
}, [
|
|
1024
|
+
actionBadge,
|
|
1025
|
+
axisScaleActive,
|
|
1026
|
+
candleWidthSecs,
|
|
1027
|
+
candlesSV,
|
|
1028
|
+
canvasHeightSV,
|
|
1029
|
+
canvasWidthSV,
|
|
1030
|
+
chartGaps,
|
|
1031
|
+
clampPlainScrubToPlot,
|
|
1032
|
+
deferTapHit,
|
|
1033
|
+
dismissOnAction,
|
|
1034
|
+
dismissOnTapOutside,
|
|
1035
|
+
displayMaxSV,
|
|
1036
|
+
displayMinSV,
|
|
1037
|
+
displayWindowSV,
|
|
1038
|
+
downAtMs,
|
|
1039
|
+
downX,
|
|
1040
|
+
downY,
|
|
1041
|
+
enabled,
|
|
1042
|
+
fingerDown,
|
|
1043
|
+
gestureStarted,
|
|
1044
|
+
handleGestureEnd,
|
|
1045
|
+
handleGestureStart,
|
|
1046
|
+
handleScrubAction,
|
|
1047
|
+
handleScrubEnd,
|
|
1048
|
+
hasOnGestureEnd,
|
|
1049
|
+
hasOnGestureStart,
|
|
1050
|
+
hasOnScrub,
|
|
1051
|
+
hasOnScrubAction,
|
|
1052
|
+
hasScrubAction,
|
|
1053
|
+
holdBroken,
|
|
1054
|
+
isCandleMode,
|
|
1055
|
+
liveCandleSV,
|
|
1056
|
+
lockActive,
|
|
1057
|
+
lockCandle,
|
|
1058
|
+
lockPrice,
|
|
1059
|
+
lockPriceValue,
|
|
1060
|
+
lockTime,
|
|
1061
|
+
lockX,
|
|
1062
|
+
lockY,
|
|
1063
|
+
longPressMs,
|
|
1064
|
+
padding,
|
|
1065
|
+
panActivated,
|
|
1066
|
+
scrollActiveSV,
|
|
1067
|
+
scrubActive,
|
|
1068
|
+
scrubBottomExclude,
|
|
1069
|
+
scrubX,
|
|
1070
|
+
snapToCandles,
|
|
1071
|
+
timestampSV,
|
|
1072
|
+
]);
|
|
940
1073
|
|
|
941
1074
|
return {
|
|
1075
|
+
scrubMarkers,
|
|
942
1076
|
scrubX,
|
|
943
1077
|
scrubActive,
|
|
944
1078
|
scrubTime,
|