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

Ignore hits on transparent parts of the image #217

Open
bramp opened this issue Oct 10, 2023 · 2 comments
Open

Ignore hits on transparent parts of the image #217

bramp opened this issue Oct 10, 2023 · 2 comments

Comments

@bramp
Copy link
Contributor

bramp commented Oct 10, 2023

It seems the entire rectangle of the RenderVectorGraphic absorbs hits (for example when a user taps the screen).

Would it be possible to adjust the hitTestSelf to only return true if the hit is on a non-transparent part of the SVG?

@dnfield
Copy link
Owner

dnfield commented Oct 10, 2023

That would be expensive and probably not quite the desired behavior in a lot of cases.

Imagine, for example, you have an icon you're painting on a button - you don't want to do expensive hit testing logic to see if the hit falls within some complicated path describing the outline of the icon just to end up getting a hit on the button "under" it...

@bramp
Copy link
Contributor Author

bramp commented Oct 10, 2023

Oh absolutely, it's not desirable for every use case. Maybe I should have framed it as "Could you make it optional" to ignore hits in the transparent parts of the SVG.

In my use case, I have a circular button drawn as a SVG, and with the current hit test you can hit outside of the bounds of what's visible, which is undesirable.

I suspect the work around, is for me calculating a mask and implementing my own "hit test" on top of the SVG.

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

2 participants