diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index c6553ac..6772040 100644
--- a/UVtools.Core/UVtools.Core.csproj
+++ b/UVtools.Core/UVtools.Core.csproj
@@ -10,7 +10,7 @@
https://github.com/sn4k3/UVtools
https://github.com/sn4k3/UVtools
MSLA/DLP, file analysis, calibration, repair, conversion and manipulation
- 2.22.1
+ 2.23.0
Copyright © 2020 PTRTECH
UVtools.png
AnyCPU;x64
diff --git a/UVtools.WPF/MainWindow.Issues.cs b/UVtools.WPF/MainWindow.Issues.cs
index 9aacf11..dfdd747 100644
--- a/UVtools.WPF/MainWindow.Issues.cs
+++ b/UVtools.WPF/MainWindow.Issues.cs
@@ -6,8 +6,8 @@
* of this license document, but changing it is not allowed.
*/
using System;
+using System.Collections;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Collections;
@@ -38,6 +38,24 @@ namespace UVtools.WPF
public DataGrid IssuesGrid;
private int _issueSelectedIndex = -1;
+
+ public IEnumerable IssuesGridItems
+ {
+ get
+ {
+ if (!IsFileLoaded || DataContext is null) return null;
+ if (Settings.Issues.DataGridGroupByType || Settings.Issues.DataGridGroupByLayerIndex)
+ {
+ var groupView = new DataGridCollectionView(SlicerFile.IssueManager);
+ if (Settings.Issues.DataGridGroupByType) groupView.GroupDescriptions.Add(new DataGridPathGroupDescription("Type"));
+ if (Settings.Issues.DataGridGroupByLayerIndex) groupView.GroupDescriptions.Add(new DataGridPathGroupDescription("StartLayerIndex"));
+
+ return groupView;
+ }
+
+ return SlicerFile.IssueManager;
+ }
+ }
#endregion
#region Properties
@@ -53,6 +71,8 @@ namespace UVtools.WPF
set => RaiseAndSetIfChanged(ref _resinTrapDetectionStartLayer, value);
}
+ public bool SuppressIssueGridSelectionEvent { get; set; }
+
#endregion
#region Methods
@@ -381,7 +401,7 @@ namespace UVtools.WPF
private void IssuesGridOnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
- if (DataContext is null) return;
+ if (DataContext is null || SuppressIssueGridSelectionEvent) return;
if (IssuesGrid.SelectedItem is not MainIssue mainIssue)
{
@@ -390,34 +410,7 @@ namespace UVtools.WPF
}
var issue = mainIssue.FirstOrDefault();
-
-
- if (mainIssue.Type is MainIssue.IssueType.TouchingBound or MainIssue.IssueType.EmptyLayer || mainIssue.BoundingRectangle.IsEmpty)
- {
- ZoomToFit();
- }
- else if (!mainIssue.BoundingRectangle.IsEmpty && issue is not null)
- {
-
- if (Settings.LayerPreview.ZoomIssues ^ (_globalModifiers & KeyModifiers.Alt) != 0)
- {
- ZoomToIssue(issue);
- }
- else
- {
- //CenterLayerAt(GetTransposedIssueBounds(issue));
- // If issue is not already visible, center on it and bring it into view.
- // Issues already in view will not be centered, though their color may
- // change and the crosshair may move to reflect active selections.
-
- if (!LayerImageBox.GetSourceImageRegion().Contains(GetTransposedIssueBounds(issue).ToAvalonia()))
- {
- CenterAtIssue(issue);
- }
- }
- }
-
- ForceUpdateActualLayer(mainIssue.StartLayerIndex);
+ ZoomToIssue(issue, true);
}
diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs
index 8b7bed1..750a6f5 100644
--- a/UVtools.WPF/MainWindow.LayerPreview.cs
+++ b/UVtools.WPF/MainWindow.LayerPreview.cs
@@ -960,27 +960,27 @@ namespace UVtools.WPF
switch (issue.Parent.Type)
{
case MainIssue.IssueType.Island:
- color = selectedIssues.Count > 0 && selectedIssues.Contains(issue)
+ color = selectedIssues.Count > 0 && selectedIssues.Contains(issue.Parent)
? Settings.LayerPreview.IslandHighlightColor
: Settings.LayerPreview.IslandColor;
drawCrosshair = true;
break;
case MainIssue.IssueType.Overhang:
- color = selectedIssues.Count > 0 && selectedIssues.Contains(issue)
+ color = selectedIssues.Count > 0 && selectedIssues.Contains(issue.Parent)
? Settings.LayerPreview.OverhangHighlightColor
: Settings.LayerPreview.OverhangColor;
drawCrosshair = true;
break;
case MainIssue.IssueType.ResinTrap:
- color = selectedIssues.Count > 0 && selectedIssues.Contains(issue)
+ color = selectedIssues.Count > 0 && selectedIssues.Contains(issue.Parent)
? Settings.LayerPreview.ResinTrapHighlightColor
: Settings.LayerPreview.ResinTrapColor;
drawCrosshair = true;
break;
case MainIssue.IssueType.SuctionCup:
- color = selectedIssues.Count > 0 && selectedIssues.Contains(issue)
+ color = selectedIssues.Count > 0 && selectedIssues.Contains(issue.Parent)
? Settings.LayerPreview.SuctionCupHighlightColor
: Settings.LayerPreview.SuctionCupColor;
drawCrosshair = true;
@@ -1583,32 +1583,35 @@ namespace UVtools.WPF
/// Zoom the layer preview to the passed issue, or if appropriate for issue type,
/// Zoom to fit the plate or print bounds.
///
- private void ZoomToIssue(Issue issue)
+ private void ZoomToIssue(Issue issue, bool forceRefreshLayer = false)
{
- if (issue.Parent.Type is MainIssue.IssueType.TouchingBound or MainIssue.IssueType.EmptyLayer || issue.BoundingRectangle.IsEmpty)
+ if (issue.Type is MainIssue.IssueType.TouchingBound or MainIssue.IssueType.EmptyLayer || issue.BoundingRectangle.IsEmpty)
{
ZoomToFit();
+ if (forceRefreshLayer) ForceUpdateActualLayer(issue.LayerIndex);
return;
}
- if (!issue.BoundingRectangle.IsEmpty)
+ if (issue.BoundingRectangle.IsEmpty) return;
+
+ if (Settings.LayerPreview.ZoomIssues ^ (_globalModifiers & KeyModifiers.Alt) != 0)
{
- // Check to see if this zoom action will cross the crosshair fade threshold
- /*if (tsLayerImageShowCrosshairs.Checked && !ReferenceEquals(Issues, null) && flvIssues.SelectedIndices.Count > 0
- && pbLayer.Zoom <= CrosshairFadeLevel && LockedZoomLevel > CrosshairFadeLevel)
- {
- // Refresh the preview without the crosshairs before zooming-in.
- // Prevents zoomed-in crosshairs from breifly being displayed before
- // the Layer Preview is refreshed post-zoom.
- tsLayerImageShowCrosshairs.Checked = false;
- ShowLayer();
- tsLayerImageShowCrosshairs.Checked = true;
- }*/
-
-
CenterLayerAt(GetTransposedIssueBounds(issue), AppSettings.LockedZoomLevel);
-
}
+ else
+ {
+ //CenterLayerAt(GetTransposedIssueBounds(issue));
+ // If issue is not already visible, center on it and bring it into view.
+ // Issues already in view will not be centered, though their color may
+ // change and the crosshair may move to reflect active selections.
+
+ if (!LayerImageBox.GetSourceImageRegion().Contains(GetTransposedIssueBounds(issue).ToAvalonia()))
+ {
+ CenterAtIssue(issue);
+ }
+ }
+
+ if(forceRefreshLayer) ForceUpdateActualLayer(issue.LayerIndex);
}
///
@@ -1699,11 +1702,16 @@ namespace UVtools.WPF
{
//location = GetTransposedPoint(location);
// If location clicked is within an issue, activate it.
- foreach (var issue in SlicerFile.IssueManager.GetIssuesBy(_actualLayer))
+ foreach (var issue in SlicerFile.IssueManager.GetIssuesBy(_actualLayer).Reverse())
{
if (!GetTransposedIssueBounds(issue).Contains(location)) continue;
+ SuppressIssueGridSelectionEvent = true;
IssuesGrid.SelectedItem = issue.Parent;
+ SuppressIssueGridSelectionEvent = false;
+
+ ZoomToIssue(issue, true);
+
SelectedTabItem = TabIssues;
break;
}
diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml
index 7b8a6b5..2e0fce5 100644
--- a/UVtools.WPF/MainWindow.axaml
+++ b/UVtools.WPF/MainWindow.axaml
@@ -857,7 +857,7 @@
SelectedIndex="{Binding IssueSelectedIndex, Mode=TwoWay}"
IsReadOnly="True"
ClipboardCopyMode="IncludeHeader"
- Items="{Binding SlicerFile.IssueManager}">
+ Items="{Binding IssuesGridItems}">
{
UpdateLayerTrackerHighlightIssues();
diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj
index 093cb9d..86a7540 100644
--- a/UVtools.WPF/UVtools.WPF.csproj
+++ b/UVtools.WPF/UVtools.WPF.csproj
@@ -12,7 +12,7 @@
LICENSE
https://github.com/sn4k3/UVtools
Git
- 2.22.1
+ 2.23.0
AnyCPU;x64