프로젝트

일반

사용자정보

개정판 8de55603

ID8de55603000eb1890ebdd481d18b6ff83f77be6e
상위 907a99b3
하위 f3ab410f

김태성이(가) 4년 이상 전에 추가함

페이지 회전시 ArrowTextControl의 textbox이동이 이상한 부분 수정

Change-Id: I179e7b7eccec90602269ef8fda74a25fd6b98595

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/DrawSet_DrawString.cs
221 221
            }
222 222
            else
223 223
            {
224
                if (bIsFixed)
224
                if (!bIsFixed)
225 225
                {
226 226
                    ptEnd = MathSet.getNearPoint(points, ptMid);
227 227
                }
KCOM/Common/MathHelper.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.Windows;
7
using System.Windows.Media;
8

  
9
namespace KCOM.Common
10
{
11
    public static class MathHelper
12
    {
13

  
14
        public static Point RotatePoint(Point p1, Point p2, double angle)
15
        {
16

  
17
            double radians = ConvertToRadians(angle);
18
            double sin = Math.Sin(radians);
19
            double cos = Math.Cos(radians);
20

  
21
            // Translate point back to origin
22
            p1.X -= p2.X;
23
            p1.Y -= p2.Y;
24

  
25
            // Rotate point
26
            double xnew = p1.X * cos - p1.Y * sin;
27
            double ynew = p1.X * sin + p1.Y * cos;
28

  
29
            // Translate point back
30
            Point newPoint = new Point((int)xnew + p2.X, (int)ynew + p2.Y);
31
            return newPoint;
32
        }
33

  
34
        public static double ConvertToRadians(double angle)
35
        {
36
            return (Math.PI / 180) * angle;
37
        }
38

  
39
        public static Rect RotateRect(Rect rect,double angle)
40
        {
41
            Rect result = rect;
42

  
43
            Point[] cornerPoints = { rect.TopLeft, rect.TopRight, rect.BottomRight, rect.BottomLeft };
44
            var m = new Matrix();
45
            //define rotation around rect center
46
            m.RotateAt(45.0, rect.X + rect.Width / 2.0, rect.Y + rect.Height / 2.0);
47

  
48
            //transform corner points
49
            m.Transform(cornerPoints);
50

  
51
            result = new Rect(cornerPoints[0], cornerPoints[2]);
52

  
53
            return result;
54
        }
55

  
56
    }
57
}
KCOM/Controls/AdornerFinal.xaml.cs
1076 1076

  
1077 1077
            double newHorizontalChange = e.HorizontalChange;
1078 1078
            double newVerticalChange = e.VerticalChange;
1079
            if((newHorizontalChange <-100 && newHorizontalChange > 100) || (newVerticalChange < -100 && newVerticalChange > 100))
1080
            {
1081
                return;
1082
            }
1083

  
1084
            if((GetPosition(thumb).X + newHorizontalChange) < 0)
1085
            {
1086
                newHorizontalChange = newHorizontalChange - (GetPosition(thumb).X + newHorizontalChange);
1087
            }
1088

  
1089
            if ((GetPosition(thumb).X + thumb.RenderSize.Width + newHorizontalChange) - ViewerDataModel.Instance.ImageViewWidth > 0)
1090
            {
1091
                newHorizontalChange = newHorizontalChange - ((GetPosition(thumb).X + thumb.RenderSize.Width + newHorizontalChange) - ViewerDataModel.Instance.ImageViewWidth);
1092
            }
1093

  
1094
            if (GetPosition(thumb).Y + newVerticalChange < 0 || (GetPosition(thumb).Y + thumb.RenderSize.Height + newVerticalChange) - ViewerDataModel.Instance.ImageViewHeight > 0)
1095
            {
1096
                newVerticalChange = 0;
1097
            }
1098 1079

  
1099 1080
            if (reSizePoint != new Point(0, 0))
1100 1081
            {
1101 1082
                //Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas);
1102 1083

  
1103
                Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
1104
                
1105
                System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}  Change Value : {newHorizontalChange},{newVerticalChange}");
1084
                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}");
1106 1087

  
1107 1088
                thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue);
1108
                
1109
                AdornerMember control = (from userThumb in this.Members
1110
                                         where userThumb.ThumbList.Contains(thumb)
1111
                                         select userThumb).FirstOrDefault();
1112 1089

  
1113
                IPath AllControl = control.DrawingData as IPath;
1090
                AdornerMember control = CurrentAdornerMember(thumb);
1114 1091

  
1115
               // System.Diagnostics.Debug.WriteLine($"2. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1092
                var commentInfo = (control.DrawingData) as CommentUserInfo;
1116 1093

  
1117
                System.Diagnostics.Debug.WriteLine($"2. GetPoint : {setPoint.X},{setPoint.Y} -  {newHorizontalChange},{newVerticalChange}");
1094
                // 페이지회전에 따른 화살표텍스트 박스의 이동 수정
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);
1118 1097

  
1119
                var commentInfo = (control.DrawingData) as CommentUserInfo;
1120
                commentInfo.OnMoveCtrlPoint(setPoint, newHorizontalChange, newVerticalChange,ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1098
                if ((setPoint.X + newpoint.X) < 0 || (setPoint.X + Math.Abs(thumbPoint.X) + newpoint.X) - ViewerDataModel.Instance.ImageViewWidth > 0)
1099
                {
1100
                    newpoint.X = 0;
1101
                }
1121 1102

  
1122
                System.Diagnostics.Debug.WriteLine($"3. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1103
                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}");
1123 1111
                control.UpdateThumb();
1124 1112

  
1125
                System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1113
                //System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1126 1114
                this.BorderUpdate();
1127 1115

  
1128
               System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1116
               //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);
1129 1133
            }
1134

  
1135
            return result;
1130 1136
        }
1131 1137

  
1132 1138
        private Point GetPosition(Thumb thumb)
......
1260 1266
                //System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1261 1267
                //System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1262 1268

  
1263
                this.TranslateItems(horzChange, vertChange);
1269
                
1264 1270

  
1265 1271
                var rect = this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel);
1272

  
1266 1273
                var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1267 1274

  
1268 1275
                var moveDirection = mainRect.Movement(rect);
......
1272 1279

  
1273 1280
                if ((horzChange < 0 && !moveDirection.Left) || (horzChange > 0 && !moveDirection.Right))
1274 1281
                {
1275
                    this.TranslateItems(horzChange * -1, 0);
1276
                    e.Handled = true;
1282
                    horzChange = 0;
1277 1283
                }
1278 1284

  
1279 1285
                if ((vertChange < 0 && !moveDirection.Up) || (vertChange > 0 && !moveDirection.Down))
1280 1286
                {
1281
                    this.TranslateItems( 0, vertChange * -1);
1282
                    e.Handled = true;
1287
                    vertChange = 0;
1283 1288
                }
1289

  
1290
                this.TranslateItems(horzChange, vertChange);
1291

  
1292

  
1284 1293
            }
1285 1294
            finally
1286 1295
            {
KCOM/KCOM.csproj
502 502
    <Compile Include="Common\ImageSourceHelper.cs" />
503 503
    <Compile Include="Common\ISplashMessage.cs" />
504 504
    <Compile Include="Common\MarkupUserInfo.cs" />
505
    <Compile Include="Common\MathHelper.cs" />
505 506
    <Compile Include="Common\MouseInputBase.cs" />
506 507
    <Compile Include="Controls\CustomWindow.cs" />
507 508
    <Compile Include="Controls\PasswordBoxUtilities.cs" />
MarkupToPDF/Controls/Text/ArrowTextControl.cs
1729 1729
        {
1730 1730
            IPath path = (this as IPath);
1731 1731

  
1732
            //System.Diagnostics.Debug.WriteLine($"OnMoveCtrlPoint : {path.PointSet[1].X},{path.PointSet[1].Y}");
1733

  
1734 1732
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
1735 1733

  
1736 1734
            //StartPoint에 표시된 Thumb는 dx,dy가 +로 더해줘야한다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)