|
|
|
@ -14,7 +14,6 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
{ |
|
|
|
{ |
|
|
|
public partial class DrawSurface : UserControl |
|
|
|
public partial class DrawSurface : UserControl |
|
|
|
{ |
|
|
|
{ |
|
|
|
private Point dragStartedPoint; |
|
|
|
|
|
|
|
private ScaleTransform zoom = new ScaleTransform(); |
|
|
|
private ScaleTransform zoom = new ScaleTransform(); |
|
|
|
|
|
|
|
|
|
|
|
public DrawSurface() |
|
|
|
public DrawSurface() |
|
|
|
@ -22,9 +21,6 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
InitializeComponent(); |
|
|
|
InitializeComponent(); |
|
|
|
|
|
|
|
|
|
|
|
ContentControl.LayoutTransform = zoom; |
|
|
|
ContentControl.LayoutTransform = zoom; |
|
|
|
|
|
|
|
|
|
|
|
this.PreviewMouseLeftButtonDown += DrawSurface_PreviewMouseLeftButtonDown; |
|
|
|
|
|
|
|
this.PreviewMouseLeftButtonUp += DrawSurface_MouseLeftButtonUp; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void SetGraph(ParallelStacksGraph graph) |
|
|
|
public void SetGraph(ParallelStacksGraph graph) |
|
|
|
@ -47,51 +43,6 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region Pan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSurface_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (e.OriginalSource is TextBlock || e.OriginalSource is Shape || e.OriginalSource is ScrollChrome) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dragStartedPoint = e.GetPosition(drawingSurface); |
|
|
|
|
|
|
|
drawingSurface.CaptureMouse(); |
|
|
|
|
|
|
|
this.PreviewMouseMove += DrawSurface_PreviewMouseMove; |
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSurface_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
drawingSurface.ReleaseMouseCapture(); |
|
|
|
|
|
|
|
if (e.OriginalSource is Shape || e.OriginalSource is TextBlock) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.PreviewMouseMove -= DrawSurface_PreviewMouseMove; |
|
|
|
|
|
|
|
Cursor = Cursors.Arrow; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawSurface_PreviewMouseMove(object sender, MouseEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (e.OriginalSource is TextBlock || e.OriginalSource is Shape || e.OriginalSource is ScrollChrome) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!drawingSurface.IsMouseCaptured) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.LeftButton == MouseButtonState.Pressed) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Cursor = Cursors.SizeAll; |
|
|
|
|
|
|
|
var point = e.GetPosition(drawingSurface); |
|
|
|
|
|
|
|
Vector v = point - dragStartedPoint; |
|
|
|
|
|
|
|
ContentControl.Margin = new Thickness( |
|
|
|
|
|
|
|
ContentControl.Margin.Left + v.X / 80, |
|
|
|
|
|
|
|
ContentControl.Margin.Top + v.Y / 80, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Zoom
|
|
|
|
#region Zoom
|
|
|
|
|
|
|
|
|
|
|
|
void SliderControl_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) |
|
|
|
void SliderControl_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) |
|
|
|
|