private static bool HitTestForShape(IList <SpiroShape> shapes, double x, double y, double treshold, out SpiroShape hitShape, out int hitShapePointIndex) { for (int i = 0; i < shapes.Count; i++) { var bc = new HitTestBezierContext(x, y); var shape = shapes[i]; int knontIndex; try { if (!TryToRunSpiro(shape, bc)) { continue; } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); continue; } if (bc.Report(out knontIndex) < treshold) { hitShape = shape; hitShapePointIndex = knontIndex; return(true); } } hitShape = null; hitShapePointIndex = -1; return(false); }
private static bool HitTestForShape(IList<SpiroShape> shapes, double x, double y, double treshold, out SpiroShape hitShape, out int hitShapePointIndex) { for (int i = 0; i < shapes.Count; i++) { var bc = new HitTestBezierContext(x, y); var shape = shapes[i]; int knontIndex; try { if (!TryToRunSpiro(shape, bc)) continue; } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); continue; } if (bc.Report(out knontIndex) < treshold) { hitShape = shape; hitShapePointIndex = knontIndex; return true; } } hitShape = null; hitShapePointIndex = -1; return false; }