protected virtual PointHitTestResult HitTestCore(PointHitTestParameters param) { if (GetHitTestBounds().Contains(param.HitPoint)) { return(new PointHitTestResult(param.HitPoint, this)); } return(null); }
protected virtual HitTestResultBehavior HitTestOverride(PointHitTestParameters param, HitTestFilterCallback <Visual> filter, HitTestResultCallback <PointHitTestResult> resultCallback) { var hitTestResult = HitTestCore(param); if (hitTestResult != null) { return(resultCallback(hitTestResult)); } return(HitTestResultBehavior.Continue); }
private HitTestResultBehavior HitTestPoint(PointHitTestParameters param, HitTestFilterCallback <Visual> filter, HitTestResultCallback <PointHitTestResult> resultCallback) { if (_bboxSubgraph.Contains(param.HitPoint)) { var hitTestFilterBehavior = HitTestFilterBehavior.Continue; if (filter != null) { hitTestFilterBehavior = filter(this); if (hitTestFilterBehavior == HitTestFilterBehavior.ContinueSkipSelfAndChildren) { return(HitTestResultBehavior.Continue); } if (hitTestFilterBehavior == HitTestFilterBehavior.Stop) { return(HitTestResultBehavior.Stop); } } var hitPoint = param.HitPoint; var point = hitPoint; if (hitTestFilterBehavior != HitTestFilterBehavior.ContinueSkipChildren) { foreach (var child in VisualChildren) { var childPoint = point - child.VisualOffset; param.SetHitPoint(childPoint); var hitTestResultBehavior = child.HitTestPoint(param, filter, resultCallback); param.SetHitPoint(hitPoint); if (hitTestResultBehavior == HitTestResultBehavior.Stop) { return(HitTestResultBehavior.Stop); } } } if (hitTestFilterBehavior != HitTestFilterBehavior.ContinueSkipSelf) { param.SetHitPoint(point); var hitTestResultBehavior = this.HitTestOverride(param, filter, resultCallback); param.SetHitPoint(hitPoint); if (hitTestResultBehavior == HitTestResultBehavior.Stop) { return(HitTestResultBehavior.Stop); } } } return(HitTestResultBehavior.Continue); }
public static void HitTest(Visual visual, PointHitTestParameters param, HitTestFilterCallback <Visual> filter, HitTestResultCallback <PointHitTestResult> resultCallback) { visual.HitTest(param, filter, resultCallback); }
protected virtual PointHitTestResult HitTestOverride(PointHitTestParameters param) { return(null); }
internal void HitTest(PointHitTestParameters param, HitTestFilterCallback <Visual> filter, HitTestResultCallback <PointHitTestResult> resultCallback) { Precompute(); HitTestPoint(param, filter, resultCallback); }