Skip to content

Conversation

jianqi-jin
Copy link

@jianqi-jin jianqi-jin commented Sep 10, 2022

fixed: #17638

usage:

When we want to dispatch an event. For example, a Wheel event.

step 1
Capture a wheel event and create a new wheel event base that event.

const event = new WheelEvent('wheel', e); // e is that wheel event that we captured.

step 2
Set the dispatchedOffsetX and dispatchedOffsetY attributes of the event.

event.dispatchedOffsetX = e.offsetX;
event.dispatchedOffsetY = e.offsetY;

step 3
PreventDefault and trigger/dispatch the event on Zrender.

e.preventDefault();
chart.getZr().handler.proxy.dom.dispatchEvent(event); // I just use the Echarts instance for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] How can I dispatch a wheel event programmatically?
1 participant