Пример #1
0
        private void AddHandles(List <ControlPoint> controlPoints)
        {
            var beforeHandle = new SecondaryHandle(controlPoints.First());
            var mainHandle   = new Handle(controlPoints.ElementAt(1));
            var afterHandle  = new SecondaryHandle(controlPoints.Last());

            mainHandle.SetChildren(beforeHandle, afterHandle);

            beforeHandle.SetPosition(ToPixel(controlPoints.First().Position));
            mainHandle.SetPosition(ToPixel(controlPoints.ElementAt(1).Position));
            afterHandle.SetPosition(ToPixel(controlPoints.Last().Position));

            this.Children.Add(mainHandle);
            this.Children.Add(beforeHandle);
            this.Children.Add(afterHandle);

            beforeHandle.SetParent(mainHandle);
            afterHandle.SetParent(mainHandle);

            this.Children.Add(beforeHandle.Arm);
            this.Children.Add(afterHandle.Arm);

            RegisterHandleEvents(beforeHandle);
            RegisterHandleEvents(mainHandle);
            RegisterHandleEvents(afterHandle);
        }
Пример #2
0
 public void SetChildren(SecondaryHandle before, SecondaryHandle after)
 {
     ChildBefore = before;
     ChildBefore.SetParent(this);
     ChildAfter = after;
     ChildAfter.SetParent(this);
 }
Пример #3
0
        private void AddHandle(ControlPoint controlPoint)
        {
            Handle handle;

            switch (controlPoint.Type)
            {
            case ControlPointType.Primary:
            {
                handle = new Handle(controlPoint);
                break;
            }

            case ControlPointType.Secondary:
            {
                handle = new SecondaryHandle(controlPoint);
                break;
            }

            default:
            {
                handle = new Handle(controlPoint);
                break;
            }
            }
            handle.SetPosition(ToPixel(controlPoint.Position));
            this.Children.Add(handle);
            RegisterHandleEvents(handle);
        }