From b17eccfe665b9d9e200ec1d3a774a7d5f06ae1c6 Mon Sep 17 00:00:00 2001 From: justorez Date: Fri, 24 Feb 2023 23:15:37 +0800 Subject: [PATCH 1/2] fix(event): fix "dataZoom" doesn't work Event error with preventDefault. --- ec-canvas/ec-canvas.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ec-canvas/ec-canvas.js b/ec-canvas/ec-canvas.js index a308340..2f54647 100644 --- a/ec-canvas/ec-canvas.js +++ b/ec-canvas/ec-canvas.js @@ -261,5 +261,8 @@ function wrapTouch(event) { touch.offsetX = touch.x; touch.offsetY = touch.y; } + event.preventDefault = () => {}; + event.stopImmediatePropagation = () => {}; + event.stopPropagation = () => {}; return event; } From 40d2d52dd89f1e7cd6616d19e5e280441305ed8c Mon Sep 17 00:00:00 2001 From: justorez Date: Wed, 8 Mar 2023 10:33:48 +0800 Subject: [PATCH 2/2] fix: use `()=>{}` only if event methods does not exist --- ec-canvas/ec-canvas.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ec-canvas/ec-canvas.js b/ec-canvas/ec-canvas.js index 2f54647..dc091f9 100644 --- a/ec-canvas/ec-canvas.js +++ b/ec-canvas/ec-canvas.js @@ -261,8 +261,8 @@ function wrapTouch(event) { touch.offsetX = touch.x; touch.offsetY = touch.y; } - event.preventDefault = () => {}; - event.stopImmediatePropagation = () => {}; - event.stopPropagation = () => {}; + event.preventDefault ??= () => {}; + event.stopImmediatePropagation ??= () => {}; + event.stopPropagation ??= () => {}; return event; }