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
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