Skip to content

Commit

Permalink
Merge pull request #17
Browse files Browse the repository at this point in the history
* fix(map-view-item): remove the check for an empty point, as it interf…

* fix(map-view-item): fix the polygon disappearing at vertical and hori…
  • Loading branch information
asv-soft-u03 authored Aug 5, 2024
1 parent 3233b2b commit 9ec0893
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Asv.Avalonia.Map/MapViewItem.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
</Design.PreviewWith>
<Style Selector="controls|MapViewItem">
<!-- Set Defaults -->
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="Template">
<ControlTemplate>
<Grid>
<ContentControl Content="{TemplateBinding Shape}" />
<ContentControl ClipToBounds="False"
Content="{TemplateBinding Shape}" />
<ContentPresenter Name="PART_ContentPresenter"
IsVisible="{TemplateBinding IsShapeNotAvailable}"
Background="{TemplateBinding Background}"
Expand Down
5 changes: 0 additions & 5 deletions src/Asv.Avalonia.Map/MapViewItem.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,10 @@ public void UpdateLocalPosition()
_firstCall = false;
UpdatePathCollection();
}

var newHash = 0;
var localPath = new List<GPoint>(pathPoints.Length);
var minX = long.MaxValue;
var minY = long.MaxValue;
var lastPointAdded = GPoint.Empty;
foreach (var p in pathPoints)
{
var itemPoint = _map.FromLatLngToLocal(p);
Expand All @@ -329,10 +327,7 @@ public void UpdateLocalPosition()
{
minY = itemPoint.Y;
}
// this is for optimization (if last two points are the same - no need to draw it)
if (lastPointAdded == itemPoint) continue;
localPath.Add(itemPoint);
lastPointAdded = itemPoint;
newHash = HashCode.Combine(newHash, itemPoint);
}
newHash = HashCode.Combine(newHash, Opacity);
Expand Down

0 comments on commit 9ec0893

Please sign in to comment.