markus / KCOM / Controls / AdornerFinal.xaml.cs @ 58dd9e89
이력 | 보기 | 이력해설 | 다운로드 (75.6 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | d128ceb2 | humkyung | using KCOM.Events; |
3 | 787a4489 | KangIngu | using MarkupToPDF.Common; |
4 | 684ef11c | ljiyeon | using MarkupToPDF.Controls.Cad; |
5 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Common; |
6 | using MarkupToPDF.Controls.Etc; |
||
7 | using MarkupToPDF.Controls.Line; |
||
8 | 105359ce | ljiyeon | using MarkupToPDF.Controls.Parsing; |
9 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Polygon; |
10 | using MarkupToPDF.Controls.Shape; |
||
11 | using MarkupToPDF.Controls.Text; |
||
12 | using System; |
||
13 | using System.Collections.Generic; |
||
14 | 53880c83 | ljiyeon | using System.Diagnostics; |
15 | 787a4489 | KangIngu | using System.Linq; |
16 | using System.Text; |
||
17 | 8e5a4a6a | taeseongkim | using System.Threading.Tasks; |
18 | 787a4489 | KangIngu | using System.Windows; |
19 | using System.Windows.Controls; |
||
20 | using System.Windows.Controls.Primitives; |
||
21 | using System.Windows.Input; |
||
22 | using System.Windows.Media; |
||
23 | using Telerik.Windows.Controls; |
||
24 | |||
25 | namespace KCOM.Controls |
||
26 | { |
||
27 | f513c215 | humkyung | public class MyThumb : Thumb |
28 | { |
||
29 | public MyThumb() |
||
30 | { |
||
31 | this.Opacity = 0.6; |
||
32 | this.MouseEnter += MyThumb_MouseEnter; |
||
33 | this.MouseLeave += MyThumb_MouseLeave; |
||
34 | } |
||
35 | |||
36 | 3dbace4e | taeseongkim | public void Translate(double dx, double dy, double angle) |
37 | { |
||
38 | var ratotePoint = MathHelper.RotatePoint(new Point(dx, dy), new Point(), angle); |
||
39 | |||
40 | Canvas.SetLeft(this, Canvas.GetLeft(this) + ratotePoint.X); |
||
41 | Canvas.SetTop(this, Canvas.GetTop(this) + ratotePoint.Y); |
||
42 | } |
||
43 | |||
44 | |||
45 | d2114d3b | humkyung | /// <summary> |
46 | f513c215 | humkyung | /// </summary> |
47 | /// <param name="sender"></param> |
||
48 | /// <param name="e"></param> |
||
49 | private void MyThumb_MouseLeave(object sender, MouseEventArgs e) |
||
50 | { |
||
51 | this.Opacity = 0.6; |
||
52 | } |
||
53 | |||
54 | /// <summary> |
||
55 | /// |
||
56 | /// </summary> |
||
57 | /// <param name="sender"></param> |
||
58 | /// <param name="e"></param> |
||
59 | private void MyThumb_MouseEnter(object sender, MouseEventArgs e) |
||
60 | { |
||
61 | this.Opacity = 1.0; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | 787a4489 | KangIngu | /// <summary> |
66 | /// Interaction logic for AdornerFinal.xaml |
||
67 | /// </summary> |
||
68 | public class AdornerMember |
||
69 | { |
||
70 | public UIElement DrawingData { get; set; } |
||
71 | public ControlType Drawingtype { get; set; } |
||
72 | public double DrawingAngle { get; set; } |
||
73 | f513c215 | humkyung | public List<MyThumb> ThumbList { get; set; } |
74 | c8e9b3e4 | ljiyeon | public string Symbol_ID { get; set; } |
75 | 53880c83 | ljiyeon | public long Group_ID { get; set; } |
76 | 508c3ac5 | humkyung | |
77 | /// <summary> |
||
78 | /// update thumb |
||
79 | /// </summary> |
||
80 | public void UpdateThumb() |
||
81 | { |
||
82 | var path = this.DrawingData as IPath; |
||
83 | for (int i = 0; i < path.PointSet.Count; ++i) |
||
84 | { |
||
85 | Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X); |
||
86 | Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y); |
||
87 | } |
||
88 | |||
89 | 3b797b23 | humkyung | if (this.DrawingData is ArrowTextControl ArrowTextCtrl) |
90 | 508c3ac5 | humkyung | { |
91 | 3b797b23 | humkyung | if (!ArrowTextCtrl.isTrans) //trans가 True인경우 |
92 | 508c3ac5 | humkyung | { |
93 | List<Point> ps = new List<Point>(); |
||
94 | |||
95 | var temp = this.DrawingData as ArrowTextControl; |
||
96 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
97 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
98 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
99 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
100 | |||
101 | if (temp.isFixed) |
||
102 | { |
||
103 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
104 | var testP = endP; |
||
105 | if (ps[0] == endP) //상단 |
||
106 | { |
||
107 | testP = new Point(endP.X, endP.Y - 50); |
||
108 | } |
||
109 | else if (ps[1] == endP) //하단 |
||
110 | { |
||
111 | testP = new Point(endP.X, endP.Y + 50); |
||
112 | } |
||
113 | else if (ps[2] == endP) //좌단 |
||
114 | { |
||
115 | testP = new Point(endP.X - 50, endP.Y); |
||
116 | } |
||
117 | else if (ps[3] == endP) //우단 |
||
118 | { |
||
119 | testP = new Point(endP.X + 50, endP.Y); |
||
120 | } |
||
121 | Canvas.SetLeft(this.ThumbList[1], testP.X); |
||
122 | Canvas.SetTop(this.ThumbList[1], testP.Y); |
||
123 | } |
||
124 | else |
||
125 | { |
||
126 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
127 | var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
128 | Canvas.SetLeft(this.ThumbList[1], tempP.X); |
||
129 | Canvas.SetTop(this.ThumbList[1], tempP.Y); |
||
130 | } |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | 554aae3b | humkyung | |
135 | /// <summary> |
||
136 | /// rotate members about given position and angle |
||
137 | /// </summary> |
||
138 | /// <param name="at"></param> |
||
139 | /// <param name="angle">in degree</param> |
||
140 | public void RotateAbout(Point at, double angle) |
||
141 | { |
||
142 | for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++) |
||
143 | { |
||
144 | (this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle); |
||
145 | } |
||
146 | (this.DrawingData as CommentUserInfo).UpdateControl(); |
||
147 | |||
148 | this.UpdateThumb(); |
||
149 | } |
||
150 | 787a4489 | KangIngu | } |
151 | 4913851c | humkyung | |
152 | 787a4489 | KangIngu | public partial class AdornerFinal : UserControl |
153 | { |
||
154 | #region 공용 인스턴스 |
||
155 | 4913851c | humkyung | public List<AdornerMember> Members { get; } = new List<AdornerMember>(); |
156 | 787a4489 | KangIngu | public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
157 | b643fcca | taeseongkim | |
158 | edef7af2 | humkyung | 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 }; |
159 | |||
160 | e65e8c5c | humkyung | /// <summary> |
161 | /// 회전 시작할때의 각도 |
||
162 | /// </summary> |
||
163 | b643fcca | taeseongkim | |
164 | e65e8c5c | humkyung | private double angleValue; |
165 | b643fcca | taeseongkim | public double AngleValue { get => angleValue; |
166 | set |
||
167 | { |
||
168 | if(angleValue != value) |
||
169 | { |
||
170 | angleValue = value; |
||
171 | } |
||
172 | } |
||
173 | } |
||
174 | |||
175 | e65e8c5c | humkyung | /// <summary> |
176 | /// Axis Lock을 적용하지 않는 실제 회전 각도 |
||
177 | /// </summary> |
||
178 | private double _ActualAngle { get; set; } |
||
179 | |||
180 | 787a4489 | KangIngu | public bool IsTextAngle = false; |
181 | public Rect BorderSize { get; set; } |
||
182 | public bool TextCompensation = false; |
||
183 | public bool isDragging { get; set; } |
||
184 | public Thumb DraggerThumb { get; set; } |
||
185 | public RadDropDownButton dropData; |
||
186 | public RadCalendar dropCalendar; |
||
187 | public Thumb mainDragThumb { get; set; } |
||
188 | |||
189 | 4913851c | humkyung | private bool disposed; |
190 | |||
191 | 787a4489 | KangIngu | public Point reSizePoint { get; set; } |
192 | e65e8c5c | humkyung | private Point RotatedPoint { get; set; } /// 2018.05.09 added by humkyung |
193 | 0d00f9c8 | humkyung | private Point MouseDownPoint = new Point(); |
194 | private Point CurrentMousePoint = new Point(); |
||
195 | 787a4489 | KangIngu | #endregion |
196 | #region 생성자 |
||
197 | private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
||
198 | { |
||
199 | dropData = sender as RadDropDownButton; |
||
200 | } |
||
201 | 4913851c | humkyung | |
202 | 787a4489 | KangIngu | private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
203 | { |
||
204 | dropCalendar = sender as RadCalendar; |
||
205 | dropCalendar.SelectionChanged += (sen, ea) => |
||
206 | { |
||
207 | dropData.IsOpen = false; |
||
208 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
209 | 787a4489 | KangIngu | { |
210 | 4913851c | humkyung | DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
211 | 787a4489 | KangIngu | data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
212 | } |
||
213 | }; |
||
214 | } |
||
215 | 4913851c | humkyung | |
216 | 787a4489 | KangIngu | public AdornerFinal() |
217 | { |
||
218 | InitializeComponent(); |
||
219 | BorderSize = new Rect(); |
||
220 | _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
||
221 | 4913851c | humkyung | } |
222 | |||
223 | 787a4489 | KangIngu | public AdornerFinal(CommentUserInfo objectData) : this() |
224 | { |
||
225 | InitializeComponent(); |
||
226 | objectData.IsHitTestVisible = false; |
||
227 | 1305c420 | taeseongkim | |
228 | b2d0f316 | humkyung | if (objectData is ArrowTextControl ArrTextCtrl) |
229 | 787a4489 | KangIngu | { |
230 | b2d0f316 | humkyung | ArrTextCtrl.Base_TextBox.Focusable = true; |
231 | 787a4489 | KangIngu | } |
232 | 1305c420 | taeseongkim | |
233 | b2d0f316 | humkyung | ///Canvas.SetZIndex(objectData, 84); |
234 | 787a4489 | KangIngu | try |
235 | { |
||
236 | ef7ba61f | humkyung | objectData.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(objectData); |
237 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData); |
238 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(objectData); |
239 | } |
||
240 | 1066bae3 | ljiyeon | catch (Exception ex) |
241 | 787a4489 | KangIngu | { |
242 | ef7ba61f | humkyung | throw new InvalidOperationException(ex.Message); |
243 | 787a4489 | KangIngu | } |
244 | ef7ba61f | humkyung | |
245 | b2d0f316 | humkyung | SetAdornerMember(objectData); |
246 | 787a4489 | KangIngu | this.Focus(); |
247 | } |
||
248 | 4913851c | humkyung | |
249 | 9b7cda70 | KangIngu | public AdornerFinal(List<CommentUserInfo> objectData) : this() |
250 | 787a4489 | KangIngu | { |
251 | InitializeComponent(); |
||
252 | foreach (var item in objectData) |
||
253 | { |
||
254 | //item.IsHitTestVisible = false; |
||
255 | b2d0f316 | humkyung | if (item is ArrowTextControl ArrTextCtrl) |
256 | 787a4489 | KangIngu | { |
257 | b2d0f316 | humkyung | ArrTextCtrl.Base_TextBox.Focusable = true; |
258 | 787a4489 | KangIngu | } |
259 | try |
||
260 | { |
||
261 | b2d0f316 | humkyung | ///Canvas.SetZIndex(item, 80); |
262 | |||
263 | ef7ba61f | humkyung | item.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(item); |
264 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
265 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(item); |
266 | } |
||
267 | ef7ba61f | humkyung | catch (Exception ex) |
268 | 787a4489 | KangIngu | { |
269 | ef7ba61f | humkyung | throw new InvalidOperationException(ex.Message); |
270 | 787a4489 | KangIngu | } |
271 | 1066bae3 | ljiyeon | finally |
272 | { |
||
273 | ef7ba61f | humkyung | |
274 | 1066bae3 | ljiyeon | } |
275 | 787a4489 | KangIngu | } |
276 | ef7ba61f | humkyung | |
277 | 4913851c | humkyung | this.SetAdornerMember(objectData); |
278 | 787a4489 | KangIngu | this.Focus(); |
279 | } |
||
280 | |||
281 | ef7ba61f | humkyung | ~AdornerFinal() |
282 | { |
||
283 | this.Dispose(false); |
||
284 | } |
||
285 | |||
286 | public void Dispose() |
||
287 | { |
||
288 | this.Dispose(true); |
||
289 | GC.SuppressFinalize(this); |
||
290 | } |
||
291 | |||
292 | protected virtual void Dispose(bool disposing) |
||
293 | { |
||
294 | if (this.disposed) return; |
||
295 | if (disposing) |
||
296 | { |
||
297 | foreach (var member in this.Members) |
||
298 | { |
||
299 | if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData)) |
||
300 | Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo); |
||
301 | } |
||
302 | // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다. |
||
303 | } |
||
304 | // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다. |
||
305 | this.disposed = true; |
||
306 | } |
||
307 | |||
308 | void DragThumb_Loaded(object sender, RoutedEventArgs e) |
||
309 | { |
||
310 | mainDragThumb = DragThumb; |
||
311 | } |
||
312 | |||
313 | 62b6bcde | humkyung | public Point Centeroid |
314 | { |
||
315 | get |
||
316 | { |
||
317 | List<Point> pts = new List<Point>(); |
||
318 | |||
319 | #region 센터 포인트 구하기 (그룹핑) |
||
320 | foreach (var item in this.Members) |
||
321 | { |
||
322 | if (item.DrawingData.GetType().Name == "TextControl") |
||
323 | { |
||
324 | if (AngleValue == 0) |
||
325 | { |
||
326 | fa48eb85 | taeseongkim | AngleValue = (item.DrawingData as TextControl).CommentAngle; |
327 | 62b6bcde | humkyung | } |
328 | double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
||
329 | double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
||
330 | pts.Add(new Point(X, Y)); |
||
331 | } |
||
332 | else |
||
333 | { |
||
334 | pts.AddRange((item.DrawingData as IPath).PointSet); |
||
335 | } |
||
336 | } |
||
337 | #endregion |
||
338 | |||
339 | return MathSet.FindCentroid(pts); |
||
340 | } |
||
341 | } |
||
342 | |||
343 | b643fcca | taeseongkim | #endregion |
344 | #region 메서드 |
||
345 | public Rect getAdornerSize() |
||
346 | 787a4489 | KangIngu | { |
347 | return BorderSize; |
||
348 | } |
||
349 | 902faaea | taeseongkim | |
350 | private void TextControlLostFocus(object sender,RoutedEventArgs e) |
||
351 | { |
||
352 | TextCompensation = false; |
||
353 | BorderUpdate(); |
||
354 | |||
355 | b2d0f316 | humkyung | if (sender is TextBox TextBox) |
356 | 902faaea | taeseongkim | { |
357 | b2d0f316 | humkyung | if (TextBox.Text == "") //보류 |
358 | 902faaea | taeseongkim | { |
359 | this.ContainerContent.Children.Remove((sender as TextBox).Parent as MarkupToPDF.Common.CommentUserInfo); |
||
360 | this.Visibility = Visibility.Collapsed; |
||
361 | } |
||
362 | } |
||
363 | } |
||
364 | |||
365 | private void TextControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||
366 | { |
||
367 | 24c5e56c | taeseongkim | if (sender is TextControl) |
368 | 902faaea | taeseongkim | { |
369 | TextCompensation = true; |
||
370 | BorderUpdate(); |
||
371 | } |
||
372 | } |
||
373 | |||
374 | private void TextControlSelectionChanged(object sender, RoutedEventArgs e) |
||
375 | { |
||
376 | BorderUpdate(); |
||
377 | } |
||
378 | |||
379 | 3b797b23 | humkyung | |
380 | private void ViewBoxRotate(UIElement member) |
||
381 | { |
||
382 | AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
||
383 | DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
||
384 | AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
||
385 | DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
||
386 | } |
||
387 | |||
388 | 787a4489 | KangIngu | /// <summary> |
389 | /// UIElement를 종류에 맞게 등록시킴 |
||
390 | /// </summary> |
||
391 | /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
||
392 | public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
||
393 | 53880c83 | ljiyeon | { |
394 | 787a4489 | KangIngu | switch (member.GetType().Name) |
395 | { |
||
396 | #region 컨트롤 조건 |
||
397 | 554aae3b | humkyung | case "LineControl": |
398 | case "PolygonControl": |
||
399 | 787a4489 | KangIngu | case "ArrowControl": |
400 | 554aae3b | humkyung | case "ArcControl": |
401 | case "ArrowArcControl": |
||
402 | case "ArrowControl_Multi": |
||
403 | case "RectangleControl": |
||
404 | case "TriControl": |
||
405 | case "CircleControl": |
||
406 | case "CloudControl": |
||
407 | case "RectCloudControl": |
||
408 | case "InkControl": |
||
409 | case "InsideWhiteControl": |
||
410 | case "OverlapWhiteControl": |
||
411 | case "ClipWhiteControl": |
||
412 | case "CoordinateControl": |
||
413 | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
414 | e65e8c5c | humkyung | _ActualAngle = AngleValue = member.CommentAngle; |
415 | 787a4489 | KangIngu | break; |
416 | case "ArrowTextControl": |
||
417 | 4913851c | humkyung | this.Members.Add(new AdornerMember |
418 | 53880c83 | ljiyeon | { |
419 | DrawingData = member, |
||
420 | Drawingtype = ControlType.ArrowTextControl, |
||
421 | f513c215 | humkyung | ThumbList = new List<MyThumb>(), |
422 | 53880c83 | ljiyeon | Symbol_ID = member.SymbolID, |
423 | Group_ID = member.GroupID, |
||
424 | }); |
||
425 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
426 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as ArrowTextControl).CommentAngle; |
427 | 902faaea | taeseongkim | |
428 | ((ArrowTextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
429 | 787a4489 | KangIngu | break; |
430 | 554aae3b | humkyung | case "ImgControl": |
431 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
432 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as ImgControl).CommentAngle; |
433 | 2d2252ba | ljiyeon | break; |
434 | 787a4489 | KangIngu | case "DateControl": |
435 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
436 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as DateControl).CommentAngle; |
437 | 2d2252ba | ljiyeon | break; |
438 | 787a4489 | KangIngu | case "SignControl": |
439 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
440 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SignControl).CommentAngle; |
441 | 2d2252ba | ljiyeon | break; |
442 | 787a4489 | KangIngu | case "SymControl": |
443 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
444 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SymControl).CommentAngle; |
445 | 2d2252ba | ljiyeon | break; |
446 | 787a4489 | KangIngu | case "SymControlN": |
447 | 554aae3b | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
448 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SymControlN).CommentAngle; |
449 | 787a4489 | KangIngu | break; |
450 | case "TextControl": |
||
451 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
452 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
453 | { |
||
454 | Rect = new Rect() |
||
455 | { |
||
456 | X = Canvas.GetLeft((member as TextControl)), |
||
457 | Y = Canvas.GetTop((member as TextControl)), |
||
458 | Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
||
459 | Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
||
460 | } |
||
461 | }; |
||
462 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
463 | Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
||
464 | |||
465 | |||
466 | DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
||
467 | DragThumb.RenderTransform = new RotateTransform() |
||
468 | { |
||
469 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
470 | 787a4489 | KangIngu | }; |
471 | |||
472 | AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
||
473 | AdornerBorder.RenderTransform = new RotateTransform() |
||
474 | { |
||
475 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
476 | 787a4489 | KangIngu | }; |
477 | 902faaea | taeseongkim | |
478 | ((TextControl)member).PropertyChanged += TextControlPropertyChanged; |
||
479 | ((TextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
480 | 787a4489 | KangIngu | break; |
481 | default: |
||
482 | break; |
||
483 | #endregion |
||
484 | } |
||
485 | 554aae3b | humkyung | |
486 | 787a4489 | KangIngu | if (member.GetType().Name == "TextControl") |
487 | { |
||
488 | TextControl content = ((TextControl)member); |
||
489 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
490 | content.EndPoint = content.StartPoint; |
||
491 | } |
||
492 | else |
||
493 | { |
||
494 | RegistryPoint(member); |
||
495 | } |
||
496 | BorderUpdate(); |
||
497 | 4913851c | humkyung | |
498 | ab7fe8c0 | humkyung | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) |
499 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); |
||
500 | 787a4489 | KangIngu | } |
501 | |||
502 | 4913851c | humkyung | |
503 | 787a4489 | KangIngu | public void SetAdornerMember(List<CommentUserInfo> members) |
504 | { |
||
505 | foreach (var member in members) |
||
506 | { |
||
507 | switch (member.GetType().Name) |
||
508 | { |
||
509 | #region 컨트롤 조건 |
||
510 | 53880c83 | ljiyeon | case "LineControl": |
511 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
512 | 53880c83 | ljiyeon | break; |
513 | case "ImgControl": |
||
514 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
515 | 787a4489 | KangIngu | break; |
516 | case "ArrowControl": |
||
517 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
518 | 787a4489 | KangIngu | break; |
519 | 53880c83 | ljiyeon | case "PolygonControl": |
520 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
521 | 787a4489 | KangIngu | break; |
522 | case "ArrowTextControl": |
||
523 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
524 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
525 | break; |
||
526 | case "ArcControl": |
||
527 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
528 | 787a4489 | KangIngu | break; |
529 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
530 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
531 | 40b3ce25 | ljiyeon | break; |
532 | 787a4489 | KangIngu | case "DateControl": |
533 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
534 | 787a4489 | KangIngu | break; |
535 | case "ArrowControl_Multi": |
||
536 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
537 | 787a4489 | KangIngu | break; |
538 | case "RectangleControl": |
||
539 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
540 | 787a4489 | KangIngu | break; |
541 | case "TriControl": |
||
542 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
543 | 787a4489 | KangIngu | break; |
544 | case "CircleControl": |
||
545 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
546 | 787a4489 | KangIngu | break; |
547 | case "CloudControl": |
||
548 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
549 | 787a4489 | KangIngu | break; |
550 | case "RectCloudControl": |
||
551 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
552 | 787a4489 | KangIngu | break; |
553 | case "SignControl": |
||
554 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
555 | 787a4489 | KangIngu | break; |
556 | case "SymControl": |
||
557 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
558 | 787a4489 | KangIngu | break; |
559 | case "SymControlN": |
||
560 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
561 | 787a4489 | KangIngu | break; |
562 | 53880c83 | ljiyeon | case "InkControl": |
563 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
564 | 787a4489 | KangIngu | break; |
565 | case "TextControl": |
||
566 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
567 | 787a4489 | KangIngu | |
568 | 902faaea | taeseongkim | (member as TextControl).PropertyChanged += TextControlPropertyChanged; |
569 | (member as TextControl).Base_TextBox.SelectionChanged += TextControlSelectionChanged; |
||
570 | |||
571 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
572 | //{ |
||
573 | // BorderUpdate(); |
||
574 | //}); |
||
575 | //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
||
576 | //{ |
||
577 | // BorderUpdate(); |
||
578 | // try |
||
579 | // { |
||
580 | // ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
581 | // } |
||
582 | // catch (Exception) |
||
583 | // { |
||
584 | |||
585 | // } |
||
586 | |||
587 | //}); |
||
588 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
589 | //{ |
||
590 | // BorderUpdate(); |
||
591 | //}); |
||
592 | 787a4489 | KangIngu | break; |
593 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
594 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
595 | 684ef11c | ljiyeon | break; |
596 | case "OverlapWhiteControl": |
||
597 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
598 | 684ef11c | ljiyeon | break; |
599 | case "ClipWhiteControl": |
||
600 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
601 | 684ef11c | ljiyeon | break; |
602 | case "CoordinateControl": |
||
603 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
604 | 684ef11c | ljiyeon | break; |
605 | 787a4489 | KangIngu | default: |
606 | break; |
||
607 | #endregion |
||
608 | } |
||
609 | if (member.GetType().Name == "TextControl") |
||
610 | { |
||
611 | TextControl content = ((TextControl)member); |
||
612 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
613 | content.EndPoint = content.StartPoint; |
||
614 | } |
||
615 | else |
||
616 | { |
||
617 | RegistryPoint(member, members.Count); |
||
618 | } |
||
619 | 4913851c | humkyung | |
620 | ab7fe8c0 | humkyung | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) |
621 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols |
||
622 | 787a4489 | KangIngu | } |
623 | |||
624 | BorderUpdate(); |
||
625 | } |
||
626 | |||
627 | 902faaea | taeseongkim | |
628 | 787a4489 | KangIngu | /// <summary> |
629 | /// Border 를 갱신 |
||
630 | /// </summary> |
||
631 | public void BorderUpdate() |
||
632 | { |
||
633 | AdornerBorder.MinWidth = 10; |
||
634 | AdornerBorder.MinHeight = 10; |
||
635 | |||
636 | 992a98b4 | KangIngu | double minX = double.MaxValue; |
637 | double minY = double.MaxValue; |
||
638 | double maxX = double.MinValue; |
||
639 | a7bd032b | 이지연 | double maxY = double.MinValue; |
640 | e59e6c8e | 이지연 | double lineSize = 0; |
641 | double marginSize = 0; |
||
642 | 4913851c | humkyung | if (this.Members.Count == 1) |
643 | 787a4489 | KangIngu | { |
644 | 3b797b23 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl") |
645 | 787a4489 | KangIngu | { |
646 | 3b797b23 | humkyung | if ((this.Members[0].DrawingData as TextControl).CommentAngle != 0) |
647 | 787a4489 | KangIngu | { |
648 | 3b797b23 | humkyung | trRotate.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle; |
649 | trRotateThumb.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle; |
||
650 | 787a4489 | KangIngu | } |
651 | else |
||
652 | { |
||
653 | trRotate.Angle = 0; |
||
654 | trRotateThumb.Angle = 0; |
||
655 | } |
||
656 | } |
||
657 | } |
||
658 | 3b797b23 | humkyung | |
659 | 4913851c | humkyung | foreach (var item in this.Members) |
660 | 787a4489 | KangIngu | { |
661 | 58dd9e89 | humkyung | UIElement currentControl = item.DrawingData; |
662 | a7bd032b | 이지연 | |
663 | b643fcca | taeseongkim | Point startP = (currentControl as IPath).StartPoint; |
664 | Point endP = (currentControl as IPath).EndPoint; |
||
665 | |||
666 | 902faaea | taeseongkim | // ViewerDataModel.Instance.Angle = MathSet.returnAngle(startP, ref endP, ViewerDataModel.Instance.IsPressShift); |
667 | |||
668 | // 컨트롤의 angle변환시 상단 anglecontrol에 출력 |
||
669 | 4f017ed3 | taeseongkim | ViewerDataModel.Instance.MarkupAngle = (currentControl as CommentUserInfo).CommentAngle; |
670 | b643fcca | taeseongkim | |
671 | 787a4489 | KangIngu | if (item.DrawingData.GetType().Name == "TextControl") |
672 | { |
||
673 | double textControlWidth; |
||
674 | double textControlHeight; |
||
675 | e59e6c8e | 이지연 | |
676 | 787a4489 | KangIngu | if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
677 | { |
||
678 | textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
||
679 | textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
||
680 | } |
||
681 | else |
||
682 | { |
||
683 | textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
||
684 | textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
||
685 | } |
||
686 | 29010418 | ljiyeon | |
687 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.X < minX) |
688 | { |
||
689 | minX = (currentControl as TextControl).EndPoint.X; |
||
690 | } |
||
691 | fa48eb85 | taeseongkim | |
692 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.Y < minY) |
693 | { |
||
694 | minY = (currentControl as TextControl).EndPoint.Y; |
||
695 | } |
||
696 | fa48eb85 | taeseongkim | |
697 | 787a4489 | KangIngu | if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
698 | { |
||
699 | maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
||
700 | } |
||
701 | fa48eb85 | taeseongkim | |
702 | 787a4489 | KangIngu | if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
703 | { |
||
704 | maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
||
705 | } |
||
706 | d3b658ee | 이지연 | if ((currentControl as TextControl).ControlType_No == 2) |
707 | 3c4acae8 | 이지연 | marginSize = (((currentControl as TextControl).Base_TextPath).ActualHeight - ((currentControl as TextControl).Base_Border).ActualHeight) / 2 + (((dynamic)currentControl).LineSize.Left / 2) + (currentControl as TextControl).ArcLength - 30; |
708 | if ((currentControl as TextControl).ControlType_No == 1) |
||
709 | marginSize = ((dynamic)currentControl).LineSize.Left; |
||
710 | 787a4489 | KangIngu | } |
711 | else if ((currentControl as IViewBox) != null) |
||
712 | { |
||
713 | IViewBox instance = currentControl as IViewBox; |
||
714 | List<Point> am = (currentControl as IPath).PointSet; |
||
715 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
716 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
717 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
718 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
719 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
720 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
721 | } |
||
722 | else if ((currentControl as IPath).PathData == null) |
||
723 | { |
||
724 | Rect rt = new Rect |
||
725 | { |
||
726 | X = (currentControl as IPath).StartPoint.X, |
||
727 | Y = (currentControl as IPath).StartPoint.Y, |
||
728 | Width = Math.Max((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X) - Math.Min((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X), |
||
729 | Height = Math.Max((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y) - Math.Min((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y), |
||
730 | }; |
||
731 | if (rt.Left < minX) minX = rt.Left; |
||
732 | if (rt.Top < minY) minY = rt.Top; |
||
733 | if (rt.Right > maxX) maxX = rt.Right; |
||
734 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
735 | } |
||
736 | else if ((currentControl as IPath) == null) |
||
737 | { |
||
738 | Rect rt = new Rect |
||
739 | { |
||
740 | X = (currentControl as IPath).StartPoint.X, |
||
741 | Y = (currentControl as IPath).StartPoint.Y, |
||
742 | Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
||
743 | Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
||
744 | }; |
||
745 | if (rt.Left < minX) minX = rt.Left; |
||
746 | if (rt.Top < minY) minY = rt.Top; |
||
747 | if (rt.Right > maxX) maxX = rt.Right; |
||
748 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
749 | } |
||
750 | 3b797b23 | humkyung | else if (currentControl is CircleControl CircleCtrl) |
751 | { |
||
752 | List<Point> am = CircleCtrl.PointSet; |
||
753 | e59e6c8e | 이지연 | lineSize = CircleCtrl.LineSize; |
754 | 3b797b23 | humkyung | minX = am.Min(x => x.X); |
755 | minY = am.Min(x => x.Y); |
||
756 | maxX = am.Max(x => x.X); |
||
757 | maxY = am.Max(x => x.Y); |
||
758 | 787a4489 | KangIngu | } |
759 | a7bd032b | 이지연 | else |
760 | 787a4489 | KangIngu | { |
761 | e59e6c8e | 이지연 | lineSize = ((dynamic)currentControl).LineSize; |
762 | 787a4489 | KangIngu | if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
763 | if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
||
764 | if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
||
765 | if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
||
766 | } |
||
767 | } |
||
768 | |||
769 | e59e6c8e | 이지연 | Rect ac = new Rect(minX , minY, maxX - minX, maxY - minY); |
770 | 787a4489 | KangIngu | bool addWidthSize = false; |
771 | bool addHeightSize = false; |
||
772 | if (ac.Width <= 10) |
||
773 | { |
||
774 | ac.Width += 10; |
||
775 | addWidthSize = true; |
||
776 | } |
||
777 | if (ac.Height <= 10) |
||
778 | { |
||
779 | ac.Height += 10; |
||
780 | addHeightSize = true; |
||
781 | } |
||
782 | BorderSize = ac; |
||
783 | e59e6c8e | 이지연 | //lineSize : Thickness 굵기에 따라서 adoner 수정 |
784 | ac.Width += lineSize; |
||
785 | ac.Height += lineSize; |
||
786 | 787a4489 | KangIngu | AdornerBorder.MinWidth = 10; |
787 | AdornerBorder.MinHeight = 10; |
||
788 | AdornerBorder.Width = ac.Width; |
||
789 | AdornerBorder.Height = ac.Height; |
||
790 | e59e6c8e | 이지연 | minX -= lineSize / 2; |
791 | minY -= lineSize / 2; |
||
792 | 787a4489 | KangIngu | Canvas.SetLeft(AdornerBorder, minX); |
793 | Canvas.SetTop(AdornerBorder, minY); |
||
794 | |||
795 | DragThumb.Width = ac.Width; |
||
796 | DragThumb.Height = ac.Height; |
||
797 | 3c4acae8 | 이지연 | rotateTop.Margin = new Thickness(rotateTop.Margin.Left, -30 - marginSize, rotateTop.Margin.Right, rotateTop.Margin.Bottom); |
798 | 787a4489 | KangIngu | DragThumb.MinWidth = 10; |
799 | DragThumb.MinHeight = 10; |
||
800 | if (addWidthSize) |
||
801 | { |
||
802 | Canvas.SetLeft(DragThumb, minX - 5); |
||
803 | } |
||
804 | else |
||
805 | { |
||
806 | Canvas.SetLeft(DragThumb, minX); |
||
807 | } |
||
808 | |||
809 | if (addHeightSize) |
||
810 | { |
||
811 | Canvas.SetTop(DragThumb, minY - 5); |
||
812 | } |
||
813 | else |
||
814 | { |
||
815 | Canvas.SetTop(DragThumb, minY); |
||
816 | } |
||
817 | } |
||
818 | 3b797b23 | humkyung | |
819 | 787a4489 | KangIngu | /// <summary> |
820 | /// UIElement 해제 |
||
821 | /// </summary> |
||
822 | b2d0f316 | humkyung | public void UnRegister() |
823 | 787a4489 | KangIngu | { |
824 | foreach (var item in this.ContainerContent.Children) |
||
825 | { |
||
826 | if (item is MarkupToPDF.Common.CommentUserInfo) |
||
827 | { |
||
828 | (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
||
829 | } |
||
830 | } |
||
831 | this.ContainerContent.Children.Clear(); |
||
832 | } |
||
833 | f513c215 | humkyung | |
834 | 787a4489 | KangIngu | /// <summary> |
835 | /// 각 포인트들을 등록합니다. |
||
836 | /// </summary> |
||
837 | /// <param name="pointset">Drawing Point</param> |
||
838 | public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
||
839 | 53880c83 | ljiyeon | { |
840 | 787a4489 | KangIngu | int count = 0; |
841 | e65e8c5c | humkyung | List<Point> pts = (member as IPath).PointSet; |
842 | 787a4489 | KangIngu | if (member.GetType().Name == "InkControl") |
843 | { |
||
844 | e65e8c5c | humkyung | pts.Clear(); |
845 | pts.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
||
846 | pts.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
||
847 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
||
848 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
||
849 | 787a4489 | KangIngu | } |
850 | 3b797b23 | humkyung | ControlType markT = this.Members.First(p => p.DrawingData == member).Drawingtype; |
851 | e65e8c5c | humkyung | double Minx = pts.Min(x => x.X); |
852 | double Miny = pts.Min(x => x.Y); |
||
853 | 3b797b23 | humkyung | |
854 | e65e8c5c | humkyung | for (int i = 0; i < pts.Count; i++) |
855 | 787a4489 | KangIngu | { |
856 | f513c215 | humkyung | MyThumb tm = new MyThumb |
857 | 787a4489 | KangIngu | { |
858 | Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
||
859 | }; |
||
860 | |||
861 | 4913851c | humkyung | this.Members.Last().ThumbList.Add(tm); |
862 | 29010418 | ljiyeon | |
863 | e65e8c5c | humkyung | if ((markT == ControlType.ArcLine && pts[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && pts[i] == (member as ArrowArcControl).MiddlePoint)) |
864 | 787a4489 | KangIngu | { |
865 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
866 | } |
||
867 | if (member.GetType().Name == "ArrowTextControl" && i == 1) |
||
868 | { |
||
869 | 4913851c | humkyung | //if (this.Members.Count()<=1) |
870 | 787a4489 | KangIngu | //{ |
871 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
872 | List<Point> ps = new List<Point>(); |
||
873 | |||
874 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
875 | 787a4489 | KangIngu | { |
876 | 4913851c | humkyung | var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
877 | 787a4489 | KangIngu | |
878 | fa48eb85 | taeseongkim | switch (Math.Abs(temp.CommentAngle).ToString()) |
879 | 787a4489 | KangIngu | { |
880 | case "90": |
||
881 | { |
||
882 | ps.Clear(); |
||
883 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
884 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
885 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
||
886 | |||
887 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
888 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
889 | |||
890 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
891 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
892 | |||
893 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
894 | } |
||
895 | break; |
||
896 | case "270": |
||
897 | { |
||
898 | ps.Clear(); |
||
899 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
900 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
901 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
902 | |||
903 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
904 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
905 | |||
906 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
907 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
908 | |||
909 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
910 | } |
||
911 | break; |
||
912 | default: |
||
913 | { |
||
914 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
915 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
916 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
917 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
918 | } |
||
919 | break; |
||
920 | } |
||
921 | |||
922 | ArrowTextControl instance = (member as ArrowTextControl); |
||
923 | if (instance.isTrans) |
||
924 | { |
||
925 | //var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
926 | //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
927 | //list[count] = tempP; |
||
928 | e65e8c5c | humkyung | pts[count] = temp.MidPoint; |
929 | 787a4489 | KangIngu | } |
930 | else |
||
931 | { |
||
932 | if (temp.isFixed) |
||
933 | { |
||
934 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
935 | var testP = endP; |
||
936 | if (ps[0] == endP) //상단 |
||
937 | { |
||
938 | testP = new Point(endP.X, endP.Y - 50); |
||
939 | } |
||
940 | else if (ps[1] == endP) //하단 |
||
941 | { |
||
942 | testP = new Point(endP.X, endP.Y + 50); |
||
943 | } |
||
944 | else if (ps[2] == endP) //좌단 |
||
945 | { |
||
946 | testP = new Point(endP.X - 50, endP.Y); |
||
947 | } |
||
948 | else if (ps[3] == endP) //우단 |
||
949 | { |
||
950 | testP = new Point(endP.X + 50, endP.Y); |
||
951 | } |
||
952 | e65e8c5c | humkyung | pts[count] = testP; |
953 | 787a4489 | KangIngu | } |
954 | else |
||
955 | { |
||
956 | var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
||
957 | e65e8c5c | humkyung | pts[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
958 | 787a4489 | KangIngu | } |
959 | } |
||
960 | } |
||
961 | } |
||
962 | 39f208de | taeseongkim | |
963 | /// ArrowTextControl text box 화면 출력 |
||
964 | e65e8c5c | humkyung | if (member.GetType().Name == "ArrowTextControl" && pts[i] == pts.Last()) |
965 | 787a4489 | KangIngu | { |
966 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
||
967 | tm.Width = (member as ArrowTextControl).BoxWidth; |
||
968 | tm.Height = (member as ArrowTextControl).BoxHeight; |
||
969 | fa48eb85 | taeseongkim | var angle = (member as ArrowTextControl).PageAngle; |
970 | 787a4489 | KangIngu | if (Math.Abs(angle).ToString() == "90") |
971 | { |
||
972 | tm.RenderTransformOrigin = new Point(0, 0); |
||
973 | tm.RenderTransform = new RotateTransform { Angle = 270 }; |
||
974 | } |
||
975 | else if (Math.Abs(angle).ToString() == "270") |
||
976 | { |
||
977 | tm.RenderTransformOrigin = new Point(0, 0); |
||
978 | tm.RenderTransform = new RotateTransform { Angle = 90 }; |
||
979 | } |
||
980 | else |
||
981 | { |
||
982 | tm.RenderTransformOrigin = new Point(0.5, 0.5); |
||
983 | tm.RenderTransform = new RotateTransform() |
||
984 | { |
||
985 | fa48eb85 | taeseongkim | Angle = angle |
986 | 787a4489 | KangIngu | }; |
987 | } |
||
988 | } |
||
989 | 29010418 | ljiyeon | |
990 | 787a4489 | KangIngu | if (member.GetType().Name == "CloudControl") |
991 | { |
||
992 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
993 | 787a4489 | KangIngu | { |
994 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
995 | } |
||
996 | } |
||
997 | if (member.GetType().Name == "PolygonControl") |
||
998 | { |
||
999 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
1000 | 787a4489 | KangIngu | { |
1001 | if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
||
1002 | { |
||
1003 | |||
1004 | } |
||
1005 | else |
||
1006 | { |
||
1007 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1008 | } |
||
1009 | } |
||
1010 | if ((member as PolygonControl).ControlType == ControlType.Ink) |
||
1011 | { |
||
1012 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1013 | } |
||
1014 | } |
||
1015 | 29010418 | ljiyeon | |
1016 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(tm); |
1017 | e65e8c5c | humkyung | Canvas.SetLeft(tm, pts[count].X); |
1018 | Canvas.SetTop(tm, pts[count].Y); |
||
1019 | if (member.GetType().Name == "ArrowTextControl" && pts[i] == (member as ArrowTextControl).MidPoint) |
||
1020 | 787a4489 | KangIngu | { |
1021 | Canvas.SetZIndex(tm, 95); |
||
1022 | 1b2cf911 | taeseongkim | //tm.Opacity = 0; |
1023 | 3dbace4e | taeseongkim | tm.DragDelta += MidPoint_DragDelta; |
1024 | 787a4489 | KangIngu | } |
1025 | else |
||
1026 | { |
||
1027 | 3dbace4e | taeseongkim | tm.DragDelta += ResizeTm_DragDelta; |
1028 | 787a4489 | KangIngu | Canvas.SetZIndex(tm, 99); |
1029 | } |
||
1030 | |||
1031 | tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
||
1032 | tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
||
1033 | 3dbace4e | taeseongkim | |
1034 | 787a4489 | KangIngu | tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
1035 | count++; |
||
1036 | } |
||
1037 | } |
||
1038 | |||
1039 | 3dbace4e | taeseongkim | private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e) |
1040 | { |
||
1041 | MyThumb thumb = sender as MyThumb; |
||
1042 | double newHorizontalChange = e.HorizontalChange; |
||
1043 | double newVerticalChange = e.VerticalChange; |
||
1044 | |||
1045 | 41c4405e | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), 0);// commentInfo.VisualPageAngle); |
1046 | 3dbace4e | taeseongkim | |
1047 | var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle); |
||
1048 | |||
1049 | System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString()); |
||
1050 | |||
1051 | AdornerMember control = CurrentAdornerMember(thumb); |
||
1052 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1053 | |||
1054 | if (commentInfo is ArrowTextControl) |
||
1055 | { |
||
1056 | Point getThumbPoint = GetPosition(thumb); |
||
1057 | |||
1058 | var arrowText = commentInfo as ArrowTextControl; |
||
1059 | |||
1060 | //var midPoint = MathSet.getMiddlePoint(arrowText.StartPoint, arrowText.EndPoint); |
||
1061 | //arrowText.MidPoint = newpoint; |
||
1062 | thumb.Translate(newpoint.X, newpoint.Y, this.AngleValue); |
||
1063 | 41c4405e | taeseongkim | |
1064 | 3dbace4e | taeseongkim | commentInfo.OnMoveCtrlPoint(getThumbPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1065 | |||
1066 | control.UpdateThumb(); |
||
1067 | |||
1068 | System.Diagnostics.Debug.WriteLine($"text {Canvas.GetLeft(arrowText.Base_TextBox)},{Canvas.GetTop(arrowText.Base_TextBox)}"); |
||
1069 | |||
1070 | System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y} Change Value : {newpoint.X},{newpoint.Y}"); |
||
1071 | } |
||
1072 | |||
1073 | } |
||
1074 | |||
1075 | |||
1076 | ab7fe8c0 | humkyung | /// <summary> |
1077 | /// 제어점을 조정하여 크기를 수정한다. |
||
1078 | /// </summary> |
||
1079 | /// <param name="sender"></param> |
||
1080 | /// <param name="e"></param> |
||
1081 | 787a4489 | KangIngu | private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
1082 | { |
||
1083 | 7bb40d38 | taeseongkim | if (sender.GetType() != typeof(MyThumb)) return; |
1084 | |||
1085 | MyThumb thumb = sender as MyThumb; |
||
1086 | |||
1087 | d2114d3b | humkyung | if (this.Members.Count > 1) return; |
1088 | 7bb40d38 | taeseongkim | |
1089 | System.Diagnostics.Debug.WriteLine($"Value {e.HorizontalChange},{e.VerticalChange}"); |
||
1090 | |||
1091 | double newHorizontalChange = e.HorizontalChange; |
||
1092 | double newVerticalChange = e.VerticalChange; |
||
1093 | |||
1094 | 39f208de | taeseongkim | //if (reSizePoint != new Point(0, 0)) |
1095 | //{ |
||
1096 | 15bbef90 | taeseongkim | //Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas); |
1097 | |||
1098 | 39f208de | taeseongkim | Point setPoint = GetPosition(thumb); |
1099 | 8de55603 | taeseongkim | |
1100 | //System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y} Change Value : {newHorizontalChange},{newVerticalChange}"); |
||
1101 | 15bbef90 | taeseongkim | |
1102 | 8de55603 | taeseongkim | AdornerMember control = CurrentAdornerMember(thumb); |
1103 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1104 | 15bbef90 | taeseongkim | |
1105 | 39f208de | taeseongkim | double ratatePointAngle = 0; |
1106 | 233ef333 | taeseongkim | |
1107 | 39f208de | taeseongkim | if (commentInfo is ArrowTextControl) |
1108 | 8de55603 | taeseongkim | { |
1109 | 39f208de | taeseongkim | var textControl = (commentInfo as ArrowTextControl); |
1110 | 233ef333 | taeseongkim | |
1111 | 39f208de | taeseongkim | if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint)) //(textControl.MidPoint == MathSet.getNearPoint(textControl.PointSet,setPoint) || |
1112 | |||
1113 | { |
||
1114 | 3dbace4e | taeseongkim | textControl.CommentAngle = 0; |
1115 | this.AngleValue = 0; |
||
1116 | ratatePointAngle = commentInfo.VisualPageAngle; |
||
1117 | 39f208de | taeseongkim | } |
1118 | else |
||
1119 | 41c4405e | taeseongkim | { |
1120 | 39f208de | taeseongkim | //textControl.CommentAngle = commentInfo.VisualPageAngle + MathSet.returnAngle(textControl.StartPoint, ref tempPoint, ViewerDataModel.Instance.IsPressShift); |
1121 | 41c4405e | taeseongkim | textControl.OnCreatingMouseMove(textControl.EndPoint, ViewerDataModel.Instance.IsPressShift); |
1122 | 39f208de | taeseongkim | this.AngleValue = textControl.CommentAngle; |
1123 | commentInfo.CommentAngle = this.AngleValue; |
||
1124 | } |
||
1125 | //CommentAngle = MathSet.returnAngle(this.StartPoint, ref tempPoint, bAxisLocked); |
||
1126 | 8de55603 | taeseongkim | } |
1127 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##"); |
1128 | thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue); |
||
1129 | |||
1130 | // 페이지회전에 따른 화살표텍스트 박스의 이동 수정 |
||
1131 | 43e1d368 | taeseongkim | |
1132 | 39f208de | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
1133 | |||
1134 | Point thumbPoint = MathHelper.RotatePoint(setPoint, new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
||
1135 | |||
1136 | //thumbPoint.X = Math.Abs(thumbPoint.X); |
||
1137 | //thumbPoint.Y = Math.Abs(thumbPoint.Y); |
||
1138 | |||
1139 | //if ((setPoint.X + newpoint.X) < 0 || (Math.Abs(thumbPoint.X) + newpoint.X) - ViewerDataModel.Instance.ImageViewWidth > 0) |
||
1140 | //{ |
||
1141 | // newpoint.X = 0; |
||
1142 | //} |
||
1143 | |||
1144 | //if (setPoint.Y + newpoint.Y < 0 || (Math.Abs(thumbPoint.Y) + newpoint.Y) - ViewerDataModel.Instance.ImageViewHeight > 0) |
||
1145 | //{ |
||
1146 | // newpoint.Y = 0; |
||
1147 | //} |
||
1148 | 8de55603 | taeseongkim | |
1149 | commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
||
1150 | |||
1151 | //System.Diagnostics.Debug.WriteLine($"3. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
||
1152 | 508c3ac5 | humkyung | control.UpdateThumb(); |
1153 | 15bbef90 | taeseongkim | |
1154 | 8de55603 | taeseongkim | //System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1155 | 508c3ac5 | humkyung | this.BorderUpdate(); |
1156 | 15bbef90 | taeseongkim | |
1157 | 8de55603 | taeseongkim | //System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1158 | 39f208de | taeseongkim | //} |
1159 | 8de55603 | taeseongkim | } |
1160 | |||
1161 | private AdornerMember CurrentAdornerMember(MyThumb thumb) |
||
1162 | { |
||
1163 | AdornerMember result = null; |
||
1164 | |||
1165 | try |
||
1166 | { |
||
1167 | result = (from userThumb in this.Members |
||
1168 | where userThumb.ThumbList.Contains(thumb) |
||
1169 | select userThumb).FirstOrDefault(); |
||
1170 | } |
||
1171 | catch (Exception ex) |
||
1172 | { |
||
1173 | App.FileLogger.Error(ex); |
||
1174 | 787a4489 | KangIngu | } |
1175 | 8de55603 | taeseongkim | |
1176 | return result; |
||
1177 | 787a4489 | KangIngu | } |
1178 | |||
1179 | 15bbef90 | taeseongkim | private Point GetPosition(Thumb thumb) |
1180 | { |
||
1181 | return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
||
1182 | } |
||
1183 | |||
1184 | 787a4489 | KangIngu | #endregion |
1185 | #region 이벤트 |
||
1186 | |||
1187 | void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1188 | { |
||
1189 | this.isDragging = false; |
||
1190 | DraggerThumb = null; |
||
1191 | |||
1192 | fd452a01 | swate0609 | |
1193 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1194 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1195 | 26ec6226 | taeseongkim | ViewerDataModel.Instance.IsMarkupUpdate = true; |
1196 | 787a4489 | KangIngu | } |
1197 | |||
1198 | ec052e41 | humkyung | /// <summary> |
1199 | /// start drag |
||
1200 | /// </summary> |
||
1201 | /// <param name="sender"></param> |
||
1202 | /// <param name="e"></param> |
||
1203 | 787a4489 | KangIngu | void tm_DragStarted(object sender, DragStartedEventArgs e) |
1204 | { |
||
1205 | this.DraggerThumb = sender as Thumb; |
||
1206 | this.isDragging = true; |
||
1207 | |||
1208 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1209 | { |
||
1210 | return; |
||
1211 | } |
||
1212 | |||
1213 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1214 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1215 | 34ac8db7 | humkyung | |
1216 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1217 | 787a4489 | KangIngu | } |
1218 | |||
1219 | private void rotate_MouseMove(object sender, MouseEventArgs e) |
||
1220 | { |
||
1221 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1222 | 787a4489 | KangIngu | { |
1223 | if (LastRotateVerticalValue < e.GetPosition(this).X) |
||
1224 | IsTextAngle = true; |
||
1225 | else |
||
1226 | IsTextAngle = false; |
||
1227 | LastRotateVerticalValue = e.GetPosition(this).X; |
||
1228 | } |
||
1229 | 9f473fb7 | KangIngu | else |
1230 | 53880c83 | ljiyeon | { |
1231 | 9f473fb7 | KangIngu | if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1232 | { |
||
1233 | RotateFlag = true; |
||
1234 | } |
||
1235 | else |
||
1236 | { |
||
1237 | RotateFlag = false; |
||
1238 | } |
||
1239 | LastRotateHorizontalValue = e.GetPosition(this).X; |
||
1240 | } |
||
1241 | 787a4489 | KangIngu | } |
1242 | |||
1243 | 8771edc4 | humkyung | private void drag_DragStarted(object sender, DragStartedEventArgs e) |
1244 | { |
||
1245 | /// save mouse down and current mouse point |
||
1246 | this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1247 | this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1248 | /// up to here |
||
1249 | |||
1250 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1251 | { |
||
1252 | return; |
||
1253 | } |
||
1254 | |||
1255 | var comments = (from drawing in this.Members |
||
1256 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1257 | 34ac8db7 | humkyung | |
1258 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1259 | 8771edc4 | humkyung | } |
1260 | |||
1261 | private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1262 | { |
||
1263 | 902faaea | taeseongkim | DragThumb.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1264 | 8771edc4 | humkyung | |
1265 | var comments = (from drawing in this.Members |
||
1266 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1267 | } |
||
1268 | |||
1269 | 6b6e937c | taeseongkim | private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1270 | 787a4489 | KangIngu | { |
1271 | 508c3ac5 | humkyung | double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale; |
1272 | 025ebf74 | humkyung | |
1273 | f3ab410f | taeseongkim | var newMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1274 | |||
1275 | var horzChange = (newMousePoint.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale; |
||
1276 | var vertChange = (newMousePoint.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale; |
||
1277 | |||
1278 | 0d00f9c8 | humkyung | try |
1279 | { |
||
1280 | DragThumb.Cursor = Cursors.SizeAll; |
||
1281 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}"); |
1282 | System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}"); |
||
1283 | 8e5a4a6a | taeseongkim | |
1284 | |||
1285 | 39f208de | taeseongkim | var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(); |
1286 | f3ab410f | taeseongkim | |
1287 | 39f208de | taeseongkim | mainRect = MathHelper.RotateRect(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(), new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
1288 | |||
1289 | var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel); |
||
1290 | |||
1291 | var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
||
1292 | |||
1293 | var moveDirection = mainRect.Movement(rotationRect); |
||
1294 | f3ab410f | taeseongkim | |
1295 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}"); |
1296 | 8de55603 | taeseongkim | |
1297 | this.TranslateItems(horzChange, vertChange); |
||
1298 | 0d00f9c8 | humkyung | } |
1299 | finally |
||
1300 | { |
||
1301 | /// update CurrentMousePoint |
||
1302 | f3ab410f | taeseongkim | this.CurrentMousePoint = newMousePoint; |
1303 | 0d00f9c8 | humkyung | } |
1304 | 787a4489 | KangIngu | } |
1305 | eb2b9248 | KangIngu | |
1306 | 0d00f9c8 | humkyung | /// <summary> |
1307 | /// translate all members |
||
1308 | /// </summary> |
||
1309 | /// <param name="e"></param> |
||
1310 | public void TranslateItems(double dx, double dy) |
||
1311 | 787a4489 | KangIngu | { |
1312 | Dispatcher.BeginInvoke((Action)(() => |
||
1313 | { |
||
1314 | 4913851c | humkyung | foreach (var item in this.Members) |
1315 | 787a4489 | KangIngu | { |
1316 | 0d00f9c8 | humkyung | this.TranslateItem(dx, dy, item); |
1317 | 787a4489 | KangIngu | } |
1318 | c7fde400 | taeseongkim | |
1319 | this.BorderUpdate(); |
||
1320 | 787a4489 | KangIngu | })); |
1321 | } |
||
1322 | eb2b9248 | KangIngu | |
1323 | 0d00f9c8 | humkyung | /// <summary> |
1324 | /// translate a item |
||
1325 | /// </summary> |
||
1326 | /// <param name="e"></param> |
||
1327 | /// <param name="item"></param> |
||
1328 | private void TranslateItem(double dx, double dy, AdornerMember item) |
||
1329 | 787a4489 | KangIngu | { |
1330 | 554aae3b | humkyung | /// rotate point with page rotation |
1331 | var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle; |
||
1332 | Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation); |
||
1333 | /// up to here |
||
1334 | 0d00f9c8 | humkyung | (item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1335 | 105359ce | ljiyeon | |
1336 | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
||
1337 | 873011c4 | humkyung | MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), EventType.Operation, null, null); |
1338 | 105359ce | ljiyeon | |
1339 | 508c3ac5 | humkyung | item.UpdateThumb(); |
1340 | 787a4489 | KangIngu | } |
1341 | |||
1342 | private void resize_MouseMove(object sender, MouseEventArgs e) |
||
1343 | { |
||
1344 | 39f208de | taeseongkim | //reSizePoint = e.GetPosition(this); |
1345 | 787a4489 | KangIngu | } |
1346 | 0d00f9c8 | humkyung | |
1347 | 787a4489 | KangIngu | /// <summary> |
1348 | /// 회전 |
||
1349 | /// </summary> |
||
1350 | /// <param name="sender"></param> |
||
1351 | /// <param name="e"></param> |
||
1352 | public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
||
1353 | { |
||
1354 | MoveRotate(e); |
||
1355 | } |
||
1356 | |||
1357 | double LastRotateHorizontalValue = 0; |
||
1358 | double LastRotateVerticalValue = 0; |
||
1359 | 9f473fb7 | KangIngu | bool RotateFlag = false; |
1360 | |||
1361 | 992a98b4 | KangIngu | /// <summary> |
1362 | /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
||
1363 | /// </summary> |
||
1364 | /// <param name="e"></param> |
||
1365 | 787a4489 | KangIngu | public void MoveRotate(DragDeltaEventArgs e) |
1366 | { |
||
1367 | 62b6bcde | humkyung | Point CenterPoint = this.Centeroid; |
1368 | 992a98b4 | KangIngu | Point pt = Mouse.GetPosition(this); |
1369 | |||
1370 | edef7af2 | humkyung | #region X축 기준으로 회전 각도를 구한다. |
1371 | e65e8c5c | humkyung | Vector AxisX = new Vector(RotatedPoint.X - CenterPoint.X, RotatedPoint.Y - CenterPoint.Y); |
1372 | AxisX.Normalize(); |
||
1373 | Vector AxisY = new Vector(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
||
1374 | AxisY.Normalize(); |
||
1375 | double dDeltaAngle = Vector.AngleBetween(AxisX, AxisY); |
||
1376 | edef7af2 | humkyung | #endregion |
1377 | |||
1378 | e65e8c5c | humkyung | _ActualAngle += dDeltaAngle; |
1379 | if (_ActualAngle > 360) _ActualAngle -= 360; |
||
1380 | if (_ActualAngle < 0) _ActualAngle += 360; |
||
1381 | edef7af2 | humkyung | #region AxisLock이 설정되어 있는 경우 Angle을 특정 값으로 정렬한다. |
1382 | b79d6e7f | humkyung | if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift) |
1383 | edef7af2 | humkyung | { |
1384 | e65e8c5c | humkyung | double tmp = AlignedAngles.OrderBy(x => Math.Abs(_ActualAngle - x)).First(); |
1385 | dDeltaAngle = tmp - AngleValue; |
||
1386 | AngleValue = tmp; |
||
1387 | } |
||
1388 | else |
||
1389 | { |
||
1390 | AngleValue = _ActualAngle; |
||
1391 | edef7af2 | humkyung | } |
1392 | #endregion |
||
1393 | |||
1394 | /// save rotatePoint |
||
1395 | e65e8c5c | humkyung | this.RotatedPoint = pt; |
1396 | 787a4489 | KangIngu | |
1397 | Dispatcher.BeginInvoke((Action)(() => |
||
1398 | { |
||
1399 | 554aae3b | humkyung | foreach (var member in this.Members) |
1400 | 787a4489 | KangIngu | { |
1401 | 554aae3b | humkyung | member.RotateAbout(CenterPoint, dDeltaAngle); |
1402 | #region 보더 업데이트 |
||
1403 | switch (member.Drawingtype) |
||
1404 | 787a4489 | KangIngu | { |
1405 | case ControlType.TextControl: |
||
1406 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1407 | 53880c83 | ljiyeon | |
1408 | 9b7cda70 | KangIngu | DragThumb.RenderTransformOrigin = new Point(0, 0); |
1409 | 787a4489 | KangIngu | DragThumb.RenderTransform = new RotateTransform() |
1410 | { |
||
1411 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1412 | 787a4489 | KangIngu | }; |
1413 | |||
1414 | 9b7cda70 | KangIngu | AdornerBorder.RenderTransformOrigin = new Point(0, 0); |
1415 | 787a4489 | KangIngu | AdornerBorder.RenderTransform = new RotateTransform() |
1416 | { |
||
1417 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1418 | 54e35b39 | 송근호 | }; |
1419 | 6e035f10 | 송근호 | |
1420 | 62b6bcde | humkyung | (member.DrawingData as CommentUserInfo).UpdateControl(); |
1421 | 787a4489 | KangIngu | BorderUpdate(); |
1422 | break; |
||
1423 | 53880c83 | ljiyeon | |
1424 | 787a4489 | KangIngu | case ControlType.ArrowMultiLine: |
1425 | case ControlType.ArcLine: |
||
1426 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
1427 | 787a4489 | KangIngu | case ControlType.SingleLine: |
1428 | case ControlType.Triangle: |
||
1429 | case ControlType.ArrowTextControl: |
||
1430 | 554aae3b | humkyung | case ControlType.PolygonControl: |
1431 | case ControlType.Ink: |
||
1432 | 787a4489 | KangIngu | BorderUpdate(); |
1433 | break; |
||
1434 | 554aae3b | humkyung | case ControlType.Date: |
1435 | 787a4489 | KangIngu | case ControlType.RectCloud: |
1436 | case ControlType.Rectangle: |
||
1437 | case ControlType.ImgControl: |
||
1438 | case ControlType.Sign: |
||
1439 | case ControlType.Symbol: |
||
1440 | case ControlType.Stamp: |
||
1441 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1442 | 787a4489 | KangIngu | BorderUpdate(); |
1443 | break; |
||
1444 | case ControlType.PolygonCloud: |
||
1445 | 554aae3b | humkyung | ((ICloudControl)member.DrawingData).DrawingCloud(); |
1446 | 787a4489 | KangIngu | BorderUpdate(); |
1447 | break; |
||
1448 | case ControlType.Circle: |
||
1449 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1450 | 554aae3b | humkyung | ((CircleControl)member.DrawingData).SetCenterXY(); |
1451 | 787a4489 | KangIngu | BorderUpdate(); |
1452 | break; |
||
1453 | default: |
||
1454 | break; |
||
1455 | } |
||
1456 | } |
||
1457 | #endregion |
||
1458 | })); |
||
1459 | } |
||
1460 | eb2b9248 | KangIngu | |
1461 | 873011c4 | humkyung | /// <summary> |
1462 | /// 객체 회전 시작 |
||
1463 | /// </summary> |
||
1464 | /// <param name="sender"></param> |
||
1465 | /// <param name="e"></param> |
||
1466 | 787a4489 | KangIngu | private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1467 | 29010418 | ljiyeon | { |
1468 | e65e8c5c | humkyung | this.RotatedPoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1469 | eb2b9248 | KangIngu | rotateTop.Cursor = Cursors.SizeAll; |
1470 | |||
1471 | 992a98b4 | KangIngu | /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
1472 | 3b797b23 | humkyung | if ((1 == this.Members.Count) && (this.Members[0]).DrawingData.GetType().Name == "TextControl") |
1473 | 992a98b4 | KangIngu | { |
1474 | 3b797b23 | humkyung | this.AngleValue = ((this.Members[0]).DrawingData as TextControl).CommentAngle; |
1475 | 992a98b4 | KangIngu | } |
1476 | /// up to here |
||
1477 | |||
1478 | 01cbc243 | KangIngu | if (ViewerDataModel.Instance.UndoDataList == null) |
1479 | 787a4489 | KangIngu | { |
1480 | return; |
||
1481 | } |
||
1482 | |||
1483 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1484 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1485 | 34ac8db7 | humkyung | UndoCommand.Instance.Push(EventType.Operation, comments); |
1486 | 787a4489 | KangIngu | } |
1487 | 29010418 | ljiyeon | |
1488 | 787a4489 | KangIngu | private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1489 | { |
||
1490 | 902faaea | taeseongkim | rotateTop.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1491 | d128ceb2 | humkyung | |
1492 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1493 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1494 | 787a4489 | KangIngu | } |
1495 | |||
1496 | public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
1497 | { |
||
1498 | 4913851c | humkyung | AdornerMember control = this.Members.FirstOrDefault(); |
1499 | 787a4489 | KangIngu | |
1500 | 3dbace4e | taeseongkim | if ((control.DrawingData as ArrowTextControl) != null) |
1501 | 787a4489 | KangIngu | { |
1502 | if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
||
1503 | { |
||
1504 | (control.DrawingData as ArrowTextControl).isTrans = true; |
||
1505 | } |
||
1506 | } |
||
1507 | |||
1508 | } |
||
1509 | eb2b9248 | KangIngu | |
1510 | 787a4489 | KangIngu | public void TextControlChanger() |
1511 | { |
||
1512 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1513 | 787a4489 | KangIngu | { |
1514 | 4913851c | humkyung | TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl; |
1515 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1516 | AllControl.Base_TextBox.Visibility = Visibility.Visible; |
||
1517 | AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
||
1518 | fa48eb85 | taeseongkim | AllControl.Base_TextBox.IsHitTestVisible = true; |
1519 | 1305c420 | taeseongkim | AllControl.IsEditingMode = true; |
1520 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1521 | fa48eb85 | taeseongkim | |
1522 | 787a4489 | KangIngu | AllControl.SizeChanged += (sen, ea) => |
1523 | { |
||
1524 | if (AllControl.Base_TextBox != null) |
||
1525 | { |
||
1526 | RectangleGeometry Data = new RectangleGeometry |
||
1527 | { |
||
1528 | Rect = new Rect() |
||
1529 | { |
||
1530 | X = AllControl.StartPoint.X, |
||
1531 | Y = AllControl.StartPoint.Y, |
||
1532 | Width = AllControl.Base_TextBox.Width, |
||
1533 | Height = AllControl.Base_TextBox.Height, |
||
1534 | } |
||
1535 | }; |
||
1536 | |||
1537 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
1538 | Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
||
1539 | AllControl.Base_Grid.RenderTransform = new RotateTransform() |
||
1540 | { |
||
1541 | fa48eb85 | taeseongkim | Angle = AllControl.CommentAngle, |
1542 | 787a4489 | KangIngu | CenterX = middle.X, |
1543 | CenterY = middle.Y, |
||
1544 | }; |
||
1545 | } |
||
1546 | BorderUpdate(); |
||
1547 | }; |
||
1548 | } |
||
1549 | } |
||
1550 | eb2b9248 | KangIngu | |
1551 | 787a4489 | KangIngu | private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
1552 | { |
||
1553 | 4913851c | humkyung | if (e.ClickCount == 2 && this.Members.Count == 1) |
1554 | 787a4489 | KangIngu | { |
1555 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1556 | 787a4489 | KangIngu | { |
1557 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1558 | 29010418 | ljiyeon | TextControlChanger(); |
1559 | 787a4489 | KangIngu | } |
1560 | |||
1561 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
1562 | 787a4489 | KangIngu | { |
1563 | 4913851c | humkyung | ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
1564 | Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last(); |
||
1565 | 1305c420 | taeseongkim | |
1566 | 3797ff05 | djkim | //ArrowControl TextBox Thumb없애기 |
1567 | 787a4489 | KangIngu | tm.Visibility = Visibility.Collapsed; |
1568 | |||
1569 | 4913851c | humkyung | ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
1570 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1571 | |||
1572 | ((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
||
1573 | 29010418 | ljiyeon | |
1574 | 1305c420 | taeseongkim | |
1575 | 787a4489 | KangIngu | ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
1576 | |||
1577 | { |
||
1578 | tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
||
1579 | tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
||
1580 | |||
1581 | List<Point> ps = new List<Point>(); |
||
1582 | 29010418 | ljiyeon | |
1583 | 787a4489 | KangIngu | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
1584 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
||
1585 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
||
1586 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
||
1587 | |||
1588 | |||
1589 | |||
1590 | |||
1591 | var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
||
1592 | var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
||
1593 | if (AllControl.isTrans) |
||
1594 | { |
||
1595 | 4913851c | humkyung | Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X); |
1596 | Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y); |
||
1597 | 787a4489 | KangIngu | } |
1598 | else |
||
1599 | { |
||
1600 | 4913851c | humkyung | Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X); |
1601 | Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y); |
||
1602 | 787a4489 | KangIngu | } |
1603 | |||
1604 | 9b7cda70 | KangIngu | |
1605 | 787a4489 | KangIngu | BorderUpdate(); |
1606 | 9b7cda70 | KangIngu | |
1607 | 787a4489 | KangIngu | }; |
1608 | } |
||
1609 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
1610 | 787a4489 | KangIngu | { |
1611 | 4913851c | humkyung | DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
1612 | 787a4489 | KangIngu | CalendarControl instanceCal = new CalendarControl(data.Text); |
1613 | //dropData.IsOpen = true; |
||
1614 | RadWindow rc = new RadWindow(); |
||
1615 | rc.Width = 300; |
||
1616 | rc.Height = 300; |
||
1617 | rc.Header = "Change Date"; |
||
1618 | rc.Content = instanceCal; |
||
1619 | rc.BorderThickness = new Thickness(3); |
||
1620 | rc.ResizeMode = ResizeMode.NoResize; |
||
1621 | rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
||
1622 | rc.ModalBackground = new SolidColorBrush(Colors.Black); |
||
1623 | rc.ModalBackground.Opacity = 0.6; |
||
1624 | Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
||
1625 | instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
||
1626 | { |
||
1627 | data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
||
1628 | rc.Close(); |
||
1629 | }; |
||
1630 | rc.ShowDialog(); |
||
1631 | //CalendarControl.xaml |
||
1632 | } |
||
1633 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl") |
1634 | 787a4489 | KangIngu | { |
1635 | 4913851c | humkyung | ArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArcControl); |
1636 | 787a4489 | KangIngu | if (instance.isTransOn) |
1637 | { |
||
1638 | instance.isTransOn = false; |
||
1639 | } |
||
1640 | else |
||
1641 | { |
||
1642 | instance.isTransOn = true; |
||
1643 | } |
||
1644 | 661b7416 | humkyung | ///instance.SetArcPath(); |
1645 | 787a4489 | KangIngu | BorderUpdate(); |
1646 | } |
||
1647 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowArcControl") |
1648 | 40b3ce25 | ljiyeon | { |
1649 | 4913851c | humkyung | ArrowArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArrowArcControl); |
1650 | 40b3ce25 | ljiyeon | if (instance.isTransOn) |
1651 | { |
||
1652 | instance.isTransOn = false; |
||
1653 | } |
||
1654 | else |
||
1655 | { |
||
1656 | instance.isTransOn = true; |
||
1657 | } |
||
1658 | instance.SetArcPath(); |
||
1659 | BorderUpdate(); |
||
1660 | } |
||
1661 | 787a4489 | KangIngu | |
1662 | } |
||
1663 | 29010418 | ljiyeon | |
1664 | 787a4489 | KangIngu | } |
1665 | #endregion |
||
1666 | |||
1667 | private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
1668 | { |
||
1669 | b2d0f316 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl" |
1670 | || this.Members[0].DrawingData.GetType().Name == "ArrowTextControl") |
||
1671 | 787a4489 | KangIngu | { |
1672 | DragThumb.Visibility = Visibility.Collapsed; |
||
1673 | 9b7cda70 | KangIngu | } |
1674 | 787a4489 | KangIngu | } |
1675 | } |
||
1676 | } |