small visual adjusments

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-08-12 11:14:09 +03:00
parent a81a6f881d
commit 468d28d9d8
5 changed files with 26 additions and 39 deletions
@@ -10,7 +10,7 @@ namespace Azaion.Annotator.Controls;
public class AnnotationControl : Border
{
private readonly Action<object, MouseButtonEventArgs> _resizeStart;
private const double RESIZE_RECT_SIZE = 10;
private const double RESIZE_RECT_SIZE = 9;
private readonly Grid _grid;
private readonly TextBlock _classNameLabel;
@@ -52,14 +52,14 @@ public class AnnotationControl : Border
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 15, 0, 0),
FontSize = 14,
Cursor = Cursors.Arrow
Cursor = Cursors.SizeAll
};
_selectionFrame = new Rectangle
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Stroke = new SolidColorBrush(Colors.Black),
StrokeThickness = 3,
StrokeThickness = 2,
Visibility = Visibility.Collapsed
};
@@ -79,9 +79,7 @@ public class AnnotationControl : Border
AddRect("rLB", HorizontalAlignment.Left, VerticalAlignment.Bottom, Cursors.SizeNESW),
AddRect("rCB", HorizontalAlignment.Center, VerticalAlignment.Bottom, Cursors.SizeNS),
AddRect("rRB", HorizontalAlignment.Right, VerticalAlignment.Bottom, Cursors.SizeNWSE)
},
Background = new SolidColorBrush(annotationClass.Color)
}
};
Child = _grid;
Cursor = Cursors.SizeAll;
@@ -97,7 +95,7 @@ public class AnnotationControl : Border
VerticalAlignment = va,
Width = RESIZE_RECT_SIZE,
Height = RESIZE_RECT_SIZE,
Stroke = new SolidColorBrush(Color.FromRgb(10, 10, 10)), // small rectangles color
Stroke = new SolidColorBrush(Color.FromArgb(230, 40, 40, 40)), // small rectangles color
Fill = new SolidColorBrush(Color.FromArgb(1, 255, 255, 255)),
Cursor = crs,
Name = name,
+5 -1
View File
@@ -1,4 +1,5 @@
using System.Windows.Media;
using System.Text.Json.Serialization;
using System.Windows.Media;
using Azaion.Annotator.Extensions;
namespace Azaion.Annotator.DTO;
@@ -10,6 +11,9 @@ public class AnnotationClass(int id, string name = "")
public string Name { get; set; } = name;
public Color Color { get; set; } = id.ToColor();
[JsonIgnore]
public int ClassNumber => Id + 1;
[JsonIgnore]
public SolidColorBrush ColorBrush => new(Color);
}
+1
View File
@@ -1,5 +1,6 @@
using System.IO;
using System.Text;
using System.Windows.Media;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Size = System.Windows.Size;
@@ -7,17 +7,11 @@ public static class ColorExtensions
public static Color ToColor(this int id)
{
var index = id % ColorValues.Length;
return ToColor($"#{ColorValues[index]}");
}
public static Color ToColor(string hex)
{
var color = (Color)ColorConverter.ConvertFromString(hex);
color.A = 128;
var hex = $"#40{ColorValues[index]}";
var color =(Color)ColorConverter.ConvertFromString(hex);
return color;
}
private static readonly string[] ColorValues =
[
"FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "000000",
+12 -22
View File
@@ -7,69 +7,59 @@
{
"Id": 0,
"Name": "Броньована техніка",
"Color": "#80FF0000",
"ColorBrush": "#80FF0000"
"Color": "#40FF0000"
},
{
"Id": 1,
"Name": "Вантажівка",
"Color": "#8000FF00",
"ColorBrush": "#8000FF00"
"Color": "#4000FF00"
},
{
"Id": 2,
"Name": "Машина легкова",
"Color": "#800000FF",
"ColorBrush": "#800000FF"
"Color": "#400000FF"
},
{
"Id": 3,
"Name": "Артилерія",
"Color": "#80FFFF00",
"ColorBrush": "#80FFFF00"
"Color": "#40FFFF00"
},
{
"Id": 4,
"Name": "Тінь від техніки",
"Color": "#80FF00FF",
"ColorBrush": "#80FF00FF"
"Color": "#40FF00FF"
},
{
"Id": 5,
"Name": "Окопи",
"Color": "#8000FFFF",
"ColorBrush": "#8000FFFF"
"Color": "#4000FFFF"
},
{
"Id": 6,
"Name": "Військовий",
"Color": "#80000000",
"ColorBrush": "#80000000"
"Color": "#40000000"
},
{
"Id": 7,
"Name": "Накати",
"Color": "#80800000",
"ColorBrush": "#80800000"
"Color": "#40800000"
},
{
"Id": 8,
"Name": "Танк з захистом",
"Color": "#80008000",
"ColorBrush": "#80008000"
"Color": "#40008000"
},
{
"Id": 9,
"Name": "Дим",
"Color": "#80000080",
"ColorBrush": "#80000080"
"Color": "#40000080"
}
],
"WindowSize": "1920,1080",
"WindowLocation": "200,121",
"FullScreen": true,
"LeftPanelWidth": 30,
"RightPanelWidth": 30,
"LeftPanelWidth": 300,
"RightPanelWidth": 300,
"ShowHelpOnStart": false,
"VideoFormats": ["mov", "mp4"],
"ImageFormats": ["jpg", "jpeg", "png", "bmp", "gif"]