Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public abstract bool RemovePoint(ControlPointViewModelBase point);