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 for #382: OxyMouseEvents not caught due to InvalidatePlot() #1055

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

HermanEldering
Copy link
Contributor

Fixes #382.

Checklist

  • I have included examples or tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • I have cleaned up the commit history (use rebase and squash)

Remarks

I don't use git often, so I'm reading up on the rebase and squash. With regards to the tests this issue probably not easy to unit test. If I get around to it the best I could do is create an example showing the issue.

This fix is tested in my own use of OxyPlot, and it is somewhat similar to a fix mentioned in the referenced issue #382. I also tried some of the OxyPlot WPF examples and in general they appear to function properly (context menus/zoom/pan/trackers), however my change breaks the tooltips.

For WPF tooltips the mouse must be directly over the control, now a grid is in between. I did not find a way to resolve this using the native WPF tooltips.

@oxyplot/admins

@objorke
Copy link
Member

objorke commented Jan 19, 2017

Thanks! This looks OK to me. The other XAML platforms should probably be updated too?
I'll squash when completing this PR!

@objorke objorke merged commit 16ba775 into oxyplot:develop Jan 19, 2017
HermanEldering added a commit to HermanEldering/oxyplot that referenced this pull request Feb 7, 2017
@HermanEldering
Copy link
Contributor Author

Thanks. I haven't looked into the other platforms yet. I think removing all controls and generation new controls is what causes the issue, so it not only depends on OxyPlot but also a bit on the implementation of the XAML platform itself.

@holgerschl
Copy link

holgerschl commented Aug 25, 2018

I had the follwing issue when using OxyPlot 1.0.0:
The mousdown event does not fire when I click on a line series. It works fine outside of the line series.
With OxyPlot 2.0.0.unstable-1035 it went away - was this what you fixed?
In that case a test is easy: Plot a line series and click on it - the mousedown event should fire.

@HermanEldering
Copy link
Contributor Author

@holgerschl I am not sure what exactly your question is. I think in my case the problem was mostly with clicking a line annotation or the plot area in general, but the person that created the associated issue #382 had the problem clicking a series.

In this case some events will be lost, and the problem will be worse when the plot is invalidated more frequently. If you have your problem even when you're not invalidating/updating the plot or if you don't see any events at all for the series it is probably another problem.

The basic problem in this ticket is that the UI elements are being updated while events are generated. So what I believe that happened is that you would click on an UI element, but before the OxyPlot event would fire that UI element might be destroyed and replaced with a new element. Resulting in events getting lost.

The solution that I have implemented in this pull request is to create a transparant grid on top of all UI elements so that all mouse events are caught by the grid which is not destroyed during the invalidate.

@holgerschl
Copy link

holgerschl commented Aug 28, 2018

Ok - that naturally fixed my problem as well. But the underlying problem was different - on a series the MouseDown event (either of the PlotController or of the series itself) never fired.

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.

OxyMouseEvents not caught due to InvalidatePlot()
3 participants