Skip to content

Commit

Permalink
Selection tweaks, now initializing two fields that were always null, …
Browse files Browse the repository at this point in the history
…and upgraded to Avalonia 0.10
  • Loading branch information
Andrew Vardeman committed Jan 23, 2021
1 parent 5aeec83 commit ce7ad66
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/TopoPad.Core/HitTest/ItemsHitTestSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ namespace TopoPad.Core.HitTest
{
public class ItemsHitTestSpec
{
private Lazy<HashSet<IItemsLayer>> m_Layers;
private Lazy<HashSet<IItemsLayer>> m_Layers = new Lazy<HashSet<IItemsLayer>>();
public HashSet<IItemsLayer> Layers => m_Layers.Value;

public bool LimitLayers { get; set; }

private Lazy<HashSet<ISpatialItem>> m_SpatialItems;
private Lazy<HashSet<ISpatialItem>> m_SpatialItems = new Lazy<HashSet<ISpatialItem>>();
public HashSet<ISpatialItem> SpatialItems => m_SpatialItems.Value;

public bool LimitItems { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/TopoPad.Core/Layers/ItemsLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private bool HitTestCurve(FeatureStyleSet styleSet, Geometry geom,
}
double buffer = (styleSet.LineStyle.Width / 2 +
viewBoundaryBuffer) * viewToWorld;
return geom.Distance(new Point(x, y)) < buffer;
return geom.Distance(new Point(x, y)) <= buffer;
}

private bool HitTestArea(FeatureStyleSet styleSet, Geometry geom,
Expand All @@ -331,7 +331,7 @@ private bool HitTestArea(FeatureStyleSet styleSet, Geometry geom,
return true;
}
double buffer = (styleSet.LineStyle.Width / 2 + viewBoundaryBuffer) * viewToWorld;
return geom.Distance(p) < buffer;
return geom.Distance(p) <= buffer;
}

private bool SetNotifyUnregisterRegister(ref FeatureStyleSet field, FeatureStyleSet value,
Expand Down
2 changes: 1 addition & 1 deletion src/TopoPad.Core/TopoPad.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="3.0.1" />
<PackageReference Include="NetTopologySuite" Version="2.1.0" />
<PackageReference Include="System.Text.Json" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void HandleLeftButtonUp(IPointerEventArgs e)
{
m_Hits.Clear();
Coordinate pos = Scene.ViewToWorld(m_Position);
doc.HitTest(pos.X, pos.Y, 3, 1 / Scene.Scale,
doc.HitTest(pos.X, pos.Y, 5, 1 / Scene.Scale,
m_HitTestSpec, m_Hits);
bool multi = e.KeyModifiers.HasFlag(KeyModifiers.Shift);
if (m_Hits.Count == 1)
Expand Down
2 changes: 1 addition & 1 deletion src/TopoPad/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ full text of the license.
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
<StyleInclude Source="avares://Dock.Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Dock.Avalonia.Themes.Default/DefaultTheme.axaml"/>
</Application.Styles>
</Application>
2 changes: 1 addition & 1 deletion src/TopoPad/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void Main(string[] args) => BuildAvaloniaApp()
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToDebug()
.LogToTrace()
.UseReactiveUI();
}
}
14 changes: 7 additions & 7 deletions src/TopoPad/TopoPad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<None Remove="Views\Test.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.0-rc1" />
<PackageReference Include="Dock.Avalonia" Version="0.10.0-rc1" />
<PackageReference Include="Dock.Avalonia.Themes.Default" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.0" />
<PackageReference Include="Dock.Avalonia" Version="0.10.0" />
<PackageReference Include="Dock.Avalonia.Themes.Default" Version="0.10.0" />
<PackageReference Include="Dock.Avalonia.Themes.Metro" Version="0.10.0-preview4" />
<PackageReference Include="Dock.Model.ReactiveUI" Version="0.10.0-rc1" />
<PackageReference Include="Dock.Model.ReactiveUI" Version="0.10.0" />
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="2.0.4" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/TopoPad/Views/LayersView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ full text of the license.
xmlns:tpcl="clr-namespace:TopoPad.Core.Layers;assembly=TopoPad.Core"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
xmlns:iac="clr-namespace:Avalonia.Xaml.Interactions.Custom;assembly=Avalonia.Xaml.Interactions.Custom"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="TopoPad.Views.LayersView">
<UserControl.Styles>
Expand Down

0 comments on commit ce7ad66

Please sign in to comment.