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