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

ICustomHitTest not working #5879

Closed
pr8x opened this issue May 6, 2021 · 4 comments · Fixed by #5923
Closed

ICustomHitTest not working #5879

pr8x opened this issue May 6, 2021 · 4 comments · Fixed by #5923
Labels

Comments

@pr8x
Copy link
Contributor

pr8x commented May 6, 2021

Describe the bug
It seems that implementing ICustomHitTest on Shape doesn't have any effect. It does work with the immediate renderer UseDeferredRendering=false) though.

To Reproduce

shape_custom_hittesting_bug.patch.txt

Expected behavior
I would expect the custom hit testing to work.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: master
@pr8x pr8x added the bug label May 6, 2021
@grokys
Copy link
Member

grokys commented May 12, 2021

Yeah, ICustomHitTest only works with the immediate renderer at the moment. I do notice that WPF seems to allow customizing hit testing by overriding HitTestCore - it might be that we need to implement this in Avalonia (which it would make sense to do with ICustomHitTest).

@grokys
Copy link
Member

grokys commented May 14, 2021

Actually, ignore the above comment. It was implemented for the deferred renderer too in this commit:

f0eafa7

However note the comment:

/// Note that this interface can only used to make a portion of a control non-hittable, it
/// cannot expand the hittable area of a control.

Might this be what you were seeing?

@mat1jaczyyy
Copy link
Contributor

Centering the line in the window in this example breaks on immediate renderer, it incorrectly hit tests in the top left corner

@RomanSoloweow
Copy link
Contributor

RomanSoloweow commented Jun 9, 2021

When using a non-fill Rectangle as an Adorner, the method

public bool HitTest(Point point) => Children.HitTestCustom(point);

returns true on the entire area, not just on the borders

As a result, all events of the Adorned element are blocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants