Skip to content

Hit test fails if mouse is over a text object #642

@vsfeedback

Description

@vsfeedback

Hello Microsoft Support,

I've drawn a text by a DrawingVisual object, but the hit test fails when the mouse pointer is on it. For hit testing I'm using a GeometryHitTestParameters and EllipseGeometry objects. I've notice that if I use a PointHitTestParameters object, so all works well.

I've attached a complete solution that show the problem. Let me point out, that this issue is very serious for us because it doesn't allows to go on in our work.
Thank you in advance.
Best regards,

Simone

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/533445/hit-test-fails-if-mouse-is-over-a-text-object.html
VSTS ticketId: 847713

These are the original issue comments:

Visual Studio Feedback System on 4/15/2019, 07:36 PM (17 days ago):

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Jeff Schwartz [MSFT] on 4/16/2019, 04:20 PM (16 days ago):

Thanks for sharing feedback @Simone Padovan. Can you elaborate more on what is not happening that you would expect?

In the attached sample I am seeing the proper events fire and callbacks fire (by setting break points and mousing over the text block). Thanks

Jeff Schwartz [MSFT] on 4/17/2019, 02:49 PM (15 days ago):

Thanks for the details. I am going to route to the WPF team.

These are the original issue solutions:

Simone Padovan solved on 4/17/2019, 10:14 AM (16 days ago), 0 votes:

Hello Jeff,

thank you for the answer. Sorry, I was unclear. Actually the HitTestCallback is called, because it is a consequence of the VisualTreeHelper.HitTest (RenderingHost.cs file line 34) method call from the mouse move event handler. But the interesting point is that the found object isn't the DrawingVisual of the text but it is the RenderingHost parent. The evidence is that you aren't able to see the "Entity found !!" message box. This occurs because the VisualTreeHelper.HitTest is called by passing a GeometryHitTestParameters as fourth parameter. Instead if you use a PointHitTestParameters you will see the message. The code is ready: simply comment/uncomment the 33 and 34 lines in the RenderingHost.cs file. Let me point out, that this issue is linked to the matrix transform at line 34 in the MainWindow.xaml.cs file: in fact if you comment it and the 37 line, the text is recognized and you will see the "Entity found !!" message box.

I think that this issue is linked to my other bug report The PathGeometry filling fails… just that the point is the area painting but the problem source is the matrix: It would be great if you solve two problems at once.

Thank you in advance.

Regards,

Simone

Metadata

Metadata

Assignees

Labels

BugProduct bug (most likely)vsfeedbackmetadata: To identify issues sourced from VSFeedback

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions