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

fix(continuousView): fix multi visualMap bind hoverLink listener. #17252

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/component/visualMap/ContinuousView.ts
Expand Up @@ -109,6 +109,9 @@ class ContinuousView extends VisualMapView {

private _api: ExtensionAPI;

private _ownHoverLinkFromSeriesMouseOver = (e: ElementEvent) => this._hoverLinkFromSeriesMouseOver(e);

private _ownHideIndicator = () => this._hideIndicator();
Comment on lines +112 to +114
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can refer to the SliderZoomView and use the same strategy.

Note that since some codes use this.api rather than this._api, you may need to change them to this._api after overriding the init function. And the assignment to this._api in doRender function can be moved into the init function.


doRender(
visualMapModel: ContinuousModel,
Expand Down Expand Up @@ -749,8 +752,8 @@ class ContinuousView extends VisualMapView {
const zr = this.api.getZr();

if (this.visualMapModel.option.hoverLink) {
zr.on('mouseover', this._hoverLinkFromSeriesMouseOver, this);
zr.on('mouseout', this._hideIndicator, this);
zr.on('mouseover', this._ownHoverLinkFromSeriesMouseOver, this);
zr.on('mouseout', this._ownHideIndicator, this);
}
else {
this._clearHoverLinkFromSeries();
Expand Down Expand Up @@ -866,8 +869,8 @@ class ContinuousView extends VisualMapView {
this._hideIndicator();

const zr = this.api.getZr();
zr.off('mouseover', this._hoverLinkFromSeriesMouseOver);
zr.off('mouseout', this._hideIndicator);
zr.off('mouseover', this._ownHoverLinkFromSeriesMouseOver);
zr.off('mouseout', this._ownHideIndicator);
}
private _applyTransform(vertex: number[], element: Element, inverse?: boolean, global?: boolean): number[]
private _applyTransform(vertex: Direction, element: Element, inverse?: boolean, global?: boolean): Direction
Expand Down Expand Up @@ -947,4 +950,4 @@ function getCursor(orient: Orient) {
return orient === 'vertical' ? 'ns-resize' : 'ew-resize';
}

export default ContinuousView;
export default ContinuousView;
22 changes: 22 additions & 0 deletions test/ut/core/utHelper.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 24 additions & 2 deletions test/ut/spec/component/visualMap/setOption.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/ut/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.