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

On Touch-Event is invoked on all series if more then one point is next to the tap #500

Open
georgh opened this issue Mar 31, 2017 · 0 comments

Comments

@georgh
Copy link

georgh commented Mar 31, 2017

I use the listener to make the tapped point bigger and display a snackbar.
Only the snackbar of the series added last to the graph is displayed.

Reason for this behaviour is the handling of onTouchEvent in Graphview:

    public boolean onTouchEvent(MotionEvent event) {
        boolean b = mViewport.onTouchEvent(event);
        boolean a = super.onTouchEvent(event);

        // is it a click?
        if (mTapDetector.onTouchEvent(event)) {
            for (Series s : mSeries) {
                s.onTap(event.getX(), event.getY());
            }
            if (mSecondScale != null) {
                for (Series s : mSecondScale.getSeries()) {
                    s.onTap(event.getX(), event.getY());
                }
            }
        }

if two points in two different series have a distance less then 120 to the tap both listeners will be called, because s.onTap(event.getX(), event.getY()); only knows the points of its own series and will call its listener if one point has a distance < 120.
I guess sometimes this may be the expected behaviour, but I dont know if this should be the default behaviour.
Whats your thoughts on this?

@georgh georgh mentioned this issue Mar 31, 2017
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