Skip to content

Commit bdbb23f

Browse files
committed
fix: stop propagation
1 parent 10a2c7f commit bdbb23f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/store/ChartAdapterStore.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ export default class ChartAdapterStore {
212212
}
213213

214214
window.flutterChartElement?.addEventListener('wheel', this.onWheel, { capture: true });
215-
window.flutterChartElement?.addEventListener('touchstart', this.onTouch, { capture: true });
216-
window.flutterChartElement?.addEventListener('touchmove', this.onTouch, { capture: true });
217-
window.flutterChartElement?.addEventListener('touchend', this.onTouch, { capture: true });
215+
window.addEventListener('touchstart', this.onTouch, { capture: true });
216+
window.addEventListener('touchmove', this.onTouch, { capture: true });
217+
window.addEventListener('touchend', this.onTouch, { capture: true });
218218
window.flutterChartElement?.addEventListener('dblclick', this.onDoubleClick, { capture: true });
219219
window.addEventListener('mousemove', this.onMouseMove, { capture: true });
220220
}
@@ -223,9 +223,9 @@ export default class ChartAdapterStore {
223223
window._flutter.initState.isMounted = false;
224224

225225
window.flutterChartElement?.removeEventListener('wheel', this.onWheel, { capture: true });
226-
window.flutterChartElement?.removeEventListener('touchstart', this.onTouch, { capture: true });
227-
window.flutterChartElement?.removeEventListener('touchmove', this.onTouch, { capture: true });
228-
window.flutterChartElement?.removeEventListener('touchend', this.onTouch, { capture: true });
226+
window.removeEventListener('touchstart', this.onTouch, { capture: true });
227+
window.removeEventListener('touchmove', this.onTouch, { capture: true });
228+
window.removeEventListener('touchend', this.onTouch, { capture: true });
229229
window.flutterChartElement?.removeEventListener('dblclick', this.onDoubleClick, { capture: true });
230230
window.removeEventListener('mousemove', this.onMouseMove, { capture: true });
231231
clearTimeout(this.enableVerticalScrollTimer);
@@ -286,11 +286,10 @@ export default class ChartAdapterStore {
286286
const deltaX = e.type === 'touchend' ? Math.abs(deltaXTotal) : Math.abs(xDiff);
287287
const deltaY = e.type === 'touchend' ? Math.abs(deltaYTotal) : Math.abs(yDiff);
288288
const isVerticalScroll = deltaY > deltaX;
289-
this.touchValues = isVerticalScroll ? { ...this.touchValues, deltaXTotal, deltaYTotal } : {};
289+
this.touchValues = { ...this.touchValues, deltaXTotal, deltaYTotal };
290290

291-
if (!isVerticalScroll) return;
292-
293-
if (isForcedScrollArea) {
291+
if (isForcedScrollArea && isVerticalScroll) {
292+
e.stopPropagation();
294293
if (shouldForceMaxScroll) {
295294
clearTimeout(this.scrollChartParentOnTouchTimer);
296295
this.scrollableChartParent?.scrollTo({

0 commit comments

Comments
 (0)