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