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