프로젝트

일반

사용자정보

개정판 d2114d3b

IDd2114d3b43eba86003919f41890e541e9e88a4ba
상위 6b518442
하위 018e77ac

백흠경이(가) 5년 이상 전에 추가함

issue #923: add OnMoveCtrlPoint method to interface

Change-Id: If3b10f5b54eaecd8bd8fa299d702e70e05d4b97e

차이점 보기:

MarkupToPDF/Controls/Etc/DateControl.cs
480 480
        }
481 481

  
482 482
        /// <summary>
483
        /// move control point has same location of given pt along given delta
484
        /// </summary>
485
        /// <author>humkyung</author>
486
        /// <date>2019.06.20</date>
487
        /// <param name="pt"></param>
488
        /// <param name="dx"></param>
489
        /// <param name="dy"></param>
490
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy)
491
        {
492
            IPath path = (this as IPath);
493

  
494
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
495
            selected.X += dx;
496
            selected.Y += dy;
497
            int i = 0;
498
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
499
            {
500
                if (pt.Equals((this as IPath).PointSet[i]))
501
                {
502
                    path.PointSet[i] = selected;
503
                    break;
504
                }
505
            }
506

  
507
            var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count;
508
            var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count;
509
            var NextP = (i + 1) % path.PointSet.Count;
510

  
511
            var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]);
512

  
513
            var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]);
514
            var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X,
515
                path.PointSet[i].Y - path.PointSet[ReverseP].Y);
516
            path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l);
517

  
518
            var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]);
519
            l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet
520
                [i].Y - path.PointSet[ReverseP].Y);
521
            path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l);
522

  
523
            this.updateControl();
524
        }
525

  
526
        /// <summary>
483 527
        /// return DateControl's area
484 528
        /// </summary>
485 529
        /// <author>humkyung</author>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)