markus / KCOM / Controls / AdornerFinal.xaml.cs @ a1cc6e1f
이력 | 보기 | 이력해설 | 다운로드 (73.7 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 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
732 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
733 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
734 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
735 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
736 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
737 | } |
||
738 | else if ((currentControl as IPath).PathData == null) |
||
739 | { |
||
740 | Rect rt = new Rect |
||
741 | { |
||
742 | X = (currentControl as IPath).StartPoint.X, |
||
743 | Y = (currentControl as IPath).StartPoint.Y, |
||
744 | 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), |
||
745 | 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), |
||
746 | }; |
||
747 | if (rt.Left < minX) minX = rt.Left; |
||
748 | if (rt.Top < minY) minY = rt.Top; |
||
749 | if (rt.Right > maxX) maxX = rt.Right; |
||
750 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
751 | } |
||
752 | else if ((currentControl as IPath) == null) |
||
753 | { |
||
754 | Rect rt = new Rect |
||
755 | { |
||
756 | X = (currentControl as IPath).StartPoint.X, |
||
757 | Y = (currentControl as IPath).StartPoint.Y, |
||
758 | Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
||
759 | Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
||
760 | }; |
||
761 | if (rt.Left < minX) minX = rt.Left; |
||
762 | if (rt.Top < minY) minY = rt.Top; |
||
763 | if (rt.Right > maxX) maxX = rt.Right; |
||
764 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
765 | } |
||
766 | 3b797b23 | humkyung | else if (currentControl is CircleControl CircleCtrl) |
767 | { |
||
768 | List<Point> am = CircleCtrl.PointSet; |
||
769 | e59e6c8e | 이지연 | lineSize = CircleCtrl.LineSize; |
770 | e1b36bc0 | humkyung | |
771 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
772 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
773 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
774 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
775 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
776 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
777 | 787a4489 | KangIngu | } |
778 | a7bd032b | 이지연 | else |
779 | 787a4489 | KangIngu | { |
780 | e59e6c8e | 이지연 | lineSize = ((dynamic)currentControl).LineSize; |
781 | 787a4489 | KangIngu | if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
782 | if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
||
783 | if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
||
784 | if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
||
785 | } |
||
786 | } |
||
787 | |||
788 | 19d602e0 | humkyung | if (maxX <= minX || maxY <= minY) return; |
789 | e59e6c8e | 이지연 | Rect ac = new Rect(minX , minY, maxX - minX, maxY - minY); |
790 | 787a4489 | KangIngu | bool addWidthSize = false; |
791 | bool addHeightSize = false; |
||
792 | if (ac.Width <= 10) |
||
793 | { |
||
794 | ac.Width += 10; |
||
795 | addWidthSize = true; |
||
796 | } |
||
797 | if (ac.Height <= 10) |
||
798 | { |
||
799 | ac.Height += 10; |
||
800 | addHeightSize = true; |
||
801 | } |
||
802 | BorderSize = ac; |
||
803 | e59e6c8e | 이지연 | //lineSize : Thickness 굵기에 따라서 adoner 수정 |
804 | ac.Width += lineSize; |
||
805 | ac.Height += lineSize; |
||
806 | 787a4489 | KangIngu | AdornerBorder.MinWidth = 10; |
807 | AdornerBorder.MinHeight = 10; |
||
808 | AdornerBorder.Width = ac.Width; |
||
809 | AdornerBorder.Height = ac.Height; |
||
810 | e59e6c8e | 이지연 | minX -= lineSize / 2; |
811 | minY -= lineSize / 2; |
||
812 | 787a4489 | KangIngu | Canvas.SetLeft(AdornerBorder, minX); |
813 | Canvas.SetTop(AdornerBorder, minY); |
||
814 | |||
815 | DragThumb.Width = ac.Width; |
||
816 | DragThumb.Height = ac.Height; |
||
817 | 3c4acae8 | 이지연 | rotateTop.Margin = new Thickness(rotateTop.Margin.Left, -30 - marginSize, rotateTop.Margin.Right, rotateTop.Margin.Bottom); |
818 | 787a4489 | KangIngu | DragThumb.MinWidth = 10; |
819 | DragThumb.MinHeight = 10; |
||
820 | if (addWidthSize) |
||
821 | { |
||
822 | Canvas.SetLeft(DragThumb, minX - 5); |
||
823 | } |
||
824 | else |
||
825 | { |
||
826 | Canvas.SetLeft(DragThumb, minX); |
||
827 | } |
||
828 | |||
829 | if (addHeightSize) |
||
830 | { |
||
831 | Canvas.SetTop(DragThumb, minY - 5); |
||
832 | } |
||
833 | else |
||
834 | { |
||
835 | Canvas.SetTop(DragThumb, minY); |
||
836 | } |
||
837 | } |
||
838 | 3b797b23 | humkyung | |
839 | 787a4489 | KangIngu | /// <summary> |
840 | /// UIElement 해제 |
||
841 | /// </summary> |
||
842 | b2d0f316 | humkyung | public void UnRegister() |
843 | 787a4489 | KangIngu | { |
844 | foreach (var item in this.ContainerContent.Children) |
||
845 | { |
||
846 | if (item is MarkupToPDF.Common.CommentUserInfo) |
||
847 | { |
||
848 | (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
||
849 | } |
||
850 | } |
||
851 | this.ContainerContent.Children.Clear(); |
||
852 | } |
||
853 | f513c215 | humkyung | |
854 | 787a4489 | KangIngu | /// <summary> |
855 | /// 각 포인트들을 등록합니다. |
||
856 | /// </summary> |
||
857 | /// <param name="pointset">Drawing Point</param> |
||
858 | public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
||
859 | 53880c83 | ljiyeon | { |
860 | 787a4489 | KangIngu | int count = 0; |
861 | e65e8c5c | humkyung | List<Point> pts = (member as IPath).PointSet; |
862 | 787a4489 | KangIngu | if (member.GetType().Name == "InkControl") |
863 | { |
||
864 | e65e8c5c | humkyung | pts.Clear(); |
865 | pts.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
||
866 | pts.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
||
867 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
||
868 | pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
||
869 | 787a4489 | KangIngu | } |
870 | 3b797b23 | humkyung | ControlType markT = this.Members.First(p => p.DrawingData == member).Drawingtype; |
871 | |||
872 | e65e8c5c | humkyung | for (int i = 0; i < pts.Count; i++) |
873 | 787a4489 | KangIngu | { |
874 | f513c215 | humkyung | MyThumb tm = new MyThumb |
875 | 787a4489 | KangIngu | { |
876 | Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
||
877 | }; |
||
878 | |||
879 | f1d6841f | humkyung | this.Members[this.Members.Count - 1].ThumbList.Add(tm); |
880 | 29010418 | ljiyeon | |
881 | e65e8c5c | humkyung | if ((markT == ControlType.ArcLine && pts[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && pts[i] == (member as ArrowArcControl).MiddlePoint)) |
882 | 787a4489 | KangIngu | { |
883 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
884 | } |
||
885 | if (member.GetType().Name == "ArrowTextControl" && i == 1) |
||
886 | { |
||
887 | 4913851c | humkyung | //if (this.Members.Count()<=1) |
888 | 787a4489 | KangIngu | //{ |
889 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
890 | List<Point> ps = new List<Point>(); |
||
891 | |||
892 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
893 | 787a4489 | KangIngu | { |
894 | 4913851c | humkyung | var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
895 | 787a4489 | KangIngu | |
896 | fa48eb85 | taeseongkim | switch (Math.Abs(temp.CommentAngle).ToString()) |
897 | 787a4489 | KangIngu | { |
898 | case "90": |
||
899 | { |
||
900 | ps.Clear(); |
||
901 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
902 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
903 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
||
904 | |||
905 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
906 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
907 | |||
908 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
909 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
910 | |||
911 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
912 | } |
||
913 | break; |
||
914 | case "270": |
||
915 | { |
||
916 | ps.Clear(); |
||
917 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
918 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
919 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
920 | |||
921 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
922 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
923 | |||
924 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
925 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
926 | |||
927 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
928 | } |
||
929 | break; |
||
930 | default: |
||
931 | { |
||
932 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
933 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
934 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
935 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
936 | } |
||
937 | break; |
||
938 | } |
||
939 | |||
940 | ArrowTextControl instance = (member as ArrowTextControl); |
||
941 | if (instance.isTrans) |
||
942 | { |
||
943 | //var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
944 | //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
945 | //list[count] = tempP; |
||
946 | e65e8c5c | humkyung | pts[count] = temp.MidPoint; |
947 | 787a4489 | KangIngu | } |
948 | else |
||
949 | { |
||
950 | if (temp.isFixed) |
||
951 | { |
||
952 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
953 | var testP = endP; |
||
954 | if (ps[0] == endP) //상단 |
||
955 | { |
||
956 | testP = new Point(endP.X, endP.Y - 50); |
||
957 | } |
||
958 | else if (ps[1] == endP) //하단 |
||
959 | { |
||
960 | testP = new Point(endP.X, endP.Y + 50); |
||
961 | } |
||
962 | else if (ps[2] == endP) //좌단 |
||
963 | { |
||
964 | testP = new Point(endP.X - 50, endP.Y); |
||
965 | } |
||
966 | else if (ps[3] == endP) //우단 |
||
967 | { |
||
968 | testP = new Point(endP.X + 50, endP.Y); |
||
969 | } |
||
970 | e65e8c5c | humkyung | pts[count] = testP; |
971 | 787a4489 | KangIngu | } |
972 | else |
||
973 | { |
||
974 | var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
||
975 | e65e8c5c | humkyung | pts[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
976 | 787a4489 | KangIngu | } |
977 | } |
||
978 | } |
||
979 | } |
||
980 | 39f208de | taeseongkim | |
981 | /// ArrowTextControl text box 화면 출력 |
||
982 | e65e8c5c | humkyung | if (member.GetType().Name == "ArrowTextControl" && pts[i] == pts.Last()) |
983 | 787a4489 | KangIngu | { |
984 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
||
985 | tm.Width = (member as ArrowTextControl).BoxWidth; |
||
986 | tm.Height = (member as ArrowTextControl).BoxHeight; |
||
987 | fa48eb85 | taeseongkim | var angle = (member as ArrowTextControl).PageAngle; |
988 | 787a4489 | KangIngu | if (Math.Abs(angle).ToString() == "90") |
989 | { |
||
990 | tm.RenderTransformOrigin = new Point(0, 0); |
||
991 | tm.RenderTransform = new RotateTransform { Angle = 270 }; |
||
992 | } |
||
993 | else if (Math.Abs(angle).ToString() == "270") |
||
994 | { |
||
995 | tm.RenderTransformOrigin = new Point(0, 0); |
||
996 | tm.RenderTransform = new RotateTransform { Angle = 90 }; |
||
997 | } |
||
998 | else |
||
999 | { |
||
1000 | tm.RenderTransformOrigin = new Point(0.5, 0.5); |
||
1001 | tm.RenderTransform = new RotateTransform() |
||
1002 | { |
||
1003 | fa48eb85 | taeseongkim | Angle = angle |
1004 | 787a4489 | KangIngu | }; |
1005 | } |
||
1006 | } |
||
1007 | 29010418 | ljiyeon | |
1008 | 787a4489 | KangIngu | if (member.GetType().Name == "CloudControl") |
1009 | { |
||
1010 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
1011 | 787a4489 | KangIngu | { |
1012 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1013 | } |
||
1014 | } |
||
1015 | if (member.GetType().Name == "PolygonControl") |
||
1016 | { |
||
1017 | e65e8c5c | humkyung | if (i == pts.Count() - 1) |
1018 | 787a4489 | KangIngu | { |
1019 | if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
||
1020 | { |
||
1021 | |||
1022 | } |
||
1023 | else |
||
1024 | { |
||
1025 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1026 | } |
||
1027 | } |
||
1028 | if ((member as PolygonControl).ControlType == ControlType.Ink) |
||
1029 | { |
||
1030 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1031 | } |
||
1032 | } |
||
1033 | 29010418 | ljiyeon | |
1034 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(tm); |
1035 | e65e8c5c | humkyung | Canvas.SetLeft(tm, pts[count].X); |
1036 | Canvas.SetTop(tm, pts[count].Y); |
||
1037 | if (member.GetType().Name == "ArrowTextControl" && pts[i] == (member as ArrowTextControl).MidPoint) |
||
1038 | 787a4489 | KangIngu | { |
1039 | f1d6841f | humkyung | Canvas.SetZIndex(tm, MyThumb.ZIndex); |
1040 | 3dbace4e | taeseongkim | tm.DragDelta += MidPoint_DragDelta; |
1041 | 787a4489 | KangIngu | } |
1042 | else |
||
1043 | { |
||
1044 | 3dbace4e | taeseongkim | tm.DragDelta += ResizeTm_DragDelta; |
1045 | f1d6841f | humkyung | Canvas.SetZIndex(tm, MyThumb.ZIndex); |
1046 | 787a4489 | KangIngu | } |
1047 | |||
1048 | tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
||
1049 | tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
||
1050 | 3dbace4e | taeseongkim | |
1051 | 787a4489 | KangIngu | tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
1052 | count++; |
||
1053 | } |
||
1054 | } |
||
1055 | |||
1056 | 3dbace4e | taeseongkim | private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e) |
1057 | { |
||
1058 | MyThumb thumb = sender as MyThumb; |
||
1059 | double newHorizontalChange = e.HorizontalChange; |
||
1060 | double newVerticalChange = e.VerticalChange; |
||
1061 | |||
1062 | 41c4405e | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), 0);// commentInfo.VisualPageAngle); |
1063 | 3dbace4e | taeseongkim | |
1064 | var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle); |
||
1065 | |||
1066 | System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString()); |
||
1067 | |||
1068 | AdornerMember control = CurrentAdornerMember(thumb); |
||
1069 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1070 | |||
1071 | if (commentInfo is ArrowTextControl) |
||
1072 | { |
||
1073 | Point getThumbPoint = GetPosition(thumb); |
||
1074 | |||
1075 | var arrowText = commentInfo as ArrowTextControl; |
||
1076 | |||
1077 | //var midPoint = MathSet.getMiddlePoint(arrowText.StartPoint, arrowText.EndPoint); |
||
1078 | //arrowText.MidPoint = newpoint; |
||
1079 | thumb.Translate(newpoint.X, newpoint.Y, this.AngleValue); |
||
1080 | 41c4405e | taeseongkim | |
1081 | 3dbace4e | taeseongkim | commentInfo.OnMoveCtrlPoint(getThumbPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1082 | |||
1083 | control.UpdateThumb(); |
||
1084 | |||
1085 | System.Diagnostics.Debug.WriteLine($"text {Canvas.GetLeft(arrowText.Base_TextBox)},{Canvas.GetTop(arrowText.Base_TextBox)}"); |
||
1086 | |||
1087 | System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y} Change Value : {newpoint.X},{newpoint.Y}"); |
||
1088 | } |
||
1089 | } |
||
1090 | |||
1091 | |||
1092 | ab7fe8c0 | humkyung | /// <summary> |
1093 | /// 제어점을 조정하여 크기를 수정한다. |
||
1094 | /// </summary> |
||
1095 | /// <param name="sender"></param> |
||
1096 | /// <param name="e"></param> |
||
1097 | 787a4489 | KangIngu | private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
1098 | { |
||
1099 | 7bb40d38 | taeseongkim | if (sender.GetType() != typeof(MyThumb)) return; |
1100 | |||
1101 | MyThumb thumb = sender as MyThumb; |
||
1102 | |||
1103 | d2114d3b | humkyung | if (this.Members.Count > 1) return; |
1104 | 7bb40d38 | taeseongkim | |
1105 | System.Diagnostics.Debug.WriteLine($"Value {e.HorizontalChange},{e.VerticalChange}"); |
||
1106 | |||
1107 | double newHorizontalChange = e.HorizontalChange; |
||
1108 | double newVerticalChange = e.VerticalChange; |
||
1109 | |||
1110 | fb827eb4 | humkyung | Point setPoint = GetPosition(thumb); |
1111 | 8de55603 | taeseongkim | |
1112 | fb827eb4 | humkyung | AdornerMember control = CurrentAdornerMember(thumb); |
1113 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1114 | 15bbef90 | taeseongkim | |
1115 | fb827eb4 | humkyung | double ratatePointAngle = 0; |
1116 | 233ef333 | taeseongkim | |
1117 | fb827eb4 | humkyung | if (commentInfo is ArrowTextControl textControl) |
1118 | { |
||
1119 | if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint)) |
||
1120 | 8de55603 | taeseongkim | { |
1121 | fb827eb4 | humkyung | textControl.CommentAngle = 0; |
1122 | this.AngleValue = 0; |
||
1123 | ratatePointAngle = commentInfo.VisualPageAngle; |
||
1124 | 8de55603 | taeseongkim | } |
1125 | fb827eb4 | humkyung | else |
1126 | { |
||
1127 | ///textControl.OnMoveCtrlPoint(setPoint, newHorizontalChange, newVerticalChange, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressCtrl); |
||
1128 | this.AngleValue = textControl.CommentAngle; |
||
1129 | commentInfo.CommentAngle = this.AngleValue; |
||
1130 | } |
||
1131 | } |
||
1132 | System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##"); |
||
1133 | thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue); |
||
1134 | 15bbef90 | taeseongkim | |
1135 | fb827eb4 | humkyung | // 페이지회전에 따른 화살표텍스트 박스의 이동 수정 |
1136 | 15bbef90 | taeseongkim | |
1137 | fb827eb4 | humkyung | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
1138 | commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
||
1139 | control.UpdateThumb(); |
||
1140 | this.BorderUpdate(); |
||
1141 | 8de55603 | taeseongkim | } |
1142 | |||
1143 | private AdornerMember CurrentAdornerMember(MyThumb thumb) |
||
1144 | { |
||
1145 | AdornerMember result = null; |
||
1146 | |||
1147 | try |
||
1148 | { |
||
1149 | result = (from userThumb in this.Members |
||
1150 | where userThumb.ThumbList.Contains(thumb) |
||
1151 | select userThumb).FirstOrDefault(); |
||
1152 | } |
||
1153 | catch (Exception ex) |
||
1154 | { |
||
1155 | App.FileLogger.Error(ex); |
||
1156 | 787a4489 | KangIngu | } |
1157 | 8de55603 | taeseongkim | |
1158 | return result; |
||
1159 | 787a4489 | KangIngu | } |
1160 | |||
1161 | fb827eb4 | humkyung | private static Point GetPosition(Thumb thumb) |
1162 | 15bbef90 | taeseongkim | { |
1163 | return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
||
1164 | } |
||
1165 | |||
1166 | 787a4489 | KangIngu | #endregion |
1167 | #region 이벤트 |
||
1168 | |||
1169 | void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1170 | { |
||
1171 | this.isDragging = false; |
||
1172 | DraggerThumb = null; |
||
1173 | |||
1174 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1175 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1176 | 26ec6226 | taeseongkim | ViewerDataModel.Instance.IsMarkupUpdate = true; |
1177 | 787a4489 | KangIngu | } |
1178 | |||
1179 | ec052e41 | humkyung | /// <summary> |
1180 | /// start drag |
||
1181 | /// </summary> |
||
1182 | /// <param name="sender"></param> |
||
1183 | /// <param name="e"></param> |
||
1184 | 787a4489 | KangIngu | void tm_DragStarted(object sender, DragStartedEventArgs e) |
1185 | { |
||
1186 | this.DraggerThumb = sender as Thumb; |
||
1187 | this.isDragging = true; |
||
1188 | |||
1189 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1190 | { |
||
1191 | return; |
||
1192 | } |
||
1193 | |||
1194 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1195 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1196 | 34ac8db7 | humkyung | |
1197 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1198 | 787a4489 | KangIngu | } |
1199 | |||
1200 | private void rotate_MouseMove(object sender, MouseEventArgs e) |
||
1201 | { |
||
1202 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1203 | 787a4489 | KangIngu | { |
1204 | if (LastRotateVerticalValue < e.GetPosition(this).X) |
||
1205 | IsTextAngle = true; |
||
1206 | else |
||
1207 | IsTextAngle = false; |
||
1208 | LastRotateVerticalValue = e.GetPosition(this).X; |
||
1209 | } |
||
1210 | 9f473fb7 | KangIngu | else |
1211 | 53880c83 | ljiyeon | { |
1212 | 9f473fb7 | KangIngu | if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1213 | { |
||
1214 | RotateFlag = true; |
||
1215 | } |
||
1216 | else |
||
1217 | { |
||
1218 | RotateFlag = false; |
||
1219 | } |
||
1220 | LastRotateHorizontalValue = e.GetPosition(this).X; |
||
1221 | } |
||
1222 | 787a4489 | KangIngu | } |
1223 | |||
1224 | f1d6841f | humkyung | /// <summary> |
1225 | /// 선택한 항목들 이동 시작 |
||
1226 | /// </summary> |
||
1227 | /// <param name="sender"></param> |
||
1228 | /// <param name="e"></param> |
||
1229 | 8771edc4 | humkyung | private void drag_DragStarted(object sender, DragStartedEventArgs e) |
1230 | { |
||
1231 | /// save mouse down and current mouse point |
||
1232 | this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1233 | this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1234 | /// up to here |
||
1235 | |||
1236 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1237 | { |
||
1238 | return; |
||
1239 | } |
||
1240 | |||
1241 | var comments = (from drawing in this.Members |
||
1242 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1243 | 34ac8db7 | humkyung | |
1244 | UndoCommand.Instance.Push(EventType.Operation, comments); |
||
1245 | 8771edc4 | humkyung | } |
1246 | |||
1247 | f1d6841f | humkyung | /// <summary> |
1248 | /// 선택한 항목들 이동 종료 |
||
1249 | /// </summary> |
||
1250 | /// <param name="sender"></param> |
||
1251 | /// <param name="e"></param> |
||
1252 | 8771edc4 | humkyung | private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
1253 | { |
||
1254 | 902faaea | taeseongkim | DragThumb.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1255 | 8771edc4 | humkyung | |
1256 | var comments = (from drawing in this.Members |
||
1257 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1258 | } |
||
1259 | |||
1260 | f1d6841f | humkyung | /// <summary> |
1261 | /// 선택한 항목들 이동 |
||
1262 | /// </summary> |
||
1263 | /// <param name="sender"></param> |
||
1264 | /// <param name="e"></param> |
||
1265 | 6b6e937c | taeseongkim | private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1266 | 787a4489 | KangIngu | { |
1267 | 508c3ac5 | humkyung | double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale; |
1268 | 025ebf74 | humkyung | |
1269 | f3ab410f | taeseongkim | var newMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1270 | |||
1271 | var horzChange = (newMousePoint.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale; |
||
1272 | var vertChange = (newMousePoint.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale; |
||
1273 | |||
1274 | 0d00f9c8 | humkyung | try |
1275 | { |
||
1276 | DragThumb.Cursor = Cursors.SizeAll; |
||
1277 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}"); |
1278 | System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}"); |
||
1279 | 8e5a4a6a | taeseongkim | |
1280 | |||
1281 | 39f208de | taeseongkim | var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(); |
1282 | f3ab410f | taeseongkim | |
1283 | 39f208de | taeseongkim | mainRect = MathHelper.RotateRect(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(), new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
1284 | |||
1285 | var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel); |
||
1286 | |||
1287 | var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
||
1288 | |||
1289 | var moveDirection = mainRect.Movement(rotationRect); |
||
1290 | f3ab410f | taeseongkim | |
1291 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}"); |
1292 | 8de55603 | taeseongkim | |
1293 | this.TranslateItems(horzChange, vertChange); |
||
1294 | 0d00f9c8 | humkyung | } |
1295 | finally |
||
1296 | { |
||
1297 | /// update CurrentMousePoint |
||
1298 | f3ab410f | taeseongkim | this.CurrentMousePoint = newMousePoint; |
1299 | 0d00f9c8 | humkyung | } |
1300 | 787a4489 | KangIngu | } |
1301 | eb2b9248 | KangIngu | |
1302 | 0d00f9c8 | humkyung | /// <summary> |
1303 | /// translate all members |
||
1304 | /// </summary> |
||
1305 | /// <param name="e"></param> |
||
1306 | public void TranslateItems(double dx, double dy) |
||
1307 | 787a4489 | KangIngu | { |
1308 | Dispatcher.BeginInvoke((Action)(() => |
||
1309 | { |
||
1310 | 4913851c | humkyung | foreach (var item in this.Members) |
1311 | 787a4489 | KangIngu | { |
1312 | 0d00f9c8 | humkyung | this.TranslateItem(dx, dy, item); |
1313 | 787a4489 | KangIngu | } |
1314 | c7fde400 | taeseongkim | |
1315 | this.BorderUpdate(); |
||
1316 | 787a4489 | KangIngu | })); |
1317 | } |
||
1318 | eb2b9248 | KangIngu | |
1319 | 0d00f9c8 | humkyung | /// <summary> |
1320 | /// translate a item |
||
1321 | /// </summary> |
||
1322 | /// <param name="e"></param> |
||
1323 | /// <param name="item"></param> |
||
1324 | private void TranslateItem(double dx, double dy, AdornerMember item) |
||
1325 | 787a4489 | KangIngu | { |
1326 | 554aae3b | humkyung | /// rotate point with page rotation |
1327 | var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle; |
||
1328 | Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation); |
||
1329 | /// up to here |
||
1330 | 0d00f9c8 | humkyung | (item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1331 | 105359ce | ljiyeon | |
1332 | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
||
1333 | 873011c4 | humkyung | MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), EventType.Operation, null, null); |
1334 | 105359ce | ljiyeon | |
1335 | 508c3ac5 | humkyung | item.UpdateThumb(); |
1336 | 787a4489 | KangIngu | } |
1337 | |||
1338 | private void resize_MouseMove(object sender, MouseEventArgs e) |
||
1339 | { |
||
1340 | 39f208de | taeseongkim | //reSizePoint = e.GetPosition(this); |
1341 | 787a4489 | KangIngu | } |
1342 | 0d00f9c8 | humkyung | |
1343 | 787a4489 | KangIngu | /// <summary> |
1344 | /// 회전 |
||
1345 | /// </summary> |
||
1346 | /// <param name="sender"></param> |
||
1347 | /// <param name="e"></param> |
||
1348 | public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
||
1349 | { |
||
1350 | MoveRotate(e); |
||
1351 | } |
||
1352 | |||
1353 | double LastRotateHorizontalValue = 0; |
||
1354 | double LastRotateVerticalValue = 0; |
||
1355 | 9f473fb7 | KangIngu | bool RotateFlag = false; |
1356 | |||
1357 | 992a98b4 | KangIngu | /// <summary> |
1358 | /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
||
1359 | /// </summary> |
||
1360 | /// <param name="e"></param> |
||
1361 | 787a4489 | KangIngu | public void MoveRotate(DragDeltaEventArgs e) |
1362 | { |
||
1363 | 62b6bcde | humkyung | Point CenterPoint = this.Centeroid; |
1364 | 992a98b4 | KangIngu | Point pt = Mouse.GetPosition(this); |
1365 | |||
1366 | edef7af2 | humkyung | #region X축 기준으로 회전 각도를 구한다. |
1367 | e65e8c5c | humkyung | Vector AxisX = new Vector(RotatedPoint.X - CenterPoint.X, RotatedPoint.Y - CenterPoint.Y); |
1368 | AxisX.Normalize(); |
||
1369 | Vector AxisY = new Vector(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
||
1370 | AxisY.Normalize(); |
||
1371 | double dDeltaAngle = Vector.AngleBetween(AxisX, AxisY); |
||
1372 | edef7af2 | humkyung | #endregion |
1373 | |||
1374 | e65e8c5c | humkyung | _ActualAngle += dDeltaAngle; |
1375 | if (_ActualAngle > 360) _ActualAngle -= 360; |
||
1376 | if (_ActualAngle < 0) _ActualAngle += 360; |
||
1377 | edef7af2 | humkyung | #region AxisLock이 설정되어 있는 경우 Angle을 특정 값으로 정렬한다. |
1378 | b79d6e7f | humkyung | if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift) |
1379 | edef7af2 | humkyung | { |
1380 | e65e8c5c | humkyung | double tmp = AlignedAngles.OrderBy(x => Math.Abs(_ActualAngle - x)).First(); |
1381 | dDeltaAngle = tmp - AngleValue; |
||
1382 | AngleValue = tmp; |
||
1383 | } |
||
1384 | else |
||
1385 | { |
||
1386 | AngleValue = _ActualAngle; |
||
1387 | edef7af2 | humkyung | } |
1388 | #endregion |
||
1389 | |||
1390 | /// save rotatePoint |
||
1391 | e65e8c5c | humkyung | this.RotatedPoint = pt; |
1392 | 787a4489 | KangIngu | |
1393 | Dispatcher.BeginInvoke((Action)(() => |
||
1394 | { |
||
1395 | 554aae3b | humkyung | foreach (var member in this.Members) |
1396 | 787a4489 | KangIngu | { |
1397 | 554aae3b | humkyung | member.RotateAbout(CenterPoint, dDeltaAngle); |
1398 | #region 보더 업데이트 |
||
1399 | switch (member.Drawingtype) |
||
1400 | 787a4489 | KangIngu | { |
1401 | case ControlType.TextControl: |
||
1402 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1403 | 53880c83 | ljiyeon | |
1404 | 9b7cda70 | KangIngu | DragThumb.RenderTransformOrigin = new Point(0, 0); |
1405 | 787a4489 | KangIngu | DragThumb.RenderTransform = new RotateTransform() |
1406 | { |
||
1407 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1408 | 787a4489 | KangIngu | }; |
1409 | |||
1410 | 9b7cda70 | KangIngu | AdornerBorder.RenderTransformOrigin = new Point(0, 0); |
1411 | 787a4489 | KangIngu | AdornerBorder.RenderTransform = new RotateTransform() |
1412 | { |
||
1413 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1414 | 54e35b39 | 송근호 | }; |
1415 | 6e035f10 | 송근호 | |
1416 | 62b6bcde | humkyung | (member.DrawingData as CommentUserInfo).UpdateControl(); |
1417 | 787a4489 | KangIngu | BorderUpdate(); |
1418 | break; |
||
1419 | 53880c83 | ljiyeon | |
1420 | 787a4489 | KangIngu | case ControlType.ArrowMultiLine: |
1421 | case ControlType.ArcLine: |
||
1422 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
1423 | 787a4489 | KangIngu | case ControlType.SingleLine: |
1424 | case ControlType.Triangle: |
||
1425 | case ControlType.ArrowTextControl: |
||
1426 | 554aae3b | humkyung | case ControlType.PolygonControl: |
1427 | case ControlType.Ink: |
||
1428 | 787a4489 | KangIngu | BorderUpdate(); |
1429 | break; |
||
1430 | 554aae3b | humkyung | case ControlType.Date: |
1431 | 787a4489 | KangIngu | case ControlType.RectCloud: |
1432 | case ControlType.Rectangle: |
||
1433 | case ControlType.ImgControl: |
||
1434 | case ControlType.Sign: |
||
1435 | case ControlType.Symbol: |
||
1436 | case ControlType.Stamp: |
||
1437 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1438 | 787a4489 | KangIngu | BorderUpdate(); |
1439 | break; |
||
1440 | case ControlType.PolygonCloud: |
||
1441 | 554aae3b | humkyung | ((ICloudControl)member.DrawingData).DrawingCloud(); |
1442 | 787a4489 | KangIngu | BorderUpdate(); |
1443 | break; |
||
1444 | case ControlType.Circle: |
||
1445 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1446 | 554aae3b | humkyung | ((CircleControl)member.DrawingData).SetCenterXY(); |
1447 | 787a4489 | KangIngu | BorderUpdate(); |
1448 | break; |
||
1449 | default: |
||
1450 | break; |
||
1451 | } |
||
1452 | } |
||
1453 | #endregion |
||
1454 | })); |
||
1455 | } |
||
1456 | eb2b9248 | KangIngu | |
1457 | 873011c4 | humkyung | /// <summary> |
1458 | /// 객체 회전 시작 |
||
1459 | /// </summary> |
||
1460 | /// <param name="sender"></param> |
||
1461 | /// <param name="e"></param> |
||
1462 | 787a4489 | KangIngu | private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1463 | 29010418 | ljiyeon | { |
1464 | e65e8c5c | humkyung | this.RotatedPoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1465 | eb2b9248 | KangIngu | rotateTop.Cursor = Cursors.SizeAll; |
1466 | |||
1467 | 992a98b4 | KangIngu | /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
1468 | 3b797b23 | humkyung | if ((1 == this.Members.Count) && (this.Members[0]).DrawingData.GetType().Name == "TextControl") |
1469 | 992a98b4 | KangIngu | { |
1470 | 3b797b23 | humkyung | this.AngleValue = ((this.Members[0]).DrawingData as TextControl).CommentAngle; |
1471 | 992a98b4 | KangIngu | } |
1472 | /// up to here |
||
1473 | |||
1474 | 01cbc243 | KangIngu | if (ViewerDataModel.Instance.UndoDataList == null) |
1475 | 787a4489 | KangIngu | { |
1476 | return; |
||
1477 | } |
||
1478 | |||
1479 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1480 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1481 | 34ac8db7 | humkyung | UndoCommand.Instance.Push(EventType.Operation, comments); |
1482 | 787a4489 | KangIngu | } |
1483 | 29010418 | ljiyeon | |
1484 | 787a4489 | KangIngu | private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1485 | { |
||
1486 | 902faaea | taeseongkim | rotateTop.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1487 | d128ceb2 | humkyung | |
1488 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1489 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1490 | 787a4489 | KangIngu | } |
1491 | |||
1492 | public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
1493 | { |
||
1494 | 4913851c | humkyung | AdornerMember control = this.Members.FirstOrDefault(); |
1495 | 787a4489 | KangIngu | |
1496 | 3dbace4e | taeseongkim | if ((control.DrawingData as ArrowTextControl) != null) |
1497 | 787a4489 | KangIngu | { |
1498 | if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
||
1499 | { |
||
1500 | (control.DrawingData as ArrowTextControl).isTrans = true; |
||
1501 | } |
||
1502 | } |
||
1503 | |||
1504 | } |
||
1505 | eb2b9248 | KangIngu | |
1506 | 787a4489 | KangIngu | public void TextControlChanger() |
1507 | { |
||
1508 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1509 | 787a4489 | KangIngu | { |
1510 | 4913851c | humkyung | TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl; |
1511 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1512 | AllControl.Base_TextBox.Visibility = Visibility.Visible; |
||
1513 | AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
||
1514 | fa48eb85 | taeseongkim | AllControl.Base_TextBox.IsHitTestVisible = true; |
1515 | 1305c420 | taeseongkim | AllControl.IsEditingMode = true; |
1516 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1517 | fa48eb85 | taeseongkim | |
1518 | 787a4489 | KangIngu | AllControl.SizeChanged += (sen, ea) => |
1519 | { |
||
1520 | if (AllControl.Base_TextBox != null) |
||
1521 | { |
||
1522 | RectangleGeometry Data = new RectangleGeometry |
||
1523 | { |
||
1524 | Rect = new Rect() |
||
1525 | { |
||
1526 | X = AllControl.StartPoint.X, |
||
1527 | Y = AllControl.StartPoint.Y, |
||
1528 | Width = AllControl.Base_TextBox.Width, |
||
1529 | Height = AllControl.Base_TextBox.Height, |
||
1530 | } |
||
1531 | }; |
||
1532 | |||
1533 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
1534 | Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
||
1535 | AllControl.Base_Grid.RenderTransform = new RotateTransform() |
||
1536 | { |
||
1537 | fa48eb85 | taeseongkim | Angle = AllControl.CommentAngle, |
1538 | 787a4489 | KangIngu | CenterX = middle.X, |
1539 | CenterY = middle.Y, |
||
1540 | }; |
||
1541 | } |
||
1542 | BorderUpdate(); |
||
1543 | }; |
||
1544 | } |
||
1545 | } |
||
1546 | eb2b9248 | KangIngu | |
1547 | 787a4489 | KangIngu | private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
1548 | { |
||
1549 | 4913851c | humkyung | if (e.ClickCount == 2 && this.Members.Count == 1) |
1550 | 787a4489 | KangIngu | { |
1551 | e1b36bc0 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl") |
1552 | 787a4489 | KangIngu | { |
1553 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1554 | 29010418 | ljiyeon | TextControlChanger(); |
1555 | 787a4489 | KangIngu | } |
1556 | |||
1557 | e1b36bc0 | humkyung | else if (this.Members[0].DrawingData.GetType().Name == "ArrowTextControl") |
1558 | 787a4489 | KangIngu | { |
1559 | 4913851c | humkyung | ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
1560 | Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last(); |
||
1561 | 1305c420 | taeseongkim | |
1562 | 3797ff05 | djkim | //ArrowControl TextBox Thumb없애기 |
1563 | 787a4489 | KangIngu | tm.Visibility = Visibility.Collapsed; |
1564 | |||
1565 | e1b36bc0 | humkyung | (this.Members[0].DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
1566 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1567 | |||
1568 | ((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
||
1569 | 29010418 | ljiyeon | |
1570 | 1305c420 | taeseongkim | |
1571 | 787a4489 | KangIngu | ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
1572 | |||
1573 | { |
||
1574 | tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
||
1575 | tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
||
1576 | |||
1577 | List<Point> ps = new List<Point>(); |
||
1578 | 29010418 | ljiyeon | |
1579 | 787a4489 | KangIngu | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
1580 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
||
1581 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
||
1582 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
||
1583 | |||
1584 | var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
||
1585 | var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
||
1586 | if (AllControl.isTrans) |
||
1587 | { |
||
1588 | e1b36bc0 | humkyung | Canvas.SetLeft((this.Members[0]).ThumbList[1], AllControl.MidPoint.X); |
1589 | Canvas.SetTop((this.Members[0]).ThumbList[1], AllControl.MidPoint.Y); |
||
1590 | 787a4489 | KangIngu | } |
1591 | else |
||
1592 | { |
||
1593 | e1b36bc0 | humkyung | Canvas.SetLeft((this.Members[0]).ThumbList[1], tempP.X); |
1594 | Canvas.SetTop((this.Members[0]).ThumbList[1], tempP.Y); |
||
1595 | 787a4489 | KangIngu | } |
1596 | |||
1597 | 9b7cda70 | KangIngu | |
1598 | 787a4489 | KangIngu | BorderUpdate(); |
1599 | 9b7cda70 | KangIngu | |
1600 | 787a4489 | KangIngu | }; |
1601 | } |
||
1602 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "DateControl") |
1603 | 787a4489 | KangIngu | { |
1604 | e1b36bc0 | humkyung | DateControl data = (this.Members[0]).DrawingData as DateControl; |
1605 | 787a4489 | KangIngu | CalendarControl instanceCal = new CalendarControl(data.Text); |
1606 | //dropData.IsOpen = true; |
||
1607 | RadWindow rc = new RadWindow(); |
||
1608 | rc.Width = 300; |
||
1609 | rc.Height = 300; |
||
1610 | rc.Header = "Change Date"; |
||
1611 | rc.Content = instanceCal; |
||
1612 | rc.BorderThickness = new Thickness(3); |
||
1613 | rc.ResizeMode = ResizeMode.NoResize; |
||
1614 | rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
||
1615 | rc.ModalBackground = new SolidColorBrush(Colors.Black); |
||
1616 | rc.ModalBackground.Opacity = 0.6; |
||
1617 | Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
||
1618 | instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
||
1619 | { |
||
1620 | data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
||
1621 | rc.Close(); |
||
1622 | }; |
||
1623 | rc.ShowDialog(); |
||
1624 | //CalendarControl.xaml |
||
1625 | } |
||
1626 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "ArcControl") |
1627 | 787a4489 | KangIngu | { |
1628 | e1b36bc0 | humkyung | ArcControl instance = ((this.Members[0]).DrawingData as ArcControl); |
1629 | 787a4489 | KangIngu | if (instance.isTransOn) |
1630 | { |
||
1631 | instance.isTransOn = false; |
||
1632 | } |
||
1633 | else |
||
1634 | { |
||
1635 | instance.isTransOn = true; |
||
1636 | } |
||
1637 | 661b7416 | humkyung | ///instance.SetArcPath(); |
1638 | 787a4489 | KangIngu | BorderUpdate(); |
1639 | } |
||
1640 | e1b36bc0 | humkyung | else if ((this.Members[0]).DrawingData.GetType().Name == "ArrowArcControl") |
1641 | 40b3ce25 | ljiyeon | { |
1642 | e1b36bc0 | humkyung | ArrowArcControl instance = ((this.Members[0]).DrawingData as ArrowArcControl); |
1643 | 40b3ce25 | ljiyeon | if (instance.isTransOn) |
1644 | { |
||
1645 | instance.isTransOn = false; |
||
1646 | } |
||
1647 | else |
||
1648 | { |
||
1649 | instance.isTransOn = true; |
||
1650 | } |
||
1651 | instance.SetArcPath(); |
||
1652 | BorderUpdate(); |
||
1653 | } |
||
1654 | 787a4489 | KangIngu | } |
1655 | } |
||
1656 | #endregion |
||
1657 | |||
1658 | private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
1659 | { |
||
1660 | b2d0f316 | humkyung | if (this.Members[0].DrawingData.GetType().Name == "TextControl" |
1661 | || this.Members[0].DrawingData.GetType().Name == "ArrowTextControl") |
||
1662 | 787a4489 | KangIngu | { |
1663 | DragThumb.Visibility = Visibility.Collapsed; |
||
1664 | 9b7cda70 | KangIngu | } |
1665 | 787a4489 | KangIngu | } |
1666 | } |
||
1667 | } |