개정판 508c3ac5
issue #923: fixed a method to drag controls
Change-Id: I826278e510eb406cdceabf1b5cc27c805677cdba
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
80 | 80 |
public List<MyThumb> ThumbList { get; set; } |
81 | 81 |
public string Symbol_ID { get; set; } |
82 | 82 |
public long Group_ID { get; set; } |
83 |
|
|
84 |
/// <summary> |
|
85 |
/// update thumb |
|
86 |
/// </summary> |
|
87 |
public void UpdateThumb() |
|
88 |
{ |
|
89 |
var path = this.DrawingData as IPath; |
|
90 |
for (int i = 0; i < path.PointSet.Count; ++i) |
|
91 |
{ |
|
92 |
Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X); |
|
93 |
Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y); |
|
94 |
} |
|
95 |
|
|
96 |
if (this.DrawingData as ArrowTextControl != null) |
|
97 |
{ |
|
98 |
if (!(this.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
|
99 |
{ |
|
100 |
List<Point> ps = new List<Point>(); |
|
101 |
|
|
102 |
var temp = this.DrawingData as ArrowTextControl; |
|
103 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
|
104 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
|
105 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
|
106 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
|
107 |
|
|
108 |
if (temp.isFixed) |
|
109 |
{ |
|
110 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
111 |
var testP = endP; |
|
112 |
if (ps[0] == endP) //상단 |
|
113 |
{ |
|
114 |
testP = new Point(endP.X, endP.Y - 50); |
|
115 |
} |
|
116 |
else if (ps[1] == endP) //하단 |
|
117 |
{ |
|
118 |
testP = new Point(endP.X, endP.Y + 50); |
|
119 |
} |
|
120 |
else if (ps[2] == endP) //좌단 |
|
121 |
{ |
|
122 |
testP = new Point(endP.X - 50, endP.Y); |
|
123 |
} |
|
124 |
else if (ps[3] == endP) //우단 |
|
125 |
{ |
|
126 |
testP = new Point(endP.X + 50, endP.Y); |
|
127 |
} |
|
128 |
Canvas.SetLeft(this.ThumbList[1], testP.X); |
|
129 |
Canvas.SetTop(this.ThumbList[1], testP.Y); |
|
130 |
} |
|
131 |
else |
|
132 |
{ |
|
133 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
134 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
|
135 |
Canvas.SetLeft(this.ThumbList[1], tempP.X); |
|
136 |
Canvas.SetTop(this.ThumbList[1], tempP.Y); |
|
137 |
} |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
83 | 141 |
} |
84 | 142 |
|
85 | 143 |
public partial class AdornerFinal : UserControl |
... | ... | |
233 | 291 |
/// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
234 | 292 |
public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
235 | 293 |
{ |
236 |
|
|
237 | 294 |
switch (member.GetType().Name) |
238 | 295 |
{ |
239 | 296 |
#region 컨트롤 조건 |
... | ... | |
939 | 996 |
|
940 | 997 |
IPath AllControl = control.DrawingData as IPath; |
941 | 998 |
((control.DrawingData) as CommentUserInfo).OnMoveCtrlPoint(setPoint, e.HorizontalChange, e.VerticalChange); |
942 |
DynamicThumbUpdate(control);
|
|
943 |
BorderUpdate(); |
|
999 |
control.UpdateThumb();
|
|
1000 |
this.BorderUpdate();
|
|
944 | 1001 |
} |
945 | 1002 |
} |
946 | 1003 |
|
... | ... | |
1059 | 1116 |
|
1060 | 1117 |
private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1061 | 1118 |
{ |
1119 |
double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale; |
|
1062 | 1120 |
var tmp = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1063 |
var horzChange = Math.Round(tmp.X - this.CurrentMousePoint.X); |
|
1064 |
var vertChange = Math.Round(tmp.Y - this.CurrentMousePoint.Y); |
|
1121 |
|
|
1122 |
var horzChange = Math.Round(tmp.X - this.CurrentMousePoint.X) / scale; |
|
1123 |
var vertChange = Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale; |
|
1065 | 1124 |
try |
1066 | 1125 |
{ |
1067 | 1126 |
DragThumb.Cursor = Cursors.SizeAll; |
... | ... | |
1099 | 1158 |
{ |
1100 | 1159 |
Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 0); |
1101 | 1160 |
(item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1102 |
for (int i = 0; i < item.ThumbList.Count(); i++) |
|
1103 |
{ |
|
1104 |
(item.ThumbList[i] as MyThumb).Translate(dx, dy , this.trRotate.Angle); |
|
1105 |
} |
|
1106 |
} |
|
1107 |
|
|
1108 |
public void DynamicThumbUpdate(AdornerMember item) |
|
1109 |
{ |
|
1110 |
var AllControl = item.DrawingData as IPath; |
|
1111 |
List<Point> point = AllControl.PointSet; |
|
1112 |
|
|
1113 |
for (int i = 0; i < AllControl.PointSet.Count(); i++) |
|
1114 |
{ |
|
1115 |
Canvas.SetLeft(item.ThumbList[i], AllControl.PointSet[i].X); |
|
1116 |
Canvas.SetTop(item.ThumbList[i], AllControl.PointSet[i].Y); |
|
1117 |
} |
|
1118 |
|
|
1119 |
|
|
1120 |
if (item.DrawingData as ArrowTextControl != null) |
|
1121 |
{ |
|
1122 |
if (!(item.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
|
1123 |
{ |
|
1124 |
List<Point> ps = new List<Point>(); |
|
1125 |
|
|
1126 |
var temp = item.DrawingData as ArrowTextControl; |
|
1127 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
|
1128 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
|
1129 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
|
1130 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
|
1131 |
|
|
1132 |
if (temp.isFixed) |
|
1133 |
{ |
|
1134 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
1135 |
var testP = endP; |
|
1136 |
if (ps[0] == endP) //상단 |
|
1137 |
{ |
|
1138 |
testP = new Point(endP.X, endP.Y - 50); |
|
1139 |
//System.Diagnostics.Debug.WriteLine("상단"); |
|
1140 |
} |
|
1141 |
else if (ps[1] == endP) //하단 |
|
1142 |
{ |
|
1143 |
testP = new Point(endP.X, endP.Y + 50); |
|
1144 |
//System.Diagnostics.Debug.WriteLine("하단"); |
|
1145 |
} |
|
1146 |
else if (ps[2] == endP) //좌단 |
|
1147 |
{ |
|
1148 |
testP = new Point(endP.X - 50, endP.Y); |
|
1149 |
//System.Diagnostics.Debug.WriteLine("좌단"); |
|
1150 |
} |
|
1151 |
else if (ps[3] == endP) //우단 |
|
1152 |
{ |
|
1153 |
testP = new Point(endP.X + 50, endP.Y); |
|
1154 |
//System.Diagnostics.Debug.WriteLine("우단"); |
|
1155 |
} |
|
1156 |
Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], testP.X); |
|
1157 |
Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], testP.Y); |
|
1158 |
} |
|
1159 |
else |
|
1160 |
{ |
|
1161 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
1162 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
|
1163 |
Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X); |
|
1164 |
Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y); |
|
1165 |
} |
|
1166 |
} |
|
1167 |
} |
|
1161 |
item.UpdateThumb(); |
|
1168 | 1162 |
} |
1169 | 1163 |
|
1170 | 1164 |
public void Set_Rotate() |
... | ... | |
1433 | 1427 |
|
1434 | 1428 |
double LastRotateHorizontalValue = 0; |
1435 | 1429 |
double LastRotateVerticalValue = 0; |
1436 |
//double LastWidthValue = 0; |
|
1437 |
//double SetWidth = 0; |
|
1438 | 1430 |
bool RotateFlag = false; |
1439 | 1431 |
|
1440 | 1432 |
/// <summary> |
내보내기 Unified diff