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

HitTest should rely on Visual #15855

Open
dr1rrb opened this issue Mar 12, 2024 · 1 comment · May be fixed by #16201
Open

HitTest should rely on Visual #15855

dr1rrb opened this issue Mar 12, 2024 · 1 comment · May be fixed by #16201
Assignees
Labels
area/performance 📈 Categorizes an issue or PR as relevant to performance area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/enhancement New feature or request project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers project/shapes-brushes 🔶 Categorizes an issue or PR as relevant to shapes and brushes triage/untriaged Indicates an issue requires triaging or verification

Comments

@dr1rrb
Copy link
Member

dr1rrb commented Mar 12, 2024

What would you like to be added

The hit-testing algorithm should rely on Visual instead of UIElement's position. Basically on Windows, the hist tests is all about "does the element as draw something non transparent on the given pixel".

Why is this needed

  • It would improve performance by allowing us to properly hit-test on the compositor thread (when we will finally have it - TransformToVisual should rely on Visual's total matrix #15854 might be needed first) in sync with the frame currently visible, dispatch to InteractionTracker if relevant or pushing it to the UIElement on UI thread.
  • Fix issue with Shape hit-testing : a Shape should be hit-testable only on drawn pixels, not on the whole "drawing area/rectangle" like it is currently

For which platform

No response

Anything else we need to know?

No response

@dr1rrb dr1rrb added kind/enhancement New feature or request triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Mar 12, 2024
@Youssef1313 Youssef1313 added area/skia ✏️ Categorizes an issue or PR as relevant to Skia project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers project/shapes-brushes 🔶 Categorizes an issue or PR as relevant to shapes and brushes area/performance 📈 Categorizes an issue or PR as relevant to performance labels Mar 12, 2024
@ramezgerges
Copy link
Contributor

ramezgerges commented Apr 9, 2024

Two observations:

  • Basically on Windows, the hist tests is all about "does the element as draw something non transparent on the given pixel".

    This isn't entirely accurate. If, for example, you draw a transparent shape, you can still receive pointer events on it. It's more like "does the element draw something on the given pixel?".

  • Fix issue with Shape hit-testing : a Shape should be hit-testable only on drawn pixels

    Actually, we can rely ONLY on shape hit-testing. In other words, we can view each element as a collection of shapes, and an element can be hit if one of its shapes contains with the given pixel.
    If we get this to work, we can drop IsViewHit and HitTestability.Invisible. An element is either Visible or Collapsed, and HitTest(element) should be true if it's both Visible and it contains a shape containing the pixel as mentioned earlier.

    Edit: Actually, we might still need IsViewHit, as it might still be needed besides hit-testing, see https://stackoverflow.com/a/42478663.

@ramezgerges ramezgerges self-assigned this Apr 9, 2024
@ramezgerges ramezgerges linked a pull request Apr 10, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance 📈 Categorizes an issue or PR as relevant to performance area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/enhancement New feature or request project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers project/shapes-brushes 🔶 Categorizes an issue or PR as relevant to shapes and brushes triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants