Questions tagged [hittest]

Hit-testing (hit detection, picking, or pick correlation) is the process of determining whether a given object intersects another given object shape, line, or curve drawn on the screen.

Hit-testing (hit detection, picking, or pick correlation) is the process of determining whether a given object intersects another given object shape, line, or curve drawn on the screen.

Most commonly, hit-testing is used by GUI environments to respond to user actions. In addition, hit-testing is used in small-scale games, which do not require much computing power, and are thus able to perform all of their collision detection tests in one frame of the game loop.

In Web programming languages such as SVG and CSS, this is associated with the concept of pointer-events (e.g. user-initiated cursor movement or object selection).

543 questions
49
votes
3 answers

Optimizing native hit testing of DOM elements (Chrome)

I have a heavily optimized JavaScript app, a highly interactive graph editor. I now started profiling it (using Chrome dev-tools) with massive amounts of data (thousands of shapes in the graph), and I'm encountering a previously unusual performance…
John Weisz
  • 30,137
  • 13
  • 89
  • 132
42
votes
13 answers

Unexpected nil window in _UIApplicationHandleEventFromQueueEvent

One of my old apps is not working with iOS8. When I start the app up, and try to tap on the screen anywhere, I get this message in my console: unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow:
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
37
votes
5 answers

UIView. Why Does A Subviews Outside its Parent's Extent Not Receive Touches?

I have a simple - trivial - UIView parent/child hierarchy. One parent (UIView). One child (UIButton). The parents bounds are smaller then it's child's bounds so that a portion of the child extends beyond the bounding box of its parent. Here's the…
dugla
  • 12,774
  • 26
  • 88
  • 136
28
votes
9 answers

How to test if a point is inside of a convex polygon in 2D integer coordinates?

The polygon is given as a list of Vector2I objects (2 dimensional, integer coordinates). How can i test if a given point is inside? All implementations i found on the web fail for some trivial counter-example. It really seems to be hard to write a…
usr
  • 168,620
  • 35
  • 240
  • 369
27
votes
3 answers

Detect touches only on non-transparent pixels of UIImageView, efficiently

How would you detect touches only on non-transparent pixels of a UIImageView, efficiently? Consider an image like the one below, displayed with UIImageView. The goal is be to make the gesture recognisers respond only when the touch happens in the…
hpique
  • 119,096
  • 131
  • 338
  • 476
26
votes
4 answers

Hit-testing SVG shapes?

The browsers which have implemented parts of the SVG spec (Firefox etc) do hit-testing for us for free - if I attach a mousedown listener on an SVG object, I get notified whenever the shape is clicked. This is amazing, especially for complex polygon…
user246114
  • 50,223
  • 42
  • 112
  • 149
24
votes
5 answers

How do I find the DOM node that is at a given (X,Y) position? (Hit test)

I have the coordinates (X,Y) of a point in an HTML document. How do I determine what DOM node is at those coordinates? Some ideas: Is there a DOM hit test function that I missed, that takes a point (X,Y) and returns the DOM element there? Is there…
Geoff
  • 4,372
  • 5
  • 25
  • 29
17
votes
1 answer

How to get UIView given a CGPoint?

I am trying to find a way to get a particular UIView given a CGPoint. Briefly, I want to do a hit test. For example, I have a UIView which has many subviews whose sizes are smaller than the parent UIView. What I want to do is, when a touchMoved…
Aki24x
  • 1,058
  • 1
  • 13
  • 28
17
votes
2 answers

Hittest using screen coordinates in SVG images in World coordinates

How do I translate mouse coordinates into world coordinates using GDI+? Or get bounding boxes (or even better) old skool regions for SVG shapes drawn using GDI+? Anyway. I've been looking for SVG code and…
Johan
  • 74,508
  • 24
  • 191
  • 319
15
votes
1 answer

WPF: How to make an overlay control with transparent canvas and clickable child

I want to make a custom control which will be used as an overlay. The control should contain a couple of child controls which should be drawn and should be clickable as usual. But everything else in the control should be transparent and…
Pavel Murygin
  • 2,242
  • 2
  • 18
  • 26
13
votes
2 answers

Hit detection when drawing lines in iOS

I would like to allow the user to draw curves in such a way that no line can cross another line or even itself. Drawing the curves is no problem, and I even found that I can create a path that is closed and still pretty line-like by tracing the…
EFC
  • 1,890
  • 18
  • 39
13
votes
4 answers

UIView's -hitTest:withEvent: called three times?

I am trying to intercept any activity (i.e. touches) that happens inside my whole application. In other words, I am trying to be notified of any touch event that happens within my main UIView, containing the rest of my controls. To do so, I thought…
Thomas Desert
  • 1,346
  • 3
  • 13
  • 28
13
votes
6 answers

Nested UIScrollViews and event routing

I have 2 scroll views, both of which are supposed to scroll vertically. The outer scroll view (red) contains a search bar and the inner scroll view (blue). The inner scroll view is supposed to scroll infinitely (it contains images/items and has an…
Sebastian
  • 2,889
  • 4
  • 34
  • 37
12
votes
4 answers

Get tap event for UIButton in UIControl/rotatable view

Edited See the comment section with Nathan for the latest project. There is only problem remaining: getting the right button. Edited I want to have a UIView that the user can rotate. That UIView should contain some UIButtons that can be clicked. I…
J. Doe
  • 12,159
  • 9
  • 60
  • 114
12
votes
5 answers

hitTest:WithEvent and Subviews

I have 2 views , but i want to make 1 view (virtually) bigger. if I place my tapGesture on v1, the tap gesture works with a bigger hit area but if I place my tapGesture on v2 it doesn't work ( actually it doesn't recognizes the tapGesture at all,…
Andy Jacobs
  • 15,187
  • 13
  • 60
  • 91
1
2 3
36 37