개정판 d2114d3b
issue #923: add OnMoveCtrlPoint method to interface
Change-Id: If3b10f5b54eaecd8bd8fa299d702e70e05d4b97e
MarkupToPDF/Controls/Text/ArrowTextControl.cs | ||
---|---|---|
1503 | 1503 |
} |
1504 | 1504 |
|
1505 | 1505 |
/// <summary> |
1506 |
/// move control point has same location of given pt along given delta |
|
1507 |
/// </summary> |
|
1508 |
/// <author>humkyung</author> |
|
1509 |
/// <date>2019.06.20</date> |
|
1510 |
/// <param name="pt"></param> |
|
1511 |
/// <param name="dx"></param> |
|
1512 |
/// <param name="dy"></param> |
|
1513 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
1514 |
{ |
|
1515 |
IPath path = (this as IPath); |
|
1516 |
|
|
1517 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
1518 |
selected.X += dx; |
|
1519 |
selected.Y += dy; |
|
1520 |
int i = 0; |
|
1521 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
1522 |
{ |
|
1523 |
if (pt.Equals((this as IPath).PointSet[i])) break; |
|
1524 |
} |
|
1525 |
|
|
1526 |
List<Point> pts = path.PointSet; |
|
1527 |
if ((pts[0].X > pts[1].X && dx > 0) || (pts[0].X < pts[1].X && dx < 0)) |
|
1528 |
{ |
|
1529 |
pts[1] = new Point(pts[1].X + dx, pts[1].Y); |
|
1530 |
} |
|
1531 |
if ((pts[0].Y > pts[1].Y && dy > 0) || (pts[0].Y < pts[1].Y && dy < 0)) |
|
1532 |
{ |
|
1533 |
pts[1] = new Point(pts[1].X, pts[1].Y + dy); |
|
1534 |
} |
|
1535 |
path.PointSet[1] = pts[1]; |
|
1536 |
path.PointSet[i] = selected; |
|
1537 |
|
|
1538 |
this.updateControl(); |
|
1539 |
} |
|
1540 |
|
|
1541 |
/// <summary> |
|
1506 | 1542 |
/// return ArrowTextControl's area |
1507 | 1543 |
/// </summary> |
1508 | 1544 |
/// <author>humkyung</author> |
내보내기 Unified diff