개정판 8771edc4
issue #923: fixed drag textcontrol
Change-Id: I8e995963b9d4e398e21113a5680a3893071b6353
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
1017 | 1017 |
} |
1018 | 1018 |
} |
1019 | 1019 |
|
1020 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
|
1021 |
{ |
|
1022 |
/// save mouse down and current mouse point |
|
1023 |
this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
|
1024 |
this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
|
1025 |
/// up to here |
|
1026 |
|
|
1027 |
if (ViewerDataModel.Instance.UndoDataList == null) |
|
1028 |
{ |
|
1029 |
return; |
|
1030 |
} |
|
1031 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
|
1032 |
{ |
|
1033 |
return; |
|
1034 |
} |
|
1035 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
|
1036 |
{ |
|
1037 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
|
1038 |
{ |
|
1039 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
|
1040 |
{ |
|
1041 |
return; |
|
1042 |
} |
|
1043 |
} |
|
1044 |
} |
|
1045 |
|
|
1046 |
var comments = (from drawing in this.Members |
|
1047 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1048 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
|
1049 |
} |
|
1050 |
|
|
1051 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
|
1052 |
{ |
|
1053 |
DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
|
1054 |
|
|
1055 |
var comments = (from drawing in this.Members |
|
1056 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1057 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
|
1058 |
} |
|
1059 |
|
|
1020 | 1060 |
private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1021 | 1061 |
{ |
1062 |
var tmp = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
|
1063 |
var horzChange = Math.Round(tmp.X - this.CurrentMousePoint.X); |
|
1064 |
var vertChange = Math.Round(tmp.Y - this.CurrentMousePoint.Y); |
|
1022 | 1065 |
try |
1023 | 1066 |
{ |
1024 |
double dx = this.MouseDownPoint.X + e.HorizontalChange - this.CurrentMousePoint.X; |
|
1025 |
double dy = this.MouseDownPoint.Y + e.VerticalChange - this.CurrentMousePoint.Y; |
|
1026 |
|
|
1027 | 1067 |
DragThumb.Cursor = Cursors.SizeAll; |
1028 |
Thumb thumb = sender as Thumb; |
|
1029 |
this.TranslateItems(e.HorizontalChange, e.VerticalChange); |
|
1030 |
System.Diagnostics.Debug.WriteLine(String.Format("dx={0}, dy={1}", e.HorizontalChange - dx, e.VerticalChange - dy)); |
|
1068 |
this.TranslateItems(horzChange, vertChange); |
|
1031 | 1069 |
} |
1032 | 1070 |
finally |
1033 | 1071 |
{ |
1034 | 1072 |
/// update CurrentMousePoint |
1035 |
this.CurrentMousePoint.X = this.MouseDownPoint.X + e.HorizontalChange; |
|
1036 |
this.CurrentMousePoint.Y = this.MouseDownPoint.Y + e.VerticalChange; |
|
1073 |
this.CurrentMousePoint = tmp; |
|
1037 | 1074 |
} |
1038 | 1075 |
} |
1039 | 1076 |
|
... | ... | |
1050 | 1087 |
this.TranslateItem(dx, dy, item); |
1051 | 1088 |
} |
1052 | 1089 |
})); |
1053 |
///this.BorderUpdate();
|
|
1090 |
this.BorderUpdate(); |
|
1054 | 1091 |
} |
1055 | 1092 |
|
1056 | 1093 |
/// <summary> |
... | ... | |
1060 | 1097 |
/// <param name="item"></param> |
1061 | 1098 |
private void TranslateItem(double dx, double dy, AdornerMember item) |
1062 | 1099 |
{ |
1063 |
///dx = this.CurrentMousePoint.X - this.MouseDownPoint.X + dx; |
|
1064 |
///dy = this.CurrentMousePoint.Y - this.MouseDownPoint.Y + dy; |
|
1065 |
|
|
1066 |
Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), this.trRotate.Angle); |
|
1100 |
Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), 0); |
|
1067 | 1101 |
(item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1068 | 1102 |
for (int i = 0; i < item.ThumbList.Count(); i++) |
1069 | 1103 |
{ |
... | ... | |
1650 | 1684 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1651 | 1685 |
} |
1652 | 1686 |
|
1653 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
|
1654 |
{ |
|
1655 |
/// save mouse down and current mouse point |
|
1656 |
this.MouseDownPoint.X = e.HorizontalOffset; |
|
1657 |
this.MouseDownPoint.Y = e.VerticalOffset; |
|
1658 |
this.CurrentMousePoint.X = e.HorizontalOffset; |
|
1659 |
this.CurrentMousePoint.Y = e.VerticalOffset; |
|
1660 |
/// up to here |
|
1661 |
|
|
1662 |
if (ViewerDataModel.Instance.UndoDataList == null) |
|
1663 |
{ |
|
1664 |
return; |
|
1665 |
} |
|
1666 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
|
1667 |
{ |
|
1668 |
return; |
|
1669 |
} |
|
1670 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
|
1671 |
{ |
|
1672 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
|
1673 |
{ |
|
1674 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
|
1675 |
{ |
|
1676 |
return; |
|
1677 |
} |
|
1678 |
} |
|
1679 |
} |
|
1680 |
|
|
1681 |
var comments = (from drawing in this.Members |
|
1682 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1683 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
|
1684 |
} |
|
1685 |
|
|
1686 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
|
1687 |
{ |
|
1688 |
DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
|
1689 |
|
|
1690 |
var comments = (from drawing in this.Members |
|
1691 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
|
1692 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
|
1693 |
} |
|
1694 |
|
|
1695 | 1687 |
public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
1696 | 1688 |
{ |
1697 | 1689 |
AdornerMember control = this.Members.FirstOrDefault(); |
... | ... | |
1864 | 1856 |
DragThumb.Visibility = Visibility.Collapsed; |
1865 | 1857 |
} |
1866 | 1858 |
} |
1867 |
|
|
1868 | 1859 |
} |
1869 | 1860 |
} |
MarkupToPDF/Common/CommentUserInfo.cs | ||
---|---|---|
81 | 81 |
public virtual void OnTranslate(double dx, double dy) |
82 | 82 |
{ |
83 | 83 |
var path = (this as IPath); |
84 |
for(int i=0;i < path.PointSet.Count;++i) |
|
84 |
for(int i=0; i < path.PointSet.Count;++i)
|
|
85 | 85 |
{ |
86 | 86 |
path.PointSet[i] = new Point(path.PointSet[i].X + dx, path.PointSet[i].Y + dy); |
87 | 87 |
} |
내보내기 Unified diff