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

Add external touch handler for Pie Chart #1504

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

samir7osny
Copy link

Regarding the case of stacked pie charts on each other, the touch handler will work on one of them only, check this issue #1307 as well.

To try this case and understand the issue, you can go to this commit ceb4e18 and check sample 4.
image

This PR fixes this by adding the ability to calculate the touch response based on external parameter for the touched position, now you can use MouseRegion widget for example and add the stacked Pie charts inside it then pass the touched position to the charts and get the calculated response (check pie chart sample 4).

@imaNNeo
Copy link
Owner

imaNNeo commented Dec 1, 2023

There is a better solution to work with the low-level RenderBox/RenderObject and the HitTest topic.

bool hitTestSelf(Offset position) => true;

Basically, we need to run getResponseAtLocation() and return false if response is null (or something like that, you need to take a look)

/// Charts need to implement this class to tell us what [BaseTouchResponse] is available at provided [localPosition]
/// When touch/pointer event happens, we send it to the user alongside the [FlTouchEvent] using [_touchCallback]
R getResponseAtLocation(Offset localPosition);

btw, if you think it is a complicated topic (which is actually complicated), I can do that.

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.

None yet

2 participants