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