markus / KCOM / Controls / AdornerFinal.xaml.cs @ a9a82876
이력 | 보기 | 이력해설 | 다운로드 (73.8 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 | f1d6841f | humkyung | public const int ZIndex = int.MaxValue; |
30 | |||
31 | f513c215 | humkyung | public MyThumb() |
32 | { |
||
33 | this.Opacity = 0.6; |
||
34 | this.MouseEnter += MyThumb_MouseEnter; |
||
35 | this.MouseLeave += MyThumb_MouseLeave; |
||
36 | } |
||
37 | |||
38 | 3dbace4e | taeseongkim | public void Translate(double dx, double dy, double angle) |
39 | { |
||
40 | var ratotePoint = MathHelper.RotatePoint(new Point(dx, dy), new Point(), angle); |
||
41 | |||
42 | Canvas.SetLeft(this, Canvas.GetLeft(this) + ratotePoint.X); |
||
43 | Canvas.SetTop(this, Canvas.GetTop(this) + ratotePoint.Y); |
||
44 | } |
||
45 | |||
46 | |||
47 | d2114d3b | humkyung | /// <summary> |
48 | f513c215 | humkyung | /// </summary> |
49 | /// <param name="sender"></param> |
||
50 | /// <param name="e"></param> |
||
51 | private void MyThumb_MouseLeave(object sender, MouseEventArgs e) |
||
52 | { |
||
53 | this.Opacity = 0.6; |
||
54 | } |
||
55 | |||
56 | /// <summary> |
||
57 | /// |
||
58 | /// </summary> |
||
59 | /// <param name="sender"></param> |
||
60 | /// <param name="e"></param> |
||
61 | private void MyThumb_MouseEnter(object sender, MouseEventArgs e) |
||
62 | { |
||
63 | this.Opacity = 1.0; |
||
64 | } |
||
65 | } |
||
66 | |||
67 | 787a4489 | KangIngu | /// <summary> |
68 | /// Interaction logic for AdornerFinal.xaml |
||
69 | /// </summary> |
||
70 | public class AdornerMember |
||
71 | { |
||
72 | public UIElement DrawingData { get; set; } |
||
73 | public ControlType Drawingtype { get; set; } |
||
74 | public double DrawingAngle { get; set; } |
||
75 | f513c215 | humkyung | public List<MyThumb> ThumbList { get; set; } |
76 | c8e9b3e4 | ljiyeon | public string Symbol_ID { get; set; } |
77 | 508c3ac5 | humkyung | |
78 | /// <summary> |
||
79 | /// update thumb |
||
80 | /// </summary> |
||
81 | public void UpdateThumb() |
||
82 | { |
||
83 | var path = this.DrawingData as IPath; |
||
84 | for (int i = 0; i < path.PointSet.Count; ++i) |
||
85 | { |
||
86 | Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X); |
||
87 | Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y); |
||
88 | } |
||
89 | |||
90 | 3b797b23 | humkyung | if (this.DrawingData is ArrowTextControl ArrowTextCtrl) |
91 | 508c3ac5 | humkyung | { |
92 | 3b797b23 | humkyung | if (!ArrowTextCtrl.isTrans) //trans가 True인경우 |
93 | 508c3ac5 | humkyung | { |
94 | List<Point> ps = new List<Point>(); |
||
95 | |||
96 | var temp = this.DrawingData as ArrowTextControl; |
||
97 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
98 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
99 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
100 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
101 | |||
102 | if (temp.isFixed) |
||
103 | { |
||
104 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
105 | var testP = endP; |
||
106 | if (ps[0] == endP) //상단 |
||
107 | { |
||
108 | testP = new Point(endP.X, endP.Y - 50); |
||
109 | } |
||
110 | else if (ps[1] == endP) //하단 |
||
111 | { |
||
112 | testP = new Point(endP.X, endP.Y + 50); |
||
113 | } |
||
114 | else if (ps[2] == endP) //좌단 |
||
115 | { |
||
116 | testP = new Point(endP.X - 50, endP.Y); |
||
117 | } |
||
118 | else if (ps[3] == endP) //우단 |
||
119 | { |
||
120 | testP = new Point(endP.X + 50, endP.Y); |
||
121 | } |
||
122 | Canvas.SetLeft(this.ThumbList[1], testP.X); |
||
123 | Canvas.SetTop(this.ThumbList[1], testP.Y); |
||
124 | } |
||
125 | else |
||
126 | { |
||
127 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
128 | var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
129 | Canvas.SetLeft(this.ThumbList[1], tempP.X); |
||
130 | Canvas.SetTop(this.ThumbList[1], tempP.Y); |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | } |
||
135 | 554aae3b | humkyung | |
136 | /// <summary> |
||
137 | /// rotate members about given position and angle |
||
138 | /// </summary> |
||
139 | /// <param name="at"></param> |
||
140 | /// <param name="angle">in degree</param> |
||
141 | public void RotateAbout(Point at, double angle) |
||
142 | { |
||
143 | for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++) |
||
144 | { |
||
145 | (this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle); |
||
146 | } |
||
147 | (this.DrawingData as CommentUserInfo).UpdateControl(); |
||
148 | |||
149 | this.UpdateThumb(); |
||
150 | } |
||
151 | 787a4489 | KangIngu | } |
152 | 4913851c | humkyung | |
153 | 787a4489 | KangIngu | public partial class AdornerFinal : UserControl |
154 | { |
||
155 | #region 공용 인스턴스 |
||
156 | 4913851c | humkyung | public List<AdornerMember> Members { get; } = new List<AdornerMember>(); |
157 | 787a4489 | KangIngu | public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
158 | b643fcca | taeseongkim | |
159 | 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 }; |
160 | |||
161 | e65e8c5c | humkyung | /// <summary> |
162 | /// 회전 시작할때의 각도 |
||
163 | /// </summary> |
||
164 | b643fcca | taeseongkim | |
165 | e65e8c5c | humkyung | private double angleValue; |
166 | b643fcca | taeseongkim | public double AngleValue { get => angleValue; |
167 | set |
||
168 | { |
||
169 | if(angleValue != value) |
||
170 | { |
||
171 | angleValue = value; |
||
172 | } |
||
173 | } |
||
174 | } |
||
175 | |||
176 | e65e8c5c | humkyung | /// <summary> |
177 | /// Axis Lock을 적용하지 않는 실제 회전 각도 |
||
178 | /// </summary> |
||
179 | private double _ActualAngle { get; set; } |
||
180 | |||
181 | 787a4489 | KangIngu | public bool IsTextAngle = false; |
182 | public Rect BorderSize { get; set; } |
||
183 | public bool TextCompensation = false; |
||
184 | public bool isDragging { get; set; } |
||
185 | public Thumb DraggerThumb { get; set; } |
||
186 | public RadDropDownButton dropData; |
||
187 | public RadCalendar dropCalendar; |
||
188 | public Thumb mainDragThumb { get; set; } |
||
189 | |||
190 | 4913851c | humkyung | private bool disposed; |
191 | |||
192 | 787a4489 | KangIngu | public Point reSizePoint { get; set; } |
193 | e65e8c5c | humkyung | private Point RotatedPoint { get; set; } /// 2018.05.09 added by humkyung |
194 | 0d00f9c8 | humkyung | private Point MouseDownPoint = new Point(); |
195 | private Point CurrentMousePoint = new Point(); |
||
196 | 787a4489 | KangIngu | #endregion |
197 | #region 생성자 |
||
198 | private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
||
199 | { |
||
200 | dropData = sender as RadDropDownButton; |
||
201 | } |
||
202 | 4913851c | humkyung | |
203 | 787a4489 | KangIngu | private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
204 | { |
||
205 | dropCalendar = sender as RadCalendar; |
||
206 | dropCalendar.SelectionChanged += (sen, ea) => |
||
207 | { |
||
208 | dropData.IsOpen = false; |
||
209 | e1b36bc0 | humkyung | if ((this.Members[0]).DrawingData.GetType().Name == "DateControl") |
210 | 787a4489 | KangIngu | { |
211 | e1b36bc0 | humkyung | DateControl data = (this.Members[0]).DrawingData as DateControl; |
212 | 787a4489 | KangIngu | data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
213 | } |
||
214 | }; |
||
215 | } |
||
216 | 4913851c | humkyung | |
217 | 787a4489 | KangIngu | public AdornerFinal() |
218 | { |
||
219 | InitializeComponent(); |
||
220 | BorderSize = new Rect(); |
||
221 | _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
||
222 | 4913851c | humkyung | } |
223 | |||
224 | 787a4489 | KangIngu | public AdornerFinal(CommentUserInfo objectData) : this() |
225 | { |
||
226 | InitializeComponent(); |
||
227 | objectData.IsHitTestVisible = false; |
||
228 | 1305c420 | taeseongkim | |
229 | b2d0f316 | humkyung | if (objectData is ArrowTextControl ArrTextCtrl) |
230 | 787a4489 | KangIngu | { |
231 | b2d0f316 | humkyung | ArrTextCtrl.Base_TextBox.Focusable = true; |
232 | 787a4489 | KangIngu | } |
233 | 1305c420 | taeseongkim | |
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 | e1b36bc0 | humkyung | public AdornerFinal(List<CommentUserInfo> comments) : this() |
250 | 787a4489 | KangIngu | { |
251 | InitializeComponent(); |
||
252 | 2a824927 | 이지연 | RemoveMultipleFromCanvas(comments); |
253 | e1b36bc0 | humkyung | foreach (var item in comments) |
254 | 787a4489 | KangIngu | { |
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 | f1d6841f | humkyung | item.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(item); |
262 | 2a824927 | 이지연 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
263 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(item); |
264 | } |
||
265 | ef7ba61f | humkyung | catch (Exception ex) |
266 | 787a4489 | KangIngu | { |
267 | ef7ba61f | humkyung | throw new InvalidOperationException(ex.Message); |
268 | 787a4489 | KangIngu | } |
269 | 1066bae3 | ljiyeon | finally |
270 | { |
||
271 | } |
||
272 | 787a4489 | KangIngu | } |
273 | ef7ba61f | humkyung | |
274 | f1d6841f | humkyung | this.SetAdornerMembers(comments); |
275 | 787a4489 | KangIngu | this.Focus(); |
276 | } |
||
277 | |||
278 | 2a824927 | 이지연 | private void RemoveMultipleFromCanvas(IEnumerable<UIElement> elements) |
279 | { |
||
280 | if (elements == null) |
||
281 | { |
||
282 | return; |
||
283 | } |
||
284 | |||
285 | try |
||
286 | { |
||
287 | var elementList = elements.ToList(); |
||
288 | |||
289 | foreach (var element in elementList) |
||
290 | { |
||
291 | var parent = VisualTreeHelper.GetParent(element); |
||
292 | 299f2c11 | 이지연 | if(parent != null && ((System.Windows.FrameworkElement)parent) != null && ((System.Windows.FrameworkElement)parent).Parent != null) |
293 | 2a824927 | 이지연 | { |
294 | if (parent is Canvas canvas) |
||
295 | { |
||
296 | canvas.Children.Remove(element); |
||
297 | } |
||
298 | } |
||
299 | } |
||
300 | } |
||
301 | catch (InvalidOperationException ex) |
||
302 | { |
||
303 | // 컬렉션 수정 중 예외 처리 |
||
304 | Console.WriteLine($"Exception removing elements: {ex.Message}"); |
||
305 | } |
||
306 | } |
||
307 | |||
308 | ef7ba61f | humkyung | ~AdornerFinal() |
309 | { |
||
310 | this.Dispose(false); |
||
311 | } |
||
312 | |||
313 | public void Dispose() |
||
314 | { |
||
315 | this.Dispose(true); |
||
316 | GC.SuppressFinalize(this); |
||
317 | } |
||
318 | |||
319 | protected virtual void Dispose(bool disposing) |
||
320 | { |
||
321 | if (this.disposed) return; |
||
322 | if (disposing) |
||
323 | { |
||
324 | foreach (var member in this.Members) |
||
325 | { |
||
326 | if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData)) |
||
327 | Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo); |
||
328 | } |
||
329 | // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다. |
||
330 | } |
||
331 | // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다. |
||
332 | this.disposed = true; |
||
333 | } |
||
334 | |||
335 | void DragThumb_Loaded(object sender, RoutedEventArgs e) |
||
336 | { |
||
337 | mainDragThumb = DragThumb; |
||
338 | } |
||
339 | |||
340 | 62b6bcde | humkyung | public Point Centeroid |
341 | { |
||
342 | get |
||
343 | { |
||
344 | List<Point> pts = new List<Point>(); |
||
345 | |||
346 | #region 센터 포인트 구하기 (그룹핑) |
||
347 | foreach (var item in this.Members) |
||
348 | { |
||
349 | if (item.DrawingData.GetType().Name == "TextControl") |
||
350 | { |
||
351 | if (AngleValue == 0) |
||
352 | { |
||
353 | fa48eb85 | taeseongkim | AngleValue = (item.DrawingData as TextControl).CommentAngle; |
354 | 62b6bcde | humkyung | } |
355 | double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
||
356 | double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
||
357 | pts.Add(new Point(X, Y)); |
||
358 | } |
||
359 | else |
||
360 | { |
||
361 | pts.AddRange((item.DrawingData as IPath).PointSet); |
||
362 | } |
||
363 | } |
||
364 | #endregion |
||
365 | |||
366 | return MathSet.FindCentroid(pts); |
||
367 | } |
||
368 | } |
||
369 | |||
370 | b643fcca | taeseongkim | #endregion |
371 | #region 메서드 |
||
372 | public Rect getAdornerSize() |
||
373 | 787a4489 | KangIngu | { |
374 | return BorderSize; |
||
375 | } |
||
376 | 902faaea | taeseongkim | |
377 | private void TextControlLostFocus(object sender,RoutedEventArgs e) |
||
378 | { |
||
379 | TextCompensation = false; |
||
380 | BorderUpdate(); |
||
381 | |||
382 | b2d0f316 | humkyung | if (sender is TextBox TextBox) |
383 | 902faaea | taeseongkim | { |
384 | f1d6841f | humkyung | if (string.IsNullOrEmpty(TextBox.Text)) //보류 |
385 | 902faaea | taeseongkim | { |
386 | this.ContainerContent.Children.Remove((sender as TextBox).Parent as MarkupToPDF.Common.CommentUserInfo); |
||
387 | this.Visibility = Visibility.Collapsed; |
||
388 | } |
||
389 | } |
||
390 | } |
||
391 | |||
392 | private void TextControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||
393 | { |
||
394 | 24c5e56c | taeseongkim | if (sender is TextControl) |
395 | 902faaea | taeseongkim | { |
396 | TextCompensation = true; |
||
397 | BorderUpdate(); |
||
398 | } |
||
399 | } |
||
400 | |||
401 | private void TextControlSelectionChanged(object sender, RoutedEventArgs e) |
||
402 | { |
||
403 | BorderUpdate(); |
||
404 | } |
||
405 | |||
406 | 787a4489 | KangIngu | /// <summary> |
407 | /// UIElement를 종류에 맞게 등록시킴 |
||
408 | /// </summary> |
||
409 | /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
||
410 | public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
||
411 | 53880c83 | ljiyeon | { |
412 | 787a4489 | KangIngu | switch (member.GetType().Name) |
413 | { |
||
414 | #region 컨트롤 조건 |
||
415 | 554aae3b | humkyung | case "LineControl": |
416 | case "PolygonControl": |
||
417 | 787a4489 | KangIngu | case "ArrowControl": |
418 | 554aae3b | humkyung | case "ArcControl": |
419 | case "ArrowArcControl": |
||
420 | case "ArrowControl_Multi": |
||
421 | case "RectangleControl": |
||
422 | case "TriControl": |
||
423 | case "CircleControl": |
||
424 | case "CloudControl": |
||
425 | case "RectCloudControl": |
||
426 | case "InkControl": |
||
427 | case "InsideWhiteControl": |
||
428 | case "OverlapWhiteControl": |
||
429 | case "ClipWhiteControl": |
||
430 | case "CoordinateControl": |
||
431 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
432 | e65e8c5c | humkyung | _ActualAngle = AngleValue = member.CommentAngle; |
433 | 787a4489 | KangIngu | break; |
434 | case "ArrowTextControl": |
||
435 | 4913851c | humkyung | this.Members.Add(new AdornerMember |
436 | 53880c83 | ljiyeon | { |
437 | DrawingData = member, |
||
438 | Drawingtype = ControlType.ArrowTextControl, |
||
439 | f513c215 | humkyung | ThumbList = new List<MyThumb>(), |
440 | e1b36bc0 | humkyung | Symbol_ID = member.SymbolID |
441 | 53880c83 | ljiyeon | }); |
442 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
443 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as ArrowTextControl).CommentAngle; |
444 | 902faaea | taeseongkim | |
445 | ((ArrowTextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
446 | 787a4489 | KangIngu | break; |
447 | 554aae3b | humkyung | case "ImgControl": |
448 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID}); |
449 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as ImgControl).CommentAngle; |
450 | 2d2252ba | ljiyeon | break; |
451 | 787a4489 | KangIngu | case "DateControl": |
452 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
453 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as DateControl).CommentAngle; |
454 | 2d2252ba | ljiyeon | break; |
455 | 787a4489 | KangIngu | case "SignControl": |
456 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
457 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SignControl).CommentAngle; |
458 | 2d2252ba | ljiyeon | break; |
459 | 787a4489 | KangIngu | case "SymControl": |
460 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
461 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SymControl).CommentAngle; |
462 | 2d2252ba | ljiyeon | break; |
463 | 787a4489 | KangIngu | case "SymControlN": |
464 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
465 | e65e8c5c | humkyung | _ActualAngle = AngleValue = (member as SymControlN).CommentAngle; |
466 | 787a4489 | KangIngu | break; |
467 | case "TextControl": |
||
468 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
469 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
470 | { |
||
471 | Rect = new Rect() |
||
472 | { |
||
473 | X = Canvas.GetLeft((member as TextControl)), |
||
474 | Y = Canvas.GetTop((member as TextControl)), |
||
475 | Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
||
476 | Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
||
477 | } |
||
478 | }; |
||
479 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
480 | Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
||
481 | |||
482 | |||
483 | DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
||
484 | DragThumb.RenderTransform = new RotateTransform() |
||
485 | { |
||
486 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
487 | 787a4489 | KangIngu | }; |
488 | |||
489 | AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
||
490 | AdornerBorder.RenderTransform = new RotateTransform() |
||
491 | { |
||
492 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
493 | 787a4489 | KangIngu | }; |
494 | 902faaea | taeseongkim | |
495 | ((TextControl)member).PropertyChanged += TextControlPropertyChanged; |
||
496 | ((TextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
497 | 787a4489 | KangIngu | break; |
498 | default: |
||
499 | break; |
||
500 | #endregion |
||
501 | } |
||
502 | 554aae3b | humkyung | |
503 | 787a4489 | KangIngu | if (member.GetType().Name == "TextControl") |
504 | { |
||
505 | TextControl content = ((TextControl)member); |
||
506 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
507 | content.EndPoint = content.StartPoint; |
||
508 | } |
||
509 | else |
||
510 | { |
||
511 | RegistryPoint(member); |
||
512 | } |
||
513 | BorderUpdate(); |
||
514 | 4913851c | humkyung | |
515 | ab7fe8c0 | humkyung | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) |
516 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); |
||
517 | 787a4489 | KangIngu | } |
518 | |||
519 | f1d6841f | humkyung | public void SetAdornerMembers(List<CommentUserInfo> members) |
520 | 787a4489 | KangIngu | { |
521 | foreach (var member in members) |
||
522 | { |
||
523 | switch (member.GetType().Name) |
||
524 | { |
||
525 | #region 컨트롤 조건 |
||
526 | 53880c83 | ljiyeon | case "LineControl": |
527 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
528 | 53880c83 | ljiyeon | break; |
529 | case "ImgControl": |
||
530 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
531 | 787a4489 | KangIngu | break; |
532 | case "ArrowControl": |
||
533 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
534 | 787a4489 | KangIngu | break; |
535 | 53880c83 | ljiyeon | case "PolygonControl": |
536 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
537 | 787a4489 | KangIngu | break; |
538 | case "ArrowTextControl": |
||
539 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
540 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
541 | break; |
||
542 | case "ArcControl": |
||
543 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
544 | 787a4489 | KangIngu | break; |
545 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
546 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
547 | 40b3ce25 | ljiyeon | break; |
548 | 787a4489 | KangIngu | case "DateControl": |
549 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
550 | 787a4489 | KangIngu | break; |
551 | case "ArrowControl_Multi": |
||
552 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
553 | 787a4489 | KangIngu | break; |
554 | case "RectangleControl": |
||
555 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
556 | 787a4489 | KangIngu | break; |
557 | case "TriControl": |
||
558 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
559 | 787a4489 | KangIngu | break; |
560 | case "CircleControl": |
||
561 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
562 | 787a4489 | KangIngu | break; |
563 | case "CloudControl": |
||
564 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
565 | 787a4489 | KangIngu | break; |
566 | case "RectCloudControl": |
||
567 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
568 | 787a4489 | KangIngu | break; |
569 | case "SignControl": |
||
570 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
571 | 787a4489 | KangIngu | break; |
572 | case "SymControl": |
||
573 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
574 | 787a4489 | KangIngu | break; |
575 | case "SymControlN": |
||
576 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
577 | 787a4489 | KangIngu | break; |
578 | 53880c83 | ljiyeon | case "InkControl": |
579 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
580 | 787a4489 | KangIngu | break; |
581 | case "TextControl": |
||
582 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
583 | 787a4489 | KangIngu | |
584 | 902faaea | taeseongkim | (member as TextControl).PropertyChanged += TextControlPropertyChanged; |
585 | (member as TextControl).Base_TextBox.SelectionChanged += TextControlSelectionChanged; |
||
586 | |||
587 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
588 | //{ |
||
589 | // BorderUpdate(); |
||
590 | //}); |
||
591 | //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
||
592 | //{ |
||
593 | // BorderUpdate(); |
||
594 | // try |
||
595 | // { |
||
596 | // ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
597 | // } |
||
598 | // catch (Exception) |
||
599 | // { |
||
600 | |||
601 | // } |
||
602 | |||
603 | //}); |
||
604 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
605 | //{ |
||
606 | // BorderUpdate(); |
||
607 | //}); |
||
608 | 787a4489 | KangIngu | break; |
609 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
610 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
611 | 684ef11c | ljiyeon | break; |
612 | case "OverlapWhiteControl": |
||
613 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
614 | 684ef11c | ljiyeon | break; |
615 | case "ClipWhiteControl": |
||
616 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
617 | 684ef11c | ljiyeon | break; |
618 | case "CoordinateControl": |
||
619 | e1b36bc0 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID }); |
620 | 684ef11c | ljiyeon | break; |
621 | 787a4489 | KangIngu | default: |
622 | break; |
||
623 | #endregion |
||
624 | } |
||
625 | if (member.GetType().Name == "TextControl") |
||
626 | { |
||
627 | TextControl content = ((TextControl)member); |
||
628 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
629 | content.EndPoint = content.StartPoint; |
||
630 | } |
||
631 | else |
||
632 | { |
||
633 | RegistryPoint(member, members.Count); |
||
634 | } |
||
635 | 4913851c | humkyung | |
636 | ab7fe8c0 | humkyung | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) |
637 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols |
||
638 | 787a4489 | KangIngu | } |
639 | |||
640 | BorderUpdate(); |
||
641 | } |
||
642 | |||
643 | 902faaea | taeseongkim | |
644 | 787a4489 | KangIngu | /// <summary> |
645 | /// Border 를 갱신 |
||
646 | /// </summary> |
||
647 | public void BorderUpdate() |
||
648 | { |
||
649 | AdornerBorder.MinWidth = 10; |
||
650 | AdornerBorder.MinHeight = 10; |
||
651 | |||
652 | 992a98b4 | KangIngu | double minX = double.MaxValue; |
653 | double minY = double.MaxValue; |
||
654 | double maxX = double.MinValue; |
||
655 | a7bd032b | 이지연 | double maxY = double.MinValue; |
656 | e59e6c8e | 이지연 | double lineSize = 0; |
657 | double marginSize = 0; |
||
658 | 4913851c | humkyung | if (this.Members.Count == 1) |
659 | 787a4489 | KangIngu | { |
660 | 3b797b23 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl") |
661 | 787a4489 | KangIngu | { |
662 | 3b797b23 | humkyung | if ((this.Members[0].DrawingData as TextControl).CommentAngle != 0) |
663 | 787a4489 | KangIngu | { |
664 | 3b797b23 | humkyung | trRotate.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle; |
665 | trRotateThumb.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle; |
||
666 | 787a4489 | KangIngu | } |
667 | else |
||
668 | { |
||
669 | trRotate.Angle = 0; |
||
670 | trRotateThumb.Angle = 0; |
||
671 | } |
||
672 | } |
||
673 | } |
||
674 | 3b797b23 | humkyung | |
675 | 4913851c | humkyung | foreach (var item in this.Members) |
676 | 787a4489 | KangIngu | { |
677 | 58dd9e89 | humkyung | UIElement currentControl = item.DrawingData; |
678 | a7bd032b | 이지연 | |
679 | b643fcca | taeseongkim | Point startP = (currentControl as IPath).StartPoint; |
680 | Point endP = (currentControl as IPath).EndPoint; |
||
681 | |||
682 | 902faaea | taeseongkim | // ViewerDataModel.Instance.Angle = MathSet.returnAngle(startP, ref endP, ViewerDataModel.Instance.IsPressShift); |
683 | |||
684 | // 컨트롤의 angle변환시 상단 anglecontrol에 출력 |
||
685 | 4f017ed3 | taeseongkim | ViewerDataModel.Instance.MarkupAngle = (currentControl as CommentUserInfo).CommentAngle; |
686 | b643fcca | taeseongkim | |
687 | 787a4489 | KangIngu | if (item.DrawingData.GetType().Name == "TextControl") |
688 | { |
||
689 | double textControlWidth; |
||
690 | double textControlHeight; |
||
691 | e59e6c8e | 이지연 | |
692 | 787a4489 | KangIngu | if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
693 | { |
||
694 | textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
||
695 | textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
||
696 | } |
||
697 | else |
||
698 | { |
||
699 | textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
||
700 | textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
||
701 | } |
||
702 | 29010418 | ljiyeon | |
703 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.X < minX) |
704 | { |
||
705 | minX = (currentControl as TextControl).EndPoint.X; |
||
706 | } |
||
707 | fa48eb85 | taeseongkim | |
708 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.Y < minY) |
709 | { |
||
710 | minY = (currentControl as TextControl).EndPoint.Y; |
||
711 | } |
||
712 | fa48eb85 | taeseongkim | |
713 | 787a4489 | KangIngu | if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
714 | { |
||
715 | maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
||
716 | } |
||
717 | fa48eb85 | taeseongkim | |
718 | 787a4489 | KangIngu | if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
719 | { |
||
720 | maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
||
721 | } |
||
722 | d3b658ee | 이지연 | if ((currentControl as TextControl).ControlType_No == 2) |
723 | 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; |
724 | if ((currentControl as TextControl).ControlType_No == 1) |
||
725 | marginSize = ((dynamic)currentControl).LineSize.Left; |
||
726 | 787a4489 | KangIngu | } |
727 | else if ((currentControl as IViewBox) != null) |
||
728 | { |
||
729 | IViewBox instance = currentControl as IViewBox; |
||
730 | List<Point> am = (currentControl as IPath).PointSet; |
||
731 | a9a82876 | taeseongkim | |
732 | if (am.Count() > 0) |
||
733 | { |
||
734 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
735 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
736 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
737 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
738 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
739 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
740 | } |
||
741 | 787a4489 | KangIngu | } |
742 | else if ((currentControl as IPath).PathData == null) |
||
743 | { |
||
744 | Rect rt = new Rect |
||
745 | { |
||
746 | X = (currentControl as IPath).StartPoint.X, |
||
747 | Y = (currentControl as IPath).StartPoint.Y, |
||
748 | 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), |
||
749 | 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), |
||
750 | }; |
||
751 | if (rt.Left < minX) minX = rt.Left; |
||
752 | if (rt.Top < minY) minY = rt.Top; |
||
753 | if (rt.Right > maxX) maxX = rt.Right; |
||
754 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
755 | } |
||
756 | else if ((currentControl as IPath) == null) |
||
757 | { |
||
758 | Rect rt = new Rect |
||
759 | { |
||
760 | X = (currentControl as IPath).StartPoint.X, |
||
761 | Y = (currentControl as IPath).StartPoint.Y, |
||
762 | Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
||
763 | Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
||
764 | }; |
||
765 | if (rt.Left < minX) minX = rt.Left; |
||
766 | if (rt.Top < minY) minY = rt.Top; |
||
767 | if (rt.Right > maxX) maxX = rt.Right; |
||
768 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
769 | } |
||
770 | 3b797b23 | humkyung | else if (currentControl is CircleControl CircleCtrl) |
771 | { |
||
772 | List<Point> am = CircleCtrl.PointSet; |
||
773 | e59e6c8e | 이지연 | lineSize = CircleCtrl.LineSize; |
774 | e1b36bc0 | humkyung | |
775 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
776 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
777 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
778 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
779 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
780 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
781 | 787a4489 | KangIngu | } |
782 | a7bd032b | 이지연 | else |
783 | 787a4489 | KangIngu | { |
784 | e59e6c8e | 이지연 | lineSize = ((dynamic)currentControl).LineSize; |
785 | 787a4489 | KangIngu | if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
786 | if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
||
787 | if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
||
788 | if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
||
789 | } |
||
790 | } |
||
791 | |||
792 | 19d602e0 | humkyung | if (maxX <= minX || maxY <= minY) return; |
793 | e59e6c8e | 이지연 | Rect ac = new Rect(minX , minY, maxX - minX, maxY - minY); |
794 | 787a4489 | KangIngu | bool addWidthSize = false; |
795 | bool addHeightSize = false; |
||
796 | if (ac.Width <= 10) |
||
797 | { |
||
798 | ac.Width += 10; |
||
799 | addWidthSize = true; |
||
800 | } |
||
801 | if (ac.Height <= 10) |
||
802 | { |
||
803 | ac.Height += 10; |
||
804 | addHeightSize = true; |
||
805 | } |
||
806 | BorderSize = ac; |
||
807 | e59e6c8e | 이지연 | //lineSize : Thickness 굵기에 따라서 adoner 수정 |
808 | ac.Width += lineSize; |
||
809 | ac.Height += lineSize; |
||
810 | 787a4489 | KangIngu | AdornerBorder.MinWidth = 10; |
811 | AdornerBorder.MinHeight = 10; |
||
812 | AdornerBorder.Width = ac.Width; |
||
813 | AdornerBorder.Height = ac.Height; |
||
814 | e59e6c8e | 이지연 | minX -= lineSize / 2; |
815 | minY -= lineSize / 2; |
||
816 | 787a4489 | KangIngu | Canvas.SetLeft(AdornerBorder, minX); |
817 | Canvas.SetTop(AdornerBorder, minY); |
||
818 | |||
819 | DragThumb.Width = ac.Width; |
||
820 | DragThumb.Height = ac.Height; |
||
821 | 3c4acae8 | 이지연 | rotateTop.Margin = new Thickness(rotateTop.Margin.Left, -30 - marginSize, rotateTop.Margin.Right, rotateTop.Margin.Bottom); |
822 | 787a4489 | KangIngu | DragThumb.MinWidth = 10; |
823 | DragThumb.MinHeight = 10; |
||
824 | if (addWidthSize) |
||
825 | { |
||
826 | Canvas.SetLeft(DragThumb, minX - 5); |
||
827 | } |
||
828 | else |
||
829 | { |
||
830 | Canvas.SetLeft(DragThumb, minX); |
||
831 | } |
||
832 | |||
833 | if (addHeightSize) |
||
834 | { |
||
835 | Canvas.SetTop(DragThumb, minY - 5); |
||
836 | } |
||
837 | else |
||
838 | { |
||
839 | Canvas.SetTop(DragThumb, minY); |
||
840 | } |
||
841 | } |
||
842 | 3b797b23 | humkyung | |
843 | 787a4489 | KangIngu | /// <summary> |
844 | /// UIElement 해제 |
||
845 | /// </summary> |
||
846 | b2d0f316 | humkyung | public void UnRegister() |
847 | 787a4489 | KangIngu | { |
848 | foreach (var item in this.ContainerContent.Children) |
||
849 | { |
||
850 | if (item is MarkupToPDF.Common.CommentUserInfo) |
||
851 | { |
||
852 | (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
||
853 | } |
||
854 | } |
||
855 | this.ContainerContent.Children.Clear(); |
||
856 | } |
||
857 | f513c215 | humkyung | |
858 | 787a4489 | KangIngu | /// <summary> |
859 | /// 각 포인트들을 등록합니다. |
||
860 | /// </summary> |
||
861 | /// <param name="pointset">Drawing Point</param> |
||
862 | public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
||
863 | 53880c83 | ljiyeon | { |
864 | 787a4489 | KangIngu | int count = 0; |
865 | e65e8c5c | humkyung | List<Point> pts = (member as IPath).PointSet; |
866 | 787a4489 | KangIngu | if (member.GetType().Name == "InkControl") |
867 | { |
||
868 | e65e8c5c | humkyung | pts.Clear(); |
869 | pts.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
||
870 | pts.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
||
871 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
||
872 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
||
873 | 787a4489 | KangIngu | } |
874 | 3b797b23 | humkyung | ControlType markT = this.Members.First(p => p.DrawingData == member).Drawingtype; |
875 | |||
876 | e65e8c5c | humkyung | for (int i = 0; i < pts.Count; i++) |
877 | 787a4489 | KangIngu | { |
878 | f513c215 | humkyung | MyThumb tm = new MyThumb |
879 | 787a4489 | KangIngu | { |
880 | Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
||
881 | }; |
||
882 | |||
883 | f1d6841f | humkyung | this.Members[this.Members.Count - 1].ThumbList.Add(tm); |
884 | 29010418 | ljiyeon | |
885 | e65e8c5c | humkyung | if ((markT == ControlType.ArcLine && pts[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && pts[i] == (member as ArrowArcControl).MiddlePoint)) |
886 | 787a4489 | KangIngu | { |
887 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
888 | } |
||
889 | if (member.GetType().Name == "ArrowTextControl" && i == 1) |
||
890 | { |
||
891 | 4913851c | humkyung | //if (this.Members.Count()<=1) |
892 | 787a4489 | KangIngu | //{ |
893 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
894 | List<Point> ps = new List<Point>(); |
||
895 | |||
896 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
897 | 787a4489 | KangIngu | { |
898 | 4913851c | humkyung | var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
899 | 787a4489 | KangIngu | |
900 | fa48eb85 | taeseongkim | switch (Math.Abs(temp.CommentAngle).ToString()) |
901 | 787a4489 | KangIngu | { |
902 | case "90": |
||
903 | { |
||
904 | ps.Clear(); |
||
905 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
906 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
907 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), 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))); //왼쪽 중간 |
||
910 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
911 | |||
912 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
913 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
914 | |||
915 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
916 | } |
||
917 | break; |
||
918 | case "270": |
||
919 | { |
||
920 | ps.Clear(); |
||
921 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
922 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
923 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
924 | |||
925 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
926 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
927 | |||
928 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
929 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
930 | |||
931 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
932 | } |
||
933 | break; |
||
934 | default: |
||
935 | { |
||
936 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
937 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
938 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
939 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
940 | } |
||
941 | break; |
||
942 | } |
||
943 | |||
944 | ArrowTextControl instance = (member as ArrowTextControl); |
||
945 | if (instance.isTrans) |
||
946 | { |
||
947 | //var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
948 | //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
949 | //list[count] = tempP; |
||
950 | e65e8c5c | humkyung | pts[count] = temp.MidPoint; |
951 | 787a4489 | KangIngu | } |
952 | else |
||
953 | { |
||
954 | if (temp.isFixed) |
||
955 | { |
||
956 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
957 | var testP = endP; |
||
958 | if (ps[0] == endP) //상단 |
||
959 | { |
||
960 | testP = new Point(endP.X, endP.Y - 50); |
||
961 | } |
||
962 | else if (ps[1] == endP) //하단 |
||
963 | { |
||
964 | testP = new Point(endP.X, endP.Y + 50); |
||
965 | } |
||
966 | else if (ps[2] == endP) //좌단 |
||
967 | { |
||
968 | testP = new Point(endP.X - 50, endP.Y); |
||
969 | } |
||
970 | else if (ps[3] == endP) //우단 |
||
971 | { |
||
972 | testP = new Point(endP.X + 50, endP.Y); |
||
973 | } |
||
974 | e65e8c5c | humkyung | pts[count] = testP; |
975 | 787a4489 | KangIngu | } |
976 | else |
||
977 | { |
||
978 | var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
||
979 | e65e8c5c | humkyung | pts[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
980 | 787a4489 | KangIngu | } |
981 | } |
||
982 | } |
||
983 | } |
||
984 | 39f208de | taeseongkim | |
985 | /// ArrowTextControl text box 화면 출력 |
||
986 | e65e8c5c | humkyung | if (member.GetType().Name == "ArrowTextControl" && pts[i] == pts.Last()) |
987 | 787a4489 | KangIngu | { |
988 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
||
989 | tm.Width = (member as ArrowTextControl).BoxWidth; |
||
990 | tm.Height = (member as ArrowTextControl).BoxHeight; |
||
991 | fa48eb85 | taeseongkim | var angle = (member as ArrowTextControl).PageAngle; |
992 | 787a4489 | KangIngu | if (Math.Abs(angle).ToString() == "90") |
993 | { |
||
994 | tm.RenderTransformOrigin = new Point(0, 0); |
||
995 | tm.RenderTransform = new RotateTransform { Angle = 270 }; |
||
996 | } |
||
997 | else if (Math.Abs(angle).ToString() == "270") |
||
998 | { |
||
999 | tm.RenderTransformOrigin = new Point(0, 0); |
||
1000 | tm.RenderTransform = new RotateTransform { Angle = 90 }; |
||
1001 | } |
||
1002 | else |
||
1003 | { |
||
1004 | tm.RenderTransformOrigin = new Point(0.5, 0.5); |
||
1005 | tm.RenderTransform = new RotateTransform() |
||
1006 | { |
||
1007 | fa48eb85 | taeseongkim | Angle = angle |
1008 | 787a4489 | KangIngu | }; |
1009 | } |
||
1010 | } |
||
1011 | 29010418 | ljiyeon | |
1012 | 787a4489 | KangIngu | if (member.GetType().Name == "CloudControl") |
1013 | { |
||
1014 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
1015 | 787a4489 | KangIngu | { |
1016 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1017 | } |
||
1018 | } |
||
1019 | if (member.GetType().Name == "PolygonControl") |
||
1020 | { |
||
1021 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
1022 | 787a4489 | KangIngu | { |
1023 | if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
||
1024 | { |
||
1025 | |||
1026 | } |
||
1027 | else |
||
1028 | { |
||
1029 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1030 | } |
||
1031 | } |
||
1032 | if ((member as PolygonControl).ControlType == ControlType.Ink) |
||
1033 | { |
||
1034 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1035 | } |
||
1036 | } |
||
1037 | 29010418 | ljiyeon | |
1038 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(tm); |
1039 | e65e8c5c | humkyung | Canvas.SetLeft(tm, pts[count].X); |
1040 | Canvas.SetTop(tm, pts[count].Y); |
||
1041 | if (member.GetType().Name == "ArrowTextControl" && pts[i] == (member as ArrowTextControl).MidPoint) |
||
1042 | 787a4489 | KangIngu | { |
1043 | f1d6841f | humkyung | Canvas.SetZIndex(tm, MyThumb.ZIndex); |
1044 | 3dbace4e | taeseongkim | tm.DragDelta += MidPoint_DragDelta; |
1045 | 787a4489 | KangIngu | } |
1046 | else |
||
1047 | { |
||
1048 | 3dbace4e | taeseongkim | tm.DragDelta += ResizeTm_DragDelta; |
1049 | f1d6841f | humkyung | Canvas.SetZIndex(tm, MyThumb.ZIndex); |
1050 | 787a4489 | KangIngu | } |
1051 | |||
1052 | tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
||
1053 | tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
||
1054 | 3dbace4e | taeseongkim | |
1055 | 787a4489 | KangIngu | tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
1056 | count++; |
||
1057 | } |
||
1058 | } |
||
1059 | |||
1060 | 3dbace4e | taeseongkim | private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e) |
1061 | { |
||
1062 | MyThumb thumb = sender as MyThumb; |
||
1063 | double newHorizontalChange = e.HorizontalChange; |
||
1064 | double newVerticalChange = e.VerticalChange; |
||
1065 | |||
1066 | 41c4405e | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), 0);// commentInfo.VisualPageAngle); |
1067 | 3dbace4e | taeseongkim | |
1068 | var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle); |
||
1069 | |||
1070 | System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString()); |
||
1071 | |||
1072 | AdornerMember control = CurrentAdornerMember(thumb); |
||
1073 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1074 | |||
1075 | if (commentInfo is ArrowTextControl) |
||
1076 | { |
||
1077 | Point getThumbPoint = GetPosition(thumb); |
||
1078 | |||
1079 | var arrowText = commentInfo as ArrowTextControl; |
||
1080 | |||
1081 | //var midPoint = MathSet.getMiddlePoint(arrowText.StartPoint, arrowText.EndPoint); |
||
1082 | //arrowText.MidPoint = newpoint; |
||
1083 | thumb.Translate(newpoint.X, newpoint.Y, this.AngleValue); |
||
1084 | 41c4405e | taeseongkim | |
1085 | 3dbace4e | taeseongkim | commentInfo.OnMoveCtrlPoint(getThumbPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1086 | |||
1087 | control.UpdateThumb(); |
||
1088 | |||
1089 | System.Diagnostics.Debug.WriteLine($"text {Canvas.GetLeft(arrowText.Base_TextBox)},{Canvas.GetTop(arrowText.Base_TextBox)}"); |
||
1090 | |||
1091 | System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y} Change Value : {newpoint.X},{newpoint.Y}"); |
||
1092 | } |
||
1093 | } |
||
1094 | |||
1095 | |||
1096 | ab7fe8c0 | humkyung | /// <summary> |
1097 | /// 제어점을 조정하여 크기를 수정한다. |
||
1098 | /// </summary> |
||
1099 | /// <param name="sender"></param> |
||
1100 | /// <param name="e"></param> |
||
1101 | 787a4489 | KangIngu | private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
1102 | { |
||
1103 | 7bb40d38 | taeseongkim | if (sender.GetType() != typeof(MyThumb)) return; |
1104 | |||
1105 | MyThumb thumb = sender as MyThumb; |
||
1106 | |||
1107 | d2114d3b | humkyung | if (this.Members.Count > 1) return; |
1108 | 7bb40d38 | taeseongkim | |
1109 | System.Diagnostics.Debug.WriteLine($"Value {e.HorizontalChange},{e.VerticalChange}"); |
||
1110 | |||
1111 | double newHorizontalChange = e.HorizontalChange; |
||
1112 | double newVerticalChange = e.VerticalChange; |
||
1113 | |||
1114 | fb827eb4 | humkyung | Point setPoint = GetPosition(thumb); |
1115 | 8de55603 | taeseongkim | |
1116 | fb827eb4 | humkyung | AdornerMember control = CurrentAdornerMember(thumb); |
1117 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1118 | 15bbef90 | taeseongkim | |
1119 | fb827eb4 | humkyung | double ratatePointAngle = 0; |
1120 | 233ef333 | taeseongkim | |
1121 | fb827eb4 | humkyung | if (commentInfo is ArrowTextControl textControl) |
1122 | { |
||
1123 | if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint)) |
||
1124 | 8de55603 | taeseongkim | { |
1125 | fb827eb4 | humkyung | textControl.CommentAngle = 0; |
1126 | this.AngleValue = 0; |
||
1127 | ratatePointAngle = commentInfo.VisualPageAngle; |
||
1128 | 8de55603 | taeseongkim | } |
1129 | fb827eb4 | humkyung | else |
1130 | { |
||
1131 | ///textControl.OnMoveCtrlPoint(setPoint, newHorizontalChange, newVerticalChange, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressCtrl); |
||
1132 | this.AngleValue = textControl.CommentAngle; |
||
1133 | commentInfo.CommentAngle = this.AngleValue; |
||
1134 | } |
||
1135 | } |
||
1136 | System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##"); |
||
1137 | thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue); |
||
1138 | 15bbef90 | taeseongkim | |
1139 | fb827eb4 | humkyung | // 페이지회전에 따른 화살표텍스트 박스의 이동 수정 |
1140 | 15bbef90 | taeseongkim | |
1141 | fb827eb4 | humkyung | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
1142 | commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
||
1143 | control.UpdateThumb(); |
||
1144 | this.BorderUpdate(); |
||
1145 | 8de55603 | taeseongkim | } |
1146 | |||
1147 | private AdornerMember CurrentAdornerMember(MyThumb thumb) |
||
1148 | { |
||
1149 | AdornerMember result = null; |
||
1150 | |||
1151 | try |
||
1152 | { |
||
1153 | result = (from userThumb in this.Members |
||
1154 | where userThumb.ThumbList.Contains(thumb) |
||
1155 | select userThumb).FirstOrDefault(); |
||
1156 | } |
||
1157 | catch (Exception ex) |
||
1158 | { |
||
1159 | App.FileLogger.Error(ex); |
||
1160 | 787a4489 | KangIngu | } |
1161 | 8de55603 | taeseongkim | |
1162 | return result; |
||
1163 | 787a4489 | KangIngu | } |
1164 | |||
1165 | fb827eb4 | humkyung | private static Point GetPosition(Thumb thumb) |
1166 | 15bbef90 | taeseongkim | { |
1167 | return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
||
1168 | } |
||
1169 | |||
1170 | 787a4489 | KangIngu | #endregion |
1171 | #region 이벤트 |
||
1172 | |||
1173 | void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1174 | { |
||
1175 | this.isDragging = false; |
||
1176 | DraggerThumb = null; |
||
1177 | |||
1178 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1179 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1180 | 26ec6226 | taeseongkim | ViewerDataModel.Instance.IsMarkupUpdate = true; |
1181 | 787a4489 | KangIngu | } |
1182 | |||
1183 | ec052e41 | humkyung | /// <summary> |
1184 | /// start drag |
||
1185 | /// </summary> |
||
1186 | /// <param name="sender"></param> |
||
1187 | /// <param name="e"></param> |
||
1188 | 787a4489 | KangIngu | void tm_DragStarted(object sender, DragStartedEventArgs e) |
1189 | { |
||
1190 | this.DraggerThumb = sender as Thumb; |
||
1191 | this.isDragging = true; |
||
1192 | |||
1193 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1194 | { |
||
1195 | return; |
||
1196 | } |
||
1197 | |||
1198 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1199 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1200 | 34ac8db7 | humkyung | |
1201 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1202 | 787a4489 | KangIngu | } |
1203 | |||
1204 | private void rotate_MouseMove(object sender, MouseEventArgs e) |
||
1205 | { |
||
1206 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1207 | 787a4489 | KangIngu | { |
1208 | if (LastRotateVerticalValue < e.GetPosition(this).X) |
||
1209 | IsTextAngle = true; |
||
1210 | else |
||
1211 | IsTextAngle = false; |
||
1212 | LastRotateVerticalValue = e.GetPosition(this).X; |
||
1213 | } |
||
1214 | 9f473fb7 | KangIngu | else |
1215 | 53880c83 | ljiyeon | { |
1216 | 9f473fb7 | KangIngu | if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1217 | { |
||
1218 | RotateFlag = true; |
||
1219 | } |
||
1220 | else |
||
1221 | { |
||
1222 | RotateFlag = false; |
||
1223 | } |
||
1224 | LastRotateHorizontalValue = e.GetPosition(this).X; |
||
1225 | } |
||
1226 | 787a4489 | KangIngu | } |
1227 | |||
1228 | f1d6841f | humkyung | /// <summary> |
1229 | /// 선택한 항목들 이동 시작 |
||
1230 | /// </summary> |
||
1231 | /// <param name="sender"></param> |
||
1232 | /// <param name="e"></param> |
||
1233 | 8771edc4 | humkyung | private void drag_DragStarted(object sender, DragStartedEventArgs e) |
1234 | { |
||
1235 | /// save mouse down and current mouse point |
||
1236 | this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1237 | this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1238 | /// up to here |
||
1239 | |||
1240 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1241 | { |
||
1242 | return; |
||
1243 | } |
||
1244 | |||
1245 | var comments = (from drawing in this.Members |
||
1246 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1247 | 34ac8db7 | humkyung | |
1248 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1249 | 8771edc4 | humkyung | } |
1250 | |||
1251 | f1d6841f | humkyung | /// <summary> |
1252 | /// 선택한 항목들 이동 종료 |
||
1253 | /// </summary> |
||
1254 | /// <param name="sender"></param> |
||
1255 | /// <param name="e"></param> |
||
1256 | 8771edc4 | humkyung | private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
1257 | { |
||
1258 | 902faaea | taeseongkim | DragThumb.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1259 | 8771edc4 | humkyung | |
1260 | var comments = (from drawing in this.Members |
||
1261 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1262 | } |
||
1263 | |||
1264 | f1d6841f | humkyung | /// <summary> |
1265 | /// 선택한 항목들 이동 |
||
1266 | /// </summary> |
||
1267 | /// <param name="sender"></param> |
||
1268 | /// <param name="e"></param> |
||
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 | e1b36bc0 | humkyung | if (this.Members[0].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 | e1b36bc0 | humkyung | else if (this.Members[0].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 | e1b36bc0 | humkyung | (this.Members[0].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 | var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
||
1589 | var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
||
1590 | if (AllControl.isTrans) |
||
1591 | { |
||
1592 | e1b36bc0 | humkyung | Canvas.SetLeft((this.Members[0]).ThumbList[1], AllControl.MidPoint.X); |
1593 | Canvas.SetTop((this.Members[0]).ThumbList[1], AllControl.MidPoint.Y); |
||
1594 | 787a4489 | KangIngu | } |
1595 | else |
||
1596 | { |
||
1597 | e1b36bc0 | humkyung | Canvas.SetLeft((this.Members[0]).ThumbList[1], tempP.X); |
1598 | Canvas.SetTop((this.Members[0]).ThumbList[1], tempP.Y); |
||
1599 | 787a4489 | KangIngu | } |
1600 | |||
1601 | 9b7cda70 | KangIngu | |
1602 | 787a4489 | KangIngu | BorderUpdate(); |
1603 | 9b7cda70 | KangIngu | |
1604 | 787a4489 | KangIngu | }; |
1605 | } |
||
1606 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "DateControl") |
1607 | 787a4489 | KangIngu | { |
1608 | e1b36bc0 | humkyung | DateControl data = (this.Members[0]).DrawingData as DateControl; |
1609 | 787a4489 | KangIngu | CalendarControl instanceCal = new CalendarControl(data.Text); |
1610 | //dropData.IsOpen = true; |
||
1611 | RadWindow rc = new RadWindow(); |
||
1612 | rc.Width = 300; |
||
1613 | rc.Height = 300; |
||
1614 | rc.Header = "Change Date"; |
||
1615 | rc.Content = instanceCal; |
||
1616 | rc.BorderThickness = new Thickness(3); |
||
1617 | rc.ResizeMode = ResizeMode.NoResize; |
||
1618 | rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
||
1619 | rc.ModalBackground = new SolidColorBrush(Colors.Black); |
||
1620 | rc.ModalBackground.Opacity = 0.6; |
||
1621 | Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
||
1622 | instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
||
1623 | { |
||
1624 | data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
||
1625 | rc.Close(); |
||
1626 | }; |
||
1627 | rc.ShowDialog(); |
||
1628 | //CalendarControl.xaml |
||
1629 | } |
||
1630 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "ArcControl") |
1631 | 787a4489 | KangIngu | { |
1632 | e1b36bc0 | humkyung | ArcControl instance = ((this.Members[0]).DrawingData as ArcControl); |
1633 | 787a4489 | KangIngu | if (instance.isTransOn) |
1634 | { |
||
1635 | instance.isTransOn = false; |
||
1636 | } |
||
1637 | else |
||
1638 | { |
||
1639 | instance.isTransOn = true; |
||
1640 | } |
||
1641 | 661b7416 | humkyung | ///instance.SetArcPath(); |
1642 | 787a4489 | KangIngu | BorderUpdate(); |
1643 | } |
||
1644 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "ArrowArcControl") |
1645 | 40b3ce25 | ljiyeon | { |
1646 | e1b36bc0 | humkyung | ArrowArcControl instance = ((this.Members[0]).DrawingData as ArrowArcControl); |
1647 | 40b3ce25 | ljiyeon | if (instance.isTransOn) |
1648 | { |
||
1649 | instance.isTransOn = false; |
||
1650 | } |
||
1651 | else |
||
1652 | { |
||
1653 | instance.isTransOn = true; |
||
1654 | } |
||
1655 | instance.SetArcPath(); |
||
1656 | BorderUpdate(); |
||
1657 | } |
||
1658 | 787a4489 | KangIngu | } |
1659 | } |
||
1660 | #endregion |
||
1661 | |||
1662 | private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
1663 | { |
||
1664 | b2d0f316 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl" |
1665 | || this.Members[0].DrawingData.GetType().Name == "ArrowTextControl") |
||
1666 | 787a4489 | KangIngu | { |
1667 | DragThumb.Visibility = Visibility.Collapsed; |
||
1668 | 9b7cda70 | KangIngu | } |
1669 | 787a4489 | KangIngu | } |
1670 | } |
||
1671 | } |