개정판 edef7af2
Fix: Axis Lock 체크 시 특정 각도에 맞게 배치되도록 개선 요청
Change-Id: I11e9accf4fe0f3f05cd8c0ecc9fb85be35be1ed6
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
174 | 174 |
public List<AdornerMember> Members { get; } = new List<AdornerMember>(); |
175 | 175 |
public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
176 | 176 |
|
177 |
private List<double> AlignedAngles {get;} = new List<double>() { 0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330, 360 }; |
|
178 |
|
|
177 | 179 |
private double angleValue; |
178 | 180 |
|
179 | 181 |
public double AngleValue { get => angleValue; |
... | ... | |
1464 | 1466 |
Point CenterPoint = this.Centeroid; |
1465 | 1467 |
Point pt = Mouse.GetPosition(this); |
1466 | 1468 |
|
1467 |
Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y); |
|
1469 |
#region X축 기준으로 회전 각도를 구한다. |
|
1470 |
Point vec1 = new Point(1, 0); |
|
1468 | 1471 |
Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
1469 |
double dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
|
1472 |
double angle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
|
1473 |
if (angle > 360) angle -= 360; |
|
1474 |
if (angle < 0) angle += 360; |
|
1475 |
#endregion |
|
1476 |
|
|
1477 |
#region AxisLock이 설정되어 있는 경우 Angle을 특정 값으로 정렬한다. |
|
1478 |
if (ViewerDataModel.Instance.IsAxisLock) |
|
1479 |
{ |
|
1480 |
angle = AlignedAngles.OrderBy(x => Math.Abs(angle - x)).First(); |
|
1481 |
} |
|
1482 |
#endregion |
|
1483 |
|
|
1484 |
double dDeltaAngle = angle - AngleValue; |
|
1485 |
AngleValue = angle; |
|
1470 | 1486 |
|
1471 |
AngleValue += dDeltaAngle; |
|
1472 |
if (AngleValue > 360) AngleValue -= 360; |
|
1473 |
if (AngleValue < 0) AngleValue += 360; |
|
1474 |
this.rotatePoint = pt; /// save rotatePoint |
|
1487 |
/// save rotatePoint |
|
1488 |
this.rotatePoint = pt; |
|
1475 | 1489 |
|
1476 | 1490 |
Dispatcher.BeginInvoke((Action)(() => |
1477 | 1491 |
{ |
... | ... | |
1497 | 1511 |
Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1498 | 1512 |
}; |
1499 | 1513 |
|
1500 |
//(member.DrawingData as TextControl).Angle = AngleValue; |
|
1501 |
|
|
1502 | 1514 |
(member.DrawingData as CommentUserInfo).UpdateControl(); |
1503 | 1515 |
BorderUpdate(); |
1504 | 1516 |
break; |
내보내기 Unified diff