File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,13 @@ public void HandleHitTest()
33
33
}
34
34
}
35
35
36
- private void HitTest ( Vector2 point )
36
+ List < UiElement > hitElements = new ( ) ;
37
+
38
+ private void HitTest ( Vector2 originalPoint )
37
39
{
38
- var hitElements = new List < UiElement > ( ) ;
40
+ var transformedPoint = originalPoint ;
41
+
42
+ hitElements . Clear ( ) ;
39
43
40
44
//from back to front
41
45
foreach ( var ( _, value ) in _window . LastRenderContext . CommandBuffers . OrderBy ( x => x . Key ) )
@@ -44,19 +48,19 @@ private void HitTest(Vector2 point)
44
48
{
45
49
if ( command . Type == CommandType . Matrix )
46
50
{
47
- point = point . Multiply ( command . Matrix . Invert ( ) ) ;
51
+ transformedPoint = originalPoint . Multiply ( command . Matrix . Invert ( ) ) ;
48
52
}
49
53
else if ( command . Type == CommandType . Rect )
50
54
{
51
55
command . UiElement . Get ( ) . FinalOnScreenSize = command . Bounds ;
52
- if ( command . Bounds . ContainsPoint ( point ) )
56
+ if ( command . Bounds . ContainsPoint ( transformedPoint ) )
53
57
{
54
58
hitElements . Add ( command . UiElement . Get ( ) ) ;
55
59
}
56
60
} else if ( command . Type == CommandType . Text )
57
61
{
58
62
command . UiElement . Get ( ) . FinalOnScreenSize = command . Bounds ;
59
- if ( command . Bounds . ContainsPoint ( point ) )
63
+ if ( command . Bounds . ContainsPoint ( transformedPoint ) )
60
64
{
61
65
hitElements . Add ( command . UiElement . Get ( ) ) ;
62
66
}
You can’t perform that action at this time.
0 commit comments