개정판 a6272c57
issue #923: add ICommentUserInfo interface
Change-Id: Id0b65251436a5aa647eef78026dfad90d3ca64ab
MarkupToPDF/Controls/Shape/TriControl.cs | ||
---|---|---|
403 | 403 |
} |
404 | 404 |
|
405 | 405 |
/// <summary> |
406 |
/// call when mouse is moving while drawing control |
|
407 |
/// </summary> |
|
408 |
/// <param name="pt"></param> |
|
409 |
/// <param name="bAxisLocked"></param> |
|
410 |
public override void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed) |
|
411 |
{ |
|
412 |
this.EndPoint = pt; |
|
413 |
|
|
414 |
if (bAxisLocked) |
|
415 |
{ |
|
416 |
Point tmp = this.EndPoint; |
|
417 |
string angle = MathSet.returnAngleString(this.StartPoint, ref tmp, true); |
|
418 |
this.EndPoint = tmp; |
|
419 |
} |
|
420 |
|
|
421 |
if (bShiftKeyPressed) |
|
422 |
{ |
|
423 |
List<Point> Points = this.GetRegularTrianglePoints(this.StartPoint, this.EndPoint); |
|
424 |
if (2 == Points.Count()) |
|
425 |
{ |
|
426 |
this.MidPoint = Points[0]; |
|
427 |
this.EndPoint = Points[1]; |
|
428 |
} |
|
429 |
} |
|
430 |
|
|
431 |
this.PointSet = new List<Point> |
|
432 |
{ |
|
433 |
this.StartPoint, |
|
434 |
this.MidPoint, |
|
435 |
this.EndPoint, |
|
436 |
}; |
|
437 |
} |
|
438 |
|
|
439 |
/// <summary> |
|
406 | 440 |
/// return tricontrols' area |
407 | 441 |
/// </summary> |
408 | 442 |
/// <author>humkyung</author> |
... | ... | |
487 | 521 |
} |
488 | 522 |
} |
489 | 523 |
|
490 |
//public void ChangePaint(PaintSet state) |
|
491 |
//{ |
|
492 |
// this.Paint = state; |
|
493 |
// this.SetTri(); |
|
494 |
//} |
|
524 |
/// <summary> |
|
525 |
/// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌 |
|
526 |
/// </summary> |
|
527 |
/// <author>humkyung</author> |
|
528 |
/// <date>2018.04.26</date> |
|
529 |
/// <param name="StartP"></param> |
|
530 |
/// <param name="EndP"></param> |
|
531 |
/// <returns></returns> |
|
532 |
/// <history>humkyung 2018.05.11 apply axis lock</history> |
|
533 |
private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false) |
|
534 |
{ |
|
535 |
List<Point> res = new List<Point>(); |
|
536 |
|
|
537 |
double dx = EndP.X - StartP.X; |
|
538 |
double dy = EndP.Y - StartP.Y; |
|
539 |
double length = Math.Sqrt(dx * dx + dy * dy); |
|
540 |
double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0); |
|
541 |
dx /= length; |
|
542 |
dy /= length; |
|
543 |
double tmp = dx; |
|
544 |
dx = -dy; dy = tmp; /// rotate by 90 degree |
|
545 |
|
|
546 |
res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength)); |
|
547 |
res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength)); |
|
548 |
|
|
549 |
return res; |
|
550 |
} |
|
495 | 551 |
} |
496 | 552 |
} |
내보내기 Unified diff