hittest

Right-click on a Listbox in a Silverlight 4 app

假装没事ソ 提交于 2019-11-30 18:24:43
问题 I am trying to implement what I used to take for granted in Winforms applications. I am a Silverlight noob, so hopefully all this is elementary. I have a listbox in a Silverlight 4 app. I'd like to do the following: Right-click on the listbox Have the item under the location where I click highlight itself I'd like a context menu to popup (with my own items in the context menu) From my research so far, it appears that there is no ContextMenu construct in Silverlight, instead we have to build

hitTest:WithEvent and Subviews

孤者浪人 提交于 2019-11-30 11:47:46
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, even not inside the original bounds ) even though i loop through my TestView1 hittest method and the points get contained in the frame. #import "ViewController.h" @interface TestView1 : UIView @end @implementation TestView1 - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { CGFloat radius = 100.0; CGRect frame = CGRectMake(0, 0, self

hitTest fires when UIKeyboard is tapped

回眸只為那壹抹淺笑 提交于 2019-11-30 04:36:24
问题 I'm trying to fix a bug that involves UIView hitTest:withEvent: being called on my view when the touches are on the UIKeyboard, but only after the app has been in the background. It was occurring in my app with a complex view hierarchy so I reproduced it in an app with only 2 views: 1 UIView 768x1024 (fullscreen) 1 UITextView 200x200 in the upper half of the fullscreen view The behavior is as follows: Tapping the textview causes the fullscreen view's hitTest method to fire, the textfield

hitTest:WithEvent and Subviews

不羁岁月 提交于 2019-11-29 18:12:41
问题 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, even not inside the original bounds ) even though i loop through my TestView1 hittest method and the points get contained in the frame. #import "ViewController.h" @interface TestView1 : UIView @end @implementation TestView1 - (UIView *)hitTest:

WinForms equivalent of WPF's IsHitTestVisible

依然范特西╮ 提交于 2019-11-28 01:44:19
I have a button override that has a Label as a child. I have MouseEnter and Leave events attached to the button control. When the mouse enters the label the button's events are nullified (which is natural). My question is how can I disable the label's hit testing without actually disabling the label. I want it to retain it's color and I want it to be able to change colors (MouseEnter on button for example), but when the mouse is over the label, the hit test to be considered on the button. P.S: I know I can add Mouse Enter and Leave on the Label and handle those cases but I want the control to

Hit detection when drawing lines in iOS

自古美人都是妖i 提交于 2019-11-27 22:57:18
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 nodes of the line forwards and back and then closing the path. Unfortunately, iOS only provides a test for whether a point is contained in a closed path (containsPoint: and CGPathContainsPoint). Unfortunately, a user can pretty easily move their finger fast enough that the touch points land on both sides of an existing path without actually being

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

社会主义新天地 提交于 2019-11-27 18:21:07
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 problem: Those portions of the child outside the bbox of the parent do not receive touches. Only tapping within the bbox of the parent allows the child button to receive touches. Can someone please suggest a fix/workaround? UPDATE For those following this question, here is the solution I implemented as a result of @Bastians most excellent answer: -

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

拟墨画扇 提交于 2019-11-27 17:37:40
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 non-transparent (black in this case) area of the image. Ideas Override hitTest:withEvent: or pointInside:withEvent: , although this approach might be terribly inefficient as these methods get called many times during a touch event. Checking if a single pixel is transparent might create unexpected results, as fingers are bigger than one pixel.

unexpected nil window in _UIApplicationHandleEventFromQueueEvent

时间秒杀一切 提交于 2019-11-27 12:03:13
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: <UIWindow: 0x7fe4d3e52660; frame = (0 0; 320 568); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fe4d3e2c450>; layer = <UIWindowLayer: 0x7fe4d3e86a10>> I'm using an old style MainWindow.xib. In the MainWindow.xib is my Window object, as well as a UINavigationController which has its first View Controller defined within as well. The image

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

江枫思渺然 提交于 2019-11-27 11:42:31
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 like it would be tricky because of absolutely positioned elements. Is there a way to simulate an event at a given (X,Y) position such that the browser ends up creating an event object that has a pointer to the element? (Background: I'm embedding Qt's QWebView in