Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rounding issue when placing objects, fix a crash to desktop #290

Merged
merged 1 commit into from
Sep 10, 2020
Merged
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
9 changes: 3 additions & 6 deletions AnnoDesigner/AnnoCanvas.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ private void MoveCurrentObjectsToMouse()
{
var pos = obj.Position;
pos = _viewport.OriginToViewport(new Point(pos.X + dx, pos.Y + dy));
pos = new Point(Math.Round(pos.X, MidpointRounding.AwayFromZero), Math.Round(pos.Y, MidpointRounding.AwayFromZero));
pos = new Point(Math.Floor(pos.X), Math.Floor(pos.Y));
obj.Position = pos;
}
}
Expand Down Expand Up @@ -1532,7 +1532,7 @@ private void RemoveSelectedObject(LayoutObject objectToRemove, bool includeSameO
/// <summary>
/// Used to load current color for grid lines from settings.
/// </summary>
/// <remarks>Also calls <see cref="UIElement.InvalidateVisual()"/></remarks>
/// <remarks>As this method can be called when AppSettings are updated, we make sure to not call anything that relies on the UI thread from here.</remarks>
private void LoadGridLineColor()
{
var colorFromJson = SerializationHelper.LoadFromJsonString<UserDefinedColor>(_appSettings.ColorGridLines);//explicit variable to make debugging easier
Expand All @@ -1543,19 +1543,16 @@ private void LoadGridLineColor()
guidelines.GuidelinesY.Add(halfPenWidth);
guidelines.Freeze();
_guidelineSet = guidelines;
InvalidateVisual();
}

/// <summary>
/// Used to load current color for object border lines from settings.
/// </summary>
/// <remarks>Also calls <see cref="UIElement.InvalidateVisual()"/></remarks>
/// <remarks>As this method can be called when AppSettings are updated, we make sure to not call anything that relies on the UI thread from here.</remarks>
private void LoadObjectBorderLineColor()
{
var colorFromJson = SerializationHelper.LoadFromJsonString<UserDefinedColor>(_appSettings.ColorObjectBorderLines);//explicit variable to make debugging easier
_linePen = _penCache.GetPen(_brushCache.GetSolidBrush(colorFromJson.Color), DPI_FACTOR * 1);

InvalidateVisual();
}

/// <summary>
Expand Down