fix dataset explorer view

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-09-29 17:37:34 +03:00
parent 5500bda6ce
commit 3a6ed60ea0
3 changed files with 24 additions and 22 deletions
+2 -1
View File
@@ -24,7 +24,8 @@
VerticalAlignment="Center" VerticalAlignment="Center"
VerticalContentAlignment="Center" VerticalContentAlignment="Center"
Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type local:NumericUpDown}}}" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type local:NumericUpDown}}}"
TextChanged="NUDTextBox_OnTextChanged"/> LostFocus="NudTextBox_OnLostFocus"
/>
<RepeatButton <RepeatButton
Name="NudButtonUp" Name="NudButtonUp"
Grid.Column="1" Grid.Column="1"
+19 -19
View File
@@ -56,7 +56,25 @@ public partial class NumericUpDown : UserControl
} }
} }
private void NUDTextBox_OnTextChanged(object sender, TextChangedEventArgs e) private void NudButtonUp_OnClick(object sender, RoutedEventArgs e)
{
var step = Step <= 0 ? 1m : Step;
var newVal = Math.Min(MaxValue, Value + step);
Value = newVal;
NudTextBox.Text = Value.ToString(CultureInfo.InvariantCulture);
NudTextBox.SelectionStart = NudTextBox.Text.Length;
}
private void NudButtonDown_OnClick(object sender, RoutedEventArgs e)
{
var step = Step <= 0 ? 1m : Step;
var newVal = Math.Max(MinValue, Value - step);
Value = newVal;
NudTextBox.Text = Value.ToString(CultureInfo.InvariantCulture);
NudTextBox.SelectionStart = NudTextBox.Text.Length;
}
private void NudTextBox_OnLostFocus(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(NudTextBox.Text) || !decimal.TryParse(NudTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out var number)) if (string.IsNullOrEmpty(NudTextBox.Text) || !decimal.TryParse(NudTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out var number))
{ {
@@ -80,22 +98,4 @@ public partial class NumericUpDown : UserControl
NudTextBox.SelectionStart = NudTextBox.Text.Length; NudTextBox.SelectionStart = NudTextBox.Text.Length;
} }
private void NudButtonUp_OnClick(object sender, RoutedEventArgs e)
{
var step = Step <= 0 ? 1m : Step;
var newVal = Math.Min(MaxValue, Value + step);
Value = newVal;
NudTextBox.Text = Value.ToString(CultureInfo.InvariantCulture);
NudTextBox.SelectionStart = NudTextBox.Text.Length;
}
private void NudButtonDown_OnClick(object sender, RoutedEventArgs e)
{
var step = Step <= 0 ? 1m : Step;
var newVal = Math.Max(MinValue, Value - step);
Value = newVal;
NudTextBox.Text = Value.ToString(CultureInfo.InvariantCulture);
NudTextBox.SelectionStart = NudTextBox.Text.Length;
}
} }
+3 -2
View File
@@ -195,11 +195,12 @@ public partial class DatasetExplorer
ThumbnailsView.SelectedIndex = index; ThumbnailsView.SelectedIndex = index;
var ann = CurrentAnnotation.Annotation; var ann = CurrentAnnotation.Annotation;
ExplorerEditor.SetBackground(await ann.ImagePath.OpenImage()); var image = await ann.ImagePath.OpenImage();
ExplorerEditor.SetBackground(image);
SwitchTab(toEditor: true); SwitchTab(toEditor: true);
ExplorerEditor.RemoveAllAnns(); ExplorerEditor.RemoveAllAnns();
ExplorerEditor.CreateDetections(ann, _appConfig.AnnotationConfig.DetectionClasses, ExplorerEditor.RenderSize); ExplorerEditor.CreateDetections(ann, _appConfig.AnnotationConfig.DetectionClasses, new Size(image.PixelWidth, image.PixelHeight));
} }
catch (Exception e) catch (Exception e)
{ {