Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: let dispatchEvent work. issues#17638 #949

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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