feat: rotate selected parts 90° on middle mouse click

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 01:12:03 -05:00
parent be8b499880
commit 5707bff89b

View File

@@ -26,6 +26,7 @@ namespace OpenNest.Controls
private Plate plate;
private Action currentAction;
private List<LayoutPart> parts;
private Point middleMouseDownPoint;
public List<LayoutPart> SelectedParts;
public ReadOnlyCollection<LayoutPart> Parts;
@@ -166,6 +167,31 @@ namespace OpenNest.Controls
AddPartFromDrawing(dwg, pt2);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle)
middleMouseDownPoint = e.Location;
base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle && SelectedParts.Count > 0)
{
var dx = e.X - middleMouseDownPoint.X;
var dy = e.Y - middleMouseDownPoint.Y;
if (dx * dx + dy * dy < 25)
{
RotateSelectedParts(Angle.ToRadians(90));
Invalidate();
}
}
base.OnMouseUp(e);
}
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);