public static ControlPointViewModelBase GetClosestPoint([ItemNotNull, NotNull] IEnumerable <ControlPointViewModelBase> points, WindowsPoint position, double maximumDistance = double.PositiveInfinity) { ControlPointViewModelBase closest = null; var closestDistance = double.MaxValue; foreach (var p in points) { var distance = (p.ActualPoint - position).LengthSquared; if (distance < closestDistance && distance < maximumDistance * maximumDistance) { closest = p; closestDistance = distance; } } return(closest); }
public override bool RemovePoint(ControlPointViewModelBase point) { var kfcp = point as KeyFrameControlPointViewModel <TValue>; if (kfcp == null) { return(false); } var index = new NodeIndex(controlPoints.IndexOf(kfcp)); if (index.Int == -1) { return(false); } var kf = KeyFramesNode.Retrieve(index); KeyFramesNode.Remove(kf, index); return(true); }
public abstract bool RemovePoint(ControlPointViewModelBase point);