hittest

Can I HitTest element with lower ZIndex in WPF Canvas?

自作多情 提交于 2019-12-24 12:05:30
问题 When I am using System.Windows.Media.VisualTreeHelper.HitTest on mouse clicking canvas, it always returns me the element on top. I mean if there are two elements overlapping each other, the one I get is the one with higher ZIndex in canvas. I also tried to do it this way, but even after I made IsHitTestVisible = False it still returned this same one to me. Is there any possibility to get the element "underneath"? Thanks in advance! 回答1: See the section "Hit Testing and Z-Order" here: Hit

Forwarding touch events only to the views being touched

混江龙づ霸主 提交于 2019-12-23 05:20:26
问题 I have a UIWindow with a text field, a button, and a table. I would like to be able to track all the touches on the screen and then forward them to the element being touched. I have read about overriding sendEvent in the Apple documentation but I still do not understand: How to use hitTest to retrieve the element being touched How to forward touches This is what I have so far. - (void) sendEvent:(UIEvent *)event { for (UITouch *touch in [event allTouches]) { /* Get coordinates of touch */

hitTestObject on child of a MC

此生再无相见时 提交于 2019-12-23 02:59:21
问题 I have a MC called 'playerP" and inside of it with 7 different MC. I can't seems to hit test on the children MC, it always show [object position_2] private function cMove(e:MouseEvent):void { trace(MovieClip(playerP.RR), playerP.PT) if (e.currentTarget.hitTestObject(playerP.PT)) { trace("hit la"); } } 回答1: Try explicitly iterating through the children. private function cMove(e:MouseEvent):void { for (var ii : uint = 0; ii < playerP.numChildren; ++ii) { if (e.currentTarget.hitTestObject

ToolTip on Adorner doesn't show up

那年仲夏 提交于 2019-12-23 01:19:42
问题 I have an adorner defined as follows: private class ErrorAdorner : Adorner { private readonly Border _errorBorder; public ErrorAdorner(UIElement adornedElement) : base(adornedElement) { _errorBorder = new Border(); _errorBorder.BorderThickness = new Thickness(2); _errorBorder.BorderBrush = Brushes.Red; Image img = new Image(); img.HorizontalAlignment = HorizontalAlignment.Right; img.VerticalAlignment = VerticalAlignment.Center; img.Stretch = Stretch.None; Binding imgBinding = new Binding {

Get tap event for UIButton in UIControl/rotatable view

末鹿安然 提交于 2019-12-21 09:14:23
问题 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 am having a hard time because I am using a UIControl subclass to make the rotating view and in that subclass I have to disable user interactions on the subviews in the UIControl (to make it spin) which may cause the UIButtons not be tappable. How

Identifying the Type of Touch Gestures from UIEvent Object

江枫思渺然 提交于 2019-12-21 04:11:04
问题 Is there a way to gain the type of touch gestures that triggered a UIEvent? So, let's say I intercept a gesture with hitTest:withEvent:. How do I identify what kind of touch (pinch, tap, swipe, etc.) happened that triggered this method? I can gain the type of remote events from the UIEvent subtype, and even if the device was shaken, but there is no parameter for touch events... How do you identify those? 回答1: You have to do touch analysis on your own. It is not that difficult, but it is not

Horizontal UIScrollView having vertical UIScrollViews inside - how to prevent scrolling of inner scroll views when scrolling outer horizontal view?

眉间皱痕 提交于 2019-12-21 02:01:06
问题 couldn't find a solution for that. I am building an app, with big scroll view, who has paging (Horizontal). Inside this scroll view, there is a grid of UIView's, and an UIScrollview inside each one of them, with vertical scroll view. Now, the point is, When I'm paging my 'big' scrollview, sometimes the touch get stuck in one of small scrollviews inside the UIViews of the grid. I don't know how to avoid it - tried trick with hitTest but still couldn't find the answer. Hope i'm clear... Thanks

Bug in geometry Hit-Testing

心不动则不痛 提交于 2019-12-19 07:36:45
问题 I have a DrawingVisual element that rappresents a path which geometry is described by this syntax: "m106,59.3c0-1.98,0,0-4.95,0.989-3.96,0.989-13.8,3.96-20.8,4.95-6.92,0-14.8-3.96-17.8-3.96-1.98,2.97,3.96,10.9,7.91,13.8,2.97,1.98,9.89,3.96,14.8,3.96,4.95-0.989,10.9-2.97,13.8-6.92,2.97-2.97,5.93-10.9,6.92-12.9z" To render the visual i use MyCanvas class, that provides hit-testing functionality: public class MyCanvas : Panel { public List<Visual> Visuals = new List<Visual>(); private List

Swift: hitTest for UIView underneath another UIView

别来无恙 提交于 2019-12-19 03:41:57
问题 I have TransparentUIView on top of RedOrGreenUIView. TransparentUIView has a UILongPressGestureRecognizer attached to it. Once user begins a long touch on it, I check for .Changed status of this LongPressGesture, and execute below hitTest: var p:CGPoint = rec.locationInView(self.view) var selectedView = view.hitTest(p, withEvent: nil) if selectedView != nil { if selectedView == TransparentUIView { println("TransparentUIView is being touched") } } I get TransparentView as selectedView fine.

WinForms equivalent of WPF's IsHitTestVisible

十年热恋 提交于 2019-12-17 16:53:35
问题 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