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

Mouse event on wrong point #4679

Closed
pawelfus opened this Issue Oct 22, 2015 · 7 comments

Comments

Projects
None yet
5 participants
@pawelfus
Contributor

pawelfus commented Oct 22, 2015

Demo: http://jsfiddle.net/bsrnhuna/

Steps:

  • mouse over green series
  • mouse over sun
  • click on sun - nothing happens

If we hover directly sun (without hovering other spline series) - we can proper click.

I think we should follow the order of the z-indexes when it comes to mouse events. It is more intuitive to get click event on top most SVG shape.

Probably connected to the way we search for the closest point to the mouse and we already have some hovered series.

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Oct 22, 2015

Contributor

Workaround:

Bind click event to plotOptions.series and filter out unnecessary click events: http://jsfiddle.net/bsrnhuna/2/

Contributor

pawelfus commented Oct 22, 2015

Workaround:

Bind click event to plotOptions.series and filter out unnecessary click events: http://jsfiddle.net/bsrnhuna/2/

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Oct 28, 2015

Contributor

Better example: http://jsfiddle.net/bsrnhuna/3/ - with enabled tooltip, we can see what exactly happens:

  • tooltip can show "green" tooltip even when hovering "sun" series - when we click in such case, event is not called, because in our terms, we are hovering green point' series
  • works better on master branch (4.1.9-modified), but still can happen
Contributor

pawelfus commented Oct 28, 2015

Better example: http://jsfiddle.net/bsrnhuna/3/ - with enabled tooltip, we can see what exactly happens:

  • tooltip can show "green" tooltip even when hovering "sun" series - when we click in such case, event is not called, because in our terms, we are hovering green point' series
  • works better on master branch (4.1.9-modified), but still can happen
@sebastianbochan

This comment has been minimized.

Show comment
Hide comment
@sebastianbochan

sebastianbochan Nov 10, 2015

Contributor

+1

Contributor

sebastianbochan commented Nov 10, 2015

+1

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Feb 22, 2016

Contributor

Problem comes from this line. In fact there should be <=, because series with higher indexes are rendered on top of previous series. However, that still may be problem if we get setting like this:

series: [{
   data: [ ... ],
   index: 0,
   zIndex: 5
}, {
   data: [ ... ],
   index: 1,
   zIndex: 1
}]

Since zIndex is not set in Series class, we should make this checking:

          if (typeof p[dist] === 'number' && (p[dist] < distance[k] || (p[dist] === distance[k] && pick(p.series.options.zIndex, 1) >= pick(kdpoint[k].series.options.zIndex, 1))) ) {
            distance[k] = p[dist];
            kdpoint[k] = p;
          }

And we get little if-monster. Maybe we should set default series.zIndex (like 1 etc.) @TorsteinHonsi ?

Contributor

pawelfus commented Feb 22, 2016

Problem comes from this line. In fact there should be <=, because series with higher indexes are rendered on top of previous series. However, that still may be problem if we get setting like this:

series: [{
   data: [ ... ],
   index: 0,
   zIndex: 5
}, {
   data: [ ... ],
   index: 1,
   zIndex: 1
}]

Since zIndex is not set in Series class, we should make this checking:

          if (typeof p[dist] === 'number' && (p[dist] < distance[k] || (p[dist] === distance[k] && pick(p.series.options.zIndex, 1) >= pick(kdpoint[k].series.options.zIndex, 1))) ) {
            distance[k] = p[dist];
            kdpoint[k] = p;
          }

And we get little if-monster. Maybe we should set default series.zIndex (like 1 etc.) @TorsteinHonsi ?

@trpriel

This comment has been minimized.

Show comment
Hide comment
@trpriel

trpriel Mar 24, 2016

Seems like a very simple fix.
Is this going to be deployed in the next version?

trpriel commented Mar 24, 2016

Seems like a very simple fix.
Is this going to be deployed in the next version?

@onemenny

This comment has been minimized.

Show comment
Hide comment
@onemenny

onemenny Mar 24, 2016

We face the same issue to, The code is already here can this be pushed forward @TorsteinHonsi ?

onemenny commented Mar 24, 2016

We face the same issue to, The code is already here can this be pushed forward @TorsteinHonsi ?

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Mar 29, 2016

Collaborator

In both cases we would expect the tooltip to show Series 2 in the crossing point, because it is higher in Z index.

Collaborator

TorsteinHonsi commented Mar 29, 2016

In both cases we would expect the tooltip to show Series 2 in the crossing point, because it is higher in Z index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment