Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/StructuredLogViewer/Controls/TracingControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Grid x:Name="grid"
Background="Transparent"
MouseLeftButtonDown="Grid_MouseLeftButtonDown"
MouseLeftButtonUp="Grid_MouseLeftButtonUp"
MouseMove="Grid_MouseMove" />
</Grid>
</ScrollViewer>
Expand Down
38 changes: 26 additions & 12 deletions src/StructuredLogViewer/Controls/TracingControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ block.Node is Project ||
private FastCanvas HeatGraph;

/// <summary>
/// Draw Graph
/// Draw Graph
/// </summary>
private void Draw()
{
Expand Down Expand Up @@ -1172,8 +1172,8 @@ private void ScrollToElement(TextField hit)
scrollViewer.ScrollToVerticalOffset(verticalOffset);
}

private bool isMouseMoving;
private Point lastMousePos;
private bool isMouseMoving = false;
private Point lastMousePos = PointZero;

#region XAML Events
private void ResetZoom_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -1212,35 +1212,49 @@ private void Canvas_MouseUp(object sender, MouseButtonEventArgs e)

private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
lastMousePos = Mouse.GetPosition(this);
lastMousePos = e.GetPosition(this);
e.Handled = true;
}

private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
lastMousePos = PointZero;
isMouseMoving = false;
e.Handled = true;
}

private void Grid_MouseMove(object sender, MouseEventArgs e)
{
var currentMousePos = e.GetPosition(this);

// Handle the case where mouse up isn't sent when released outside of client space.
if (e.LeftButton == MouseButtonState.Released)
{
// Handle the case where mouse up isn't sent when released outside of client space.
if (isMouseMoving)
{
isMouseMoving = false;
lastMousePos = PointZero;
}
else
{
UpdateToolTips(currentMousePos);
}

e.Handled = true;
return;
}

var vector = Point.Subtract(lastMousePos, currentMousePos);
if (isMouseMoving || vector.Length > 5)
else if (e.LeftButton == MouseButtonState.Pressed && lastMousePos != PointZero)
{
isMouseMoving = true;
scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + vector.X);
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + vector.Y);
lastMousePos = currentMousePos;
var vector = Point.Subtract(lastMousePos, currentMousePos);
if (isMouseMoving || vector.Length > 5)
{
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + vector.Y);
scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + vector.X);
isMouseMoving = true;
lastMousePos = currentMousePos;
}
e.Handled = true;
return;
}
}

Expand Down