개정판 fa48eb85
issue #1000 컨트롤 angle 수정/ Textcontrol 텍스트 선택 수정
Change-Id: I56b5c6295adb7409774045545f30f16a920be96c
MarkupToPDF/Controls/Text/ArrowTextControl.cs | ||
---|---|---|
76 | 76 |
Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus); |
77 | 77 |
Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus); |
78 | 78 |
Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret(); |
79 |
|
|
79 |
this.KeyDown += ArrowTextControl_KeyDown; |
|
80 | 80 |
SetArrowTextPath(); |
81 | 81 |
Base_TextBox.IsTabStop = true; |
82 | 82 |
} |
83 | 83 |
|
84 |
private void ArrowTextControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) |
|
85 |
{ |
|
86 |
if(e.Key == System.Windows.Input.Key.Escape) |
|
87 |
{ |
|
88 |
if(string.IsNullOrEmpty(Base_TextBox.Text)) |
|
89 |
{ |
|
90 |
this.Visibility = Visibility.Collapsed; |
|
91 |
} |
|
92 |
|
|
93 |
EditEnd(); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
84 | 97 |
public void SetFontFamily(FontFamily fontFamily) |
85 | 98 |
{ |
86 | 99 |
this.FontFamily = fontFamily; |
... | ... | |
94 | 107 |
{ |
95 | 108 |
var caretLocation = this.Base_TextBox.GetRectFromCharacterIndex(this.Base_TextBox.CaretIndex).Location; |
96 | 109 |
|
110 |
var angle = Math.Abs(this.PageAngle); |
|
111 |
//angle = 0; |
|
112 |
System.Diagnostics.Debug.WriteLine("Page Angle : " + this.PageAngle); |
|
113 |
|
|
97 | 114 |
if (!double.IsInfinity(caretLocation.X)) |
98 | 115 |
{ |
99 |
if (Math.Abs(this.Angle) == 90)
|
|
116 |
if (angle == 90)
|
|
100 | 117 |
{ |
101 | 118 |
Canvas.SetLeft(this.BaseTextbox_Caret, this.EndPoint.X + caretLocation.Y); |
102 | 119 |
} |
103 |
else if (Math.Abs(this.Angle) == 180)
|
|
120 |
else if (angle == 180)
|
|
104 | 121 |
{ |
105 | 122 |
|
106 | 123 |
Canvas.SetLeft(this.BaseTextbox_Caret, (this.EndPoint.X+ this.Base_TextBox.ActualWidth) - caretLocation.X) ; |
107 |
} |
|
108 |
else if (Math.Abs(this.Angle) == 270) |
|
124 |
System.Diagnostics.Debug.WriteLine("Caret X : " + ((this.EndPoint.X + this.Base_TextBox.ActualWidth) - caretLocation.X)); |
|
125 |
} |
|
126 |
else if (angle == 270) |
|
109 | 127 |
{ |
110 | 128 |
Canvas.SetLeft(this.BaseTextbox_Caret, (this.EndPoint.X) - caretLocation.Y); |
111 | 129 |
} |
112 | 130 |
else |
113 | 131 |
{ |
132 |
System.Diagnostics.Debug.WriteLine("Caret X : " + (this.EndPoint.X - caretLocation.X)); |
|
114 | 133 |
Canvas.SetLeft(this.BaseTextbox_Caret, this.EndPoint.X + caretLocation.X); |
115 |
} |
|
134 |
}
|
|
116 | 135 |
} |
117 | 136 |
|
118 | 137 |
if (!double.IsInfinity(caretLocation.Y)) |
119 | 138 |
{ |
120 |
if (Math.Abs(this.Angle) == 90)
|
|
139 |
if (angle == 90)
|
|
121 | 140 |
{ |
122 | 141 |
Canvas.SetTop(this.BaseTextbox_Caret, this.EndPoint.Y - caretLocation.X); |
123 | 142 |
} |
124 |
else if (Math.Abs(this.Angle) == 180)
|
|
143 |
else if (angle == 180)
|
|
125 | 144 |
{//보정치40 |
126 | 145 |
Canvas.SetTop(this.BaseTextbox_Caret, ((this.EndPoint.Y -40) + this.Base_TextBox.ActualHeight)- caretLocation.Y ); |
146 |
System.Diagnostics.Debug.WriteLine("Caret Y : " + (((this.EndPoint.Y - 40) + this.Base_TextBox.ActualHeight) - caretLocation.Y)); |
|
127 | 147 |
} |
128 |
else if (Math.Abs(this.Angle) == 270)
|
|
148 |
else if (angle == 270)
|
|
129 | 149 |
{ |
130 | 150 |
Canvas.SetTop(this.BaseTextbox_Caret, (this.EndPoint.Y) + caretLocation.X); |
131 | 151 |
} |
132 | 152 |
else |
133 | 153 |
{ |
134 |
Canvas.SetTop(this.BaseTextbox_Caret, this.EndPoint.Y + caretLocation.Y); |
|
154 |
Canvas.SetTop(this.BaseTextbox_Caret, this.EndPoint.Y + caretLocation.Y); |
|
155 |
System.Diagnostics.Debug.WriteLine("Caret Y : " + (this.EndPoint.Y + caretLocation.Y - BaseTextbox_Caret.ActualHeight)); |
|
135 | 156 |
} |
136 | 157 |
} |
137 | 158 |
} |
... | ... | |
143 | 164 |
|
144 | 165 |
if (!double.IsInfinity(caretLocation.X)) |
145 | 166 |
{ |
146 |
if (Math.Abs(this.Angle) == 90) |
|
167 |
if (Math.Abs(this.PageAngle) == 90)
|
|
147 | 168 |
{ |
148 | 169 |
Canvas.SetLeft(this.BaseTextbox_Caret, point.X + caretLocation.Y); |
149 | 170 |
} |
150 |
else if (Math.Abs(this.Angle) == 180) |
|
171 |
else if (Math.Abs(this.PageAngle) == 180)
|
|
151 | 172 |
{ |
152 | 173 |
|
153 | 174 |
Canvas.SetLeft(this.BaseTextbox_Caret, (point.X + this.Base_TextBox.ActualWidth) - caretLocation.X); |
154 | 175 |
} |
155 |
else if (Math.Abs(this.Angle) == 270) |
|
176 |
else if (Math.Abs(this.PageAngle) == 270)
|
|
156 | 177 |
{ |
157 | 178 |
Canvas.SetLeft(this.BaseTextbox_Caret, (point.X) - caretLocation.Y); |
158 | 179 |
} |
... | ... | |
164 | 185 |
|
165 | 186 |
if (!double.IsInfinity(caretLocation.Y)) |
166 | 187 |
{ |
167 |
if (Math.Abs(this.Angle) == 90) |
|
188 |
if (Math.Abs(this.PageAngle) == 90)
|
|
168 | 189 |
{ |
169 | 190 |
Canvas.SetTop(this.BaseTextbox_Caret, point.Y - caretLocation.X); |
170 | 191 |
} |
171 |
else if (Math.Abs(this.Angle) == 180) |
|
192 |
else if (Math.Abs(this.PageAngle) == 180)
|
|
172 | 193 |
{ |
173 | 194 |
Canvas.SetTop(this.BaseTextbox_Caret, (point.Y + this.Base_TextBox.ActualHeight) - caretLocation.Y); |
174 | 195 |
} |
175 |
else if (Math.Abs(this.Angle) == 270) |
|
196 |
else if (Math.Abs(this.CommentAngle) == 270)
|
|
176 | 197 |
{ |
177 | 198 |
Canvas.SetTop(this.BaseTextbox_Caret, (point.Y) + caretLocation.X); |
178 | 199 |
} |
... | ... | |
186 | 207 |
|
187 | 208 |
void Base_TextBox_LostFocus(object sender, RoutedEventArgs e) |
188 | 209 |
{ |
189 |
|
|
210 |
EditEnd(); |
|
211 |
} |
|
212 |
|
|
213 |
private void EditEnd() |
|
214 |
{ |
|
190 | 215 |
this.ArrowText = Base_TextBox.Text; |
216 |
Base_TextBox.Focusable = false; |
|
191 | 217 |
this.BaseTextbox_Caret.Visibility = Visibility.Collapsed; |
192 | 218 |
this.IsEditingMode = false; |
193 | 219 |
ApplyOverViewData(); |
... | ... | |
196 | 222 |
void Base_TextBox_GotFocus(object sender, RoutedEventArgs e) |
197 | 223 |
{ |
198 | 224 |
this.BaseTextbox_Caret.Visibility = Visibility.Visible; |
225 |
MoveCustomCaret(); |
|
199 | 226 |
this.IsEditingMode = true; |
200 | 227 |
} |
201 | 228 |
|
... | ... | |
956 | 983 |
{ |
957 | 984 |
instanceGroup.Children.Clear(); |
958 | 985 |
|
986 |
//VisualPageAngle = 0; |
|
987 |
|
|
988 |
if (Math.Abs(PageAngle).ToString() == "90") |
|
989 |
{ |
|
990 |
VisualPageAngle = 270; |
|
991 |
} |
|
992 |
else if (Math.Abs(PageAngle).ToString() == "270") |
|
993 |
{ |
|
994 |
VisualPageAngle = 90; |
|
995 |
} |
|
996 |
else |
|
997 |
{ |
|
998 |
VisualPageAngle = PageAngle; |
|
999 |
} |
|
1000 |
|
|
959 | 1001 |
connectorSMGeometry.StartPoint = this.StartPoint; |
960 | 1002 |
connectorSMGeometry.EndPoint = this.MidPoint; |
961 | 1003 |
connectorMEGeometry.StartPoint = this.MidPoint; //핵심 |
962 | 1004 |
|
1005 |
/// 텍스트박스의 좌표 설정 |
|
963 | 1006 |
Canvas.SetLeft(Base_TextBox, this.EndPoint.X); |
964 | 1007 |
Canvas.SetTop(Base_TextBox, this.EndPoint.Y); |
965 |
|
|
1008 |
System.Diagnostics.Debug.WriteLine($"TextBox Set {this.EndPoint.X},{this.EndPoint.Y}"); |
|
1009 |
|
|
1010 |
|
|
966 | 1011 |
List<Point> ps = new List<Point>(); |
967 | 1012 |
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단 |
968 | 1013 |
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단 |
... | ... | |
971 | 1016 |
|
972 | 1017 |
if (isTrans) |
973 | 1018 |
{ |
974 |
switch (Math.Abs(this.Angle).ToString()) |
|
1019 |
switch (Math.Abs(this.PageAngle).ToString())
|
|
975 | 1020 |
{ |
976 | 1021 |
case "90": |
977 | 1022 |
{ |
... | ... | |
1013 | 1058 |
|
1014 | 1059 |
//20180911 LJY 꺾이는 부분 수정 |
1015 | 1060 |
Point testP = endP; |
1016 |
switch (Math.Abs(this.Angle).ToString()) |
|
1061 |
switch (Math.Abs(this.PageAngle).ToString())
|
|
1017 | 1062 |
{ |
1018 | 1063 |
case "90": |
1019 | 1064 |
testP = new Point(endP.X + 50, endP.Y); |
... | ... | |
1024 | 1069 |
} |
1025 | 1070 |
|
1026 | 1071 |
//20180910 LJY 각도에 따라. |
1027 |
switch (Math.Abs(this.Angle).ToString()) |
|
1072 |
switch (Math.Abs(this.PageAngle).ToString())
|
|
1028 | 1073 |
{ |
1029 | 1074 |
case "90": |
1030 | 1075 |
if (isFixed) |
... | ... | |
1115 | 1160 |
} |
1116 | 1161 |
else |
1117 | 1162 |
{ |
1118 |
switch (Math.Abs(this.Angle).ToString()) |
|
1163 |
switch (Math.Abs(this.PageAngle).ToString())
|
|
1119 | 1164 |
{ |
1120 | 1165 |
case "90": |
1121 | 1166 |
{ |
... | ... | |
1150 | 1195 |
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 |
1151 | 1196 |
} |
1152 | 1197 |
break; |
1198 |
//case "180": |
|
1199 |
// { |
|
1200 |
// ps.Clear(); |
|
1201 |
|
|
1202 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
|
1203 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간 |
|
1204 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽 |
|
1205 |
|
|
1206 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간 |
|
1207 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단 |
|
1208 |
|
|
1209 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단 |
|
1210 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단 |
|
1211 |
|
|
1212 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 |
|
1213 |
// } |
|
1214 |
// break; |
|
1153 | 1215 |
default: |
1154 | 1216 |
break; |
1155 | 1217 |
} |
... | ... | |
1163 | 1225 |
Point testP = endP; |
1164 | 1226 |
|
1165 | 1227 |
//20180910 LJY 각도에 따라. |
1166 |
switch (Math.Abs(this.Angle).ToString()) |
|
1228 |
switch (Math.Abs(this.PageAngle).ToString())
|
|
1167 | 1229 |
{ |
1168 | 1230 |
case "90": |
1169 | 1231 |
if (isFixed) |
... | ... | |
1294 | 1356 |
OverViewEndPoint = connectorMEGeometry.EndPoint; |
1295 | 1357 |
OverViewStartPoint = connectorSMGeometry.StartPoint; |
1296 | 1358 |
|
1297 |
var tempAngle = Math.Abs(this.Angle); |
|
1359 |
var tempAngle = Math.Abs(this.PageAngle);
|
|
1298 | 1360 |
|
1299 | 1361 |
if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270)) |
1300 | 1362 |
{ |
... | ... | |
1306 | 1368 |
BaseTextbox_Caret.RenderTransformOrigin = new Point(0, 0); |
1307 | 1369 |
} |
1308 | 1370 |
|
1371 |
Base_TextBox.RenderTransform = new RotateTransform |
|
1372 |
{ |
|
1373 |
Angle = this.VisualPageAngle, |
|
1374 |
CenterX = this.CenterX, |
|
1375 |
CenterY = this.CenterY, |
|
1376 |
}; |
|
1377 |
|
|
1378 |
System.Diagnostics.Debug.WriteLine($"base TextBox center X : {this.CenterX} Y : {this.CenterY} "); |
|
1379 |
|
|
1380 |
|
|
1381 |
|
|
1309 | 1382 |
Base_ArrowSubPath.RenderTransform = new RotateTransform |
1310 | 1383 |
{ |
1311 |
Angle = this.Angle, |
|
1384 |
Angle = this.VisualPageAngle,
|
|
1312 | 1385 |
CenterX = this.EndPoint.X, |
1313 | 1386 |
CenterY = this.EndPoint.Y, |
1314 | 1387 |
}; |
1315 |
MoveCustomCaret(); |
|
1388 |
|
|
1389 |
if (BaseTextbox_Caret.Visibility == Visibility.Visible) |
|
1390 |
{ |
|
1391 |
BaseTextbox_Caret.RenderTransform = new RotateTransform |
|
1392 |
{ |
|
1393 |
Angle = this.VisualPageAngle, |
|
1394 |
CenterX = this.CenterX, |
|
1395 |
CenterY = this.CenterY, |
|
1396 |
}; |
|
1397 |
|
|
1398 |
MoveCustomCaret(); |
|
1399 |
} |
|
1316 | 1400 |
} |
1317 | 1401 |
|
1318 | 1402 |
private void DrawingCloud() |
1319 | 1403 |
{ |
1320 | 1404 |
//20180906 LJY Textbox guide |
1321 |
string angle = Math.Abs(this.Angle).ToString(); |
|
1405 |
string angle = Math.Abs(this.PageAngle).ToString();
|
|
1322 | 1406 |
if (angle == "180") |
1323 | 1407 |
{ |
1324 | 1408 |
List<Point> pCloud = new List<Point>() |
... | ... | |
1373 | 1457 |
{ |
1374 | 1458 |
this.Base_TextBox.BorderBrush = Brushes.Transparent; |
1375 | 1459 |
} |
1376 |
if (Math.Abs(this.Angle).ToString() == "90") |
|
1460 |
|
|
1461 |
if (Math.Abs(this.PageAngle).ToString() == "90") |
|
1377 | 1462 |
{ |
1378 | 1463 |
List<Point> pCloud = new List<Point>() |
1379 | 1464 |
{ |
... | ... | |
1385 | 1470 |
}; |
1386 | 1471 |
PathDataInner = (GenerateInner(pCloud)); |
1387 | 1472 |
} |
1388 |
else if(Math.Abs(this.Angle).ToString() == "270") |
|
1473 |
else if(Math.Abs(this.PageAngle).ToString() == "270")
|
|
1389 | 1474 |
{ |
1390 | 1475 |
List<Point> pCloud = new List<Point>() |
1391 | 1476 |
{ |
... | ... | |
1606 | 1691 |
this.EndPoint = pt; |
1607 | 1692 |
|
1608 | 1693 |
Point tempPoint = this.EndPoint; |
1609 |
Angle = MathSet.returnAngle(this.StartPoint, ref tempPoint, bShiftKeyPressed); |
|
1694 |
CommentAngle = MathSet.returnAngle(this.StartPoint, ref tempPoint, bShiftKeyPressed);
|
|
1610 | 1695 |
|
1611 | 1696 |
if (bAxisLocked || bShiftKeyPressed) |
1612 | 1697 |
{ |
... | ... | |
1642 | 1727 |
//StartPoint에 표시된 Thumb는 dx,dy가 +로 더해줘야한다. |
1643 | 1728 |
if (path.PointSet.IndexOf(selected) != 0) |
1644 | 1729 |
{ |
1645 |
double radian = this.Angle * Math.PI / 180; |
|
1730 |
double radian = this.CommentAngle * Math.PI / 180;
|
|
1646 | 1731 |
double cos = Math.Cos(radian); |
1647 | 1732 |
double sin = Math.Sin(radian); |
1648 | 1733 |
|
... | ... | |
1730 | 1815 |
STemp.Name = this.GetType().Name.ToString(); |
1731 | 1816 |
STemp.isTrans = this.isTrans; |
1732 | 1817 |
STemp.MidPoint = this.MidPoint; |
1733 |
STemp.Angle = this.Angle; |
|
1818 |
STemp.Angle = this.CommentAngle;
|
|
1734 | 1819 |
STemp.fontConfig = new List<string>() |
1735 | 1820 |
{ |
1736 | 1821 |
this.TextFamily.ToString(), |
... | ... | |
1778 | 1863 |
instance.BoxWidth = s.BoxWidth; |
1779 | 1864 |
instance.BoxHeight = s.BoxHeight; |
1780 | 1865 |
instance.isFixed = s.isFixed; |
1781 |
instance.Angle = s.Angle; |
|
1866 |
instance.CommentAngle = s.Angle;
|
|
1782 | 1867 |
instance.UserID = s.UserID; |
1783 | 1868 |
instance.isTrans = s.isTrans; |
1784 | 1869 |
instance.MidPoint = s.MidPoint; |
내보내기 Unified diff