mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Finalized client-side storage
This commit is contained in:
1 parent
6eefa733b4
commit
7773d377a2
29 files changed
+961
-434
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Artemis.UI.Adorners
|
||||
{
|
||||
public class BoundingBoxAdorner : Adorner
|
||||
{
|
||||
private Color _boundingBoxColor;
|
||||
private Rect _boundingBoxRect;
|
||||
|
||||
public BoundingBoxAdorner(UIElement adornedElement, Color boundingBoxColor) : base(adornedElement)
|
||||
{
|
||||
_boundingBoxRect = new Rect(new Size(0, 0));
|
||||
BoundingBoxColor = boundingBoxColor;
|
||||
|
||||
IsHitTestVisible = false;
|
||||
}
|
||||
|
||||
public Color BoundingBoxColor
|
||||
{
|
||||
get => _boundingBoxColor;
|
||||
set
|
||||
{
|
||||
_boundingBoxColor = value;
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext)
|
||||
{
|
||||
var renderBrush = new SolidColorBrush(BoundingBoxColor) {Opacity = 0.2};
|
||||
var renderPen = new Pen(new SolidColorBrush(BoundingBoxColor), 1.5);
|
||||
|
||||
drawingContext.DrawRectangle(renderBrush, renderPen, _boundingBoxRect);
|
||||
}
|
||||
|
||||
public void Update(Point startingPoint, Point currentPoint)
|
||||
{
|
||||
_boundingBoxRect = new Rect(startingPoint, currentPoint);
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user