hittest

WPF - How to find item clicked on in menu handler method?

How can the handler method of a WPF menu item determine which item in a ListView was clicked on? Edit: The menu is a context menu which has been set for the ListView. The problem is to find which ListView item has been clicked on when the context menu item is selected. ...

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 correct implementation. The language does not matter as i will port it myself. ...

Overrriding HitTestCore method for detecting multiple controls in WPF

Hi guys, I am creating a custom control which does hit testing on its children. I'm planning on overriding the HitTestCore method to return multiple controls which fall inside or intersects with a Geometric region. Just wondering if anyone else has tried this. Do you have any pointers for me? Or is there another way which I can do this ...

How to perform a rectangular hit test in PHP

Hi, I have WYSIWYG style javascript interface that allows a designer to create rectangular regions to generate a document server side. It is important that these regions do not overlap. I was wondering what is the single most efficent way to perform a hit test on 2 rectangular regions, there could potentially be hundreds, so efficenc...

hitTestObject collision detection not working in as3!

I am trying to create a platformer game and i am trying to make "player1" stop when it hits a "platform". here is my code so far, gotoAndStop("gameStart"); import flash.display.MovieClip; import flash.events.*; import flash.ui.Keyboard; import flash.ui.*; import flash.utils.Timer; import flash.events.TimerEvent; player1.gotoAndS...

as3 2D hitTestObject make something stop how to!

I want To make a square that has keyboard movement(up, down, left, right) and will stop when it hits another object such as a wall. please help me achieve this goal! it will help a lot! thanks :) EDIT: I already have a square and a keyboard layout but if that needs to be something specific then please tell me! ...

WPF implementing a rubberband type selection within a listbox.

I'm trying to allow rubberband or lasso type selection of the items in the listbox that the user wants selected. My Listbox is in a grid and to the grid I added a control that draws a rectangle over the area I want to select. I've tried hit testing the listbox items to see if they fall within the rectangle but they all seem to return t...

Hit Testing ... is it possible to test items in a listbox or other items control.

I'm trying to hit test items within a listbox but to no avail. Is it possible? The VisualTreeHelper shows the x,y coordinates returning 0,0 for each and every item within which would seem to rule hit testing out. Does anyone know of a solution or workaround? ...

Find a point in a complex polygon

This polygon could be shaped like a C I tried the formula located here http://stackoverflow.com/questions/217578/point-in-polygon-aka-hit-test however it doesn't actually correctly predict if the point is in the polygon. ...

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 an efficient way to walk the DOM element tree to find the containing element? This seems...

touchesForView in hitTest

Hi, I have a simple UIView used like container. If I write this code: - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *hitView = [super hitTest:point withEvent:event]; NSSet *sTouches = [event touchesForView:self]; NSLog(@"Touches %d", [sTouches count] ); return self; } Doesn't work! I would...

What is the Silverlight's FindElementsInHostCoordinates equivalent in WPF?

I would like to perform a rectangual hit test on WPF Canvas component in order to get Controls that are overlapped by a Rectangle framework element. I found a Silverlight's VisualTreeHelper.FindElementsInHostCoordinates method, but apparently it's not available in WPF. What's the best method to achieve such functionality? ...

How to register user activity in an NSView

I'm trying to register specific user activity in a view. I have an NSView that has a NSTextField, a NSDatePicker and a NSButton (checkbox). I want to know when the user enters into the text field or the picker or when he/she clicks the checkbox. I'm currently using hitTest but it fires a bunch of times even when I just move the mouse...

Hittest for touches ended in UIWebView

I'm using hittest to pick up when a user touches my UIWebview. I need to know when the user has stopped touching the view, but I don't get any events from hittest. Is there another function to do this? - (void)hitTest:(CGPoint)point withEvent:(UIEvent *)event { NSLog(@"Event type:%@", event.type); if (event.type == UIEventTypeTouches)...

"GeometryHitTestParameters' HitTestParameters are not supported on 'Viewport3DVisual" error from the new SDK?

I was part of a team that developed a Surface application during the summer. I was set to do some minor changes to this application now, but got errors that were not present last time the exact same code was ran. The error message is "GeometryHitTestParameters' HitTestParameters are not supported on 'Viewport3DVisual" and is complainin...

Translating mouse X & Y to 3D model coordinates

Hi. I'm building a simple 3D drag and drop interface in processing, and want to detect when the mouse rolls over an object. I would imagine that I need to do some matrix translations to the 3D model coordinates to get them into screen space and so on ... I have a simple version of this working, the problem is that when camera is moved ...

How to determine if a UIView has a delegate that conforms to a protocol

Howdy all, I have written a custom class that depends significantly on touch dragging/positioning, outside of it's own view boundaries. There is an associated protocol defined with various relevant methods. An example of something that would use this protocol would be a view that allows things to be dropped into it from my custom class....

Can hitTestPoint be used with local coordinates at all?

In AS3 I have a game where a vehicle rotates to the direction of the cursor, but when it "moves", its sprite stays stationary in the middle of the stage while the map layer below it actually moves, causing the illusion of movement of the vehicle on the map. There are obstacles on the map that the vehicle cannot pass. The obstacles are in...

AS3: Point for display object x, y?

Right now I have a point that I have to update with the x and y of a display object to use with the hitTestPoint object; is there any way I can get a point from a display object without having to make a new point var and continually update its x and y? ...

iPhone hitTest broken after rotation

Hi all, I have a UIView that contains a number of CALayer subclasses. I am using the following code to detect which layer a touch event corresponds to: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint touchPoint = [touch locationInView:self]; NSLog(@"%@,%@",NSStri...