feat: draw active work area as dashed orange rectangle on PlateView
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,17 @@ namespace OpenNest.Controls
|
|||||||
private List<LayoutPart> parts;
|
private List<LayoutPart> parts;
|
||||||
private List<LayoutPart> temporaryParts = new List<LayoutPart>();
|
private List<LayoutPart> temporaryParts = new List<LayoutPart>();
|
||||||
private Point middleMouseDownPoint;
|
private Point middleMouseDownPoint;
|
||||||
|
private Box activeWorkArea;
|
||||||
|
|
||||||
|
public Box ActiveWorkArea
|
||||||
|
{
|
||||||
|
get => activeWorkArea;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
activeWorkArea = value;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<LayoutPart> SelectedParts;
|
public List<LayoutPart> SelectedParts;
|
||||||
public ReadOnlyCollection<LayoutPart> Parts;
|
public ReadOnlyCollection<LayoutPart> Parts;
|
||||||
@@ -362,6 +373,7 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
DrawPlate(e.Graphics);
|
DrawPlate(e.Graphics);
|
||||||
DrawParts(e.Graphics);
|
DrawParts(e.Graphics);
|
||||||
|
DrawActiveWorkArea(e.Graphics);
|
||||||
|
|
||||||
base.OnPaint(e);
|
base.OnPaint(e);
|
||||||
}
|
}
|
||||||
@@ -600,6 +612,26 @@ namespace OpenNest.Controls
|
|||||||
g.DrawRectangle(ColorScheme.BoundingBoxPen, rect.X, rect.Y - rect.Height, rect.Width, rect.Height);
|
g.DrawRectangle(ColorScheme.BoundingBoxPen, rect.X, rect.Y - rect.Height, rect.Width, rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawActiveWorkArea(Graphics g)
|
||||||
|
{
|
||||||
|
if (activeWorkArea == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var rect = new RectangleF
|
||||||
|
{
|
||||||
|
Location = PointWorldToGraph(activeWorkArea.Location),
|
||||||
|
Width = LengthWorldToGui(activeWorkArea.Width),
|
||||||
|
Height = LengthWorldToGui(activeWorkArea.Length)
|
||||||
|
};
|
||||||
|
rect.Y -= rect.Height;
|
||||||
|
|
||||||
|
using var pen = new Pen(Color.Orange, 2f)
|
||||||
|
{
|
||||||
|
DashStyle = DashStyle.Dash
|
||||||
|
};
|
||||||
|
g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
|
||||||
|
}
|
||||||
|
|
||||||
public LayoutPart GetPartAtControlPoint(Point pt)
|
public LayoutPart GetPartAtControlPoint(Point pt)
|
||||||
{
|
{
|
||||||
var pt2 = PointControlToGraph(pt);
|
var pt2 = PointControlToGraph(pt);
|
||||||
|
|||||||
Reference in New Issue
Block a user