Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public abstract bool RemovePoint(ControlPointViewModelBase point);