Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

Closed Unassigned: Exception in PathAnnotation.HitTest [10140]

$
0
0
In a mousedown handler on the plotmodel, I'm deleting a polyline object from the plotmodel and creating another one instead.
When clicking repeatedly, I can get the situation that Oxyplot tries to do a hittest while screenPoints == null. I'm not sure it this has to do with the fact that I'm deleting the objects from the plotmodel.
I can fix this by testing for null in HitTest. See code below after the TODO comment:

PathAnnotation.cs:

protected internal override HitTestResult HitTest(ScreenPoint point, double tolerance)
{
// TODO: TEST FOR NULL
if (this.screenPoints == null)
{
return null;
}

var nearestPoint = ScreenPointHelper.FindNearestPointOnPolyline(point, this.screenPoints);
double dist = (point - nearestPoint).Length;
if (dist < tolerance)
{
return new HitTestResult(nearestPoint);
}

return null;
}

Kind regards,
Wim Bokkers

Viewing all articles
Browse latest Browse all 2061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>