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

[DISCUSS] Consider using the standard offsetX/offsetY instead of layerX/layerY for modern versions of Firefox #794

Closed
plainheart opened this issue Aug 10, 2021 · 0 comments

Comments

@plainheart
Copy link
Collaborator

plainheart commented Aug 10, 2021

Here is a stale caution in the following code,

https://github.com/ecomfe/zrender/blob/master/src/core/event.ts#L62-L75

According to CANIUSE and the release note of Firefox, the offsetX and offsetY have been supported since desktop Firefox 39

Support for MouseEvent.offsetX and MouseEvent.offsetY have been added on desktop (bug 69787, but not on Firefox for Android or Firefox OS (they will be added in Firefox 43).

And they have been also supported by Firefox for Android and Firefox OS since v43

Support for MouseEvent.offsetX and MouseEvent.offsetY have been activated on Firefox for Android and Firefox OS (bug 1204841).

One consideration why I want to propose to change

I can't dispatch a manual event with expected offsetX & offsetY through the constructor of MouseEvent.

Since zrender is still using the stale un-standard layerX/layerY in Firefox, I can't construct a MouseEvent object through

const event = new MouseEvent('click', {
    bubbles: false,
    layerX: 500, // it's private and readonly for Firefox, anyone can't specify it with the constructor
    layerY: 600
})

Motivation

I'm planning to support mixed event responding in the echarts for AMap plugin: echarts-extension-amap

All the time we can only choose one interactive layer from echarts layer and map layer because of the z-index issue.
But it's possible to get both of them interactive through re-dispatch event to another layer when one layer is clicked, scrolled and etc.

So I tried this feature in the branch feat-mixed-events. It can be working well in Chrome, but can't work in Firefox for the above issue.

A demo is available here.

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

No branches or pull requests

1 participant