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