refactor: move shared GetRectangle to Action base class

Both ActionSelect and ActionZoomWindow had identical 29-line
GetRectangle methods; consolidate into the common base class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 16:16:00 -04:00
parent 17f786c9e8
commit d1a701a7f7
3 changed files with 17 additions and 60 deletions

View File

@@ -166,36 +166,7 @@ namespace OpenNest.Actions
plateView.Refresh();
}
private RectangleF GetRectangle()
{
var rect = new RectangleF();
var pt1 = plateView.PointWorldToGraph(Point1);
var pt2 = plateView.PointWorldToGraph(Point2);
if (pt1.X < pt2.X)
{
rect.X = pt1.X;
rect.Width = pt2.X - pt1.X;
}
else
{
rect.X = pt2.X;
rect.Width = pt1.X - pt2.X;
}
if (pt1.Y < pt2.Y)
{
rect.Y = pt1.Y;
rect.Height = pt2.Y - pt1.Y;
}
else
{
rect.Y = pt2.Y;
rect.Height = pt1.Y - pt2.Y;
}
return rect;
}
private RectangleF GetRectangle() => GetRectangle(Point1, Point2);
public enum Status
{