hitTest searches the hit tree for nodes matching pos. Any node matching pos will have the onNode func invoked on it to allow the caller to extract whatever information is necessary for further processing. onNode may return false to terminate the walk of the hit tree, or true to continue. Providing t
(pos f32.Point, onNode func(*hitNode) bool)
| 548 | // allows normal event routing and system action event routing to share the same traversal |
| 549 | // logic even though they are interested in different aspects of hit nodes. |
| 550 | func (q *pointerQueue) hitTest(pos f32.Point, onNode func(*hitNode) bool) pointer.Cursor { |
| 551 | // Track whether we're passing through hits. |
| 552 | pass := true |
| 553 | idx := len(q.hitTree) - 1 |
| 554 | cursor := pointer.CursorDefault |
| 555 | for idx >= 0 { |
| 556 | n := &q.hitTree[idx] |
| 557 | hit, c := q.hit(n.area, pos) |
| 558 | if !hit { |
| 559 | idx-- |
| 560 | continue |
| 561 | } |
| 562 | if cursor == pointer.CursorDefault { |
| 563 | cursor = c |
| 564 | } |
| 565 | pass = pass && n.pass |
| 566 | if pass { |
| 567 | idx-- |
| 568 | } else { |
| 569 | idx = n.next |
| 570 | } |
| 571 | if !onNode(n) { |
| 572 | break |
| 573 | } |
| 574 | } |
| 575 | return cursor |
| 576 | } |
| 577 | |
| 578 | func (q *pointerQueue) invTransform(areaIdx int, p f32.Point) f32.Point { |
| 579 | if areaIdx == -1 { |
no test coverage detected