BGA辅助面板:气泡/焊球模式切换、VoidLimit面板调节、去掉标签右键编辑、未完成组气泡可拖拽调整

This commit is contained in:
李伟
2026-04-27 14:29:54 +08:00
parent f9a14b0771
commit fab0668da8
4 changed files with 188 additions and 5 deletions
@@ -394,6 +394,23 @@ namespace XP.ImageProcessing.RoiControl.Controls
public void SetBubbleBrushSize(int val) => _bubbleBrushSize = val;
public Rect? BubbleRoi => _bubbleRoi;
/// <summary>设置 BGA 测量的气泡/焊球绘制模式</summary>
public void SetBgaDrawBall(bool drawBall)
{
_bgaDrawBall = drawBall;
RaiseMeasureStatusChanged(drawBall ? "BGA - 画焊球模式" : "BGA - 画气泡模式");
}
/// <summary>设置所有 BGA 组的 VoidLimit 并刷新标签</summary>
public void SetBgaVoidLimit(double limit)
{
foreach (var g in _bgaGroups)
{
g.VoidLimit = limit;
g.UpdateLabel();
}
}
// 拖拽状态
private Ellipse _mDraggingDot;
private object _mDraggingOwner;
@@ -722,9 +739,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
{
_bgaCurrent = new Models.BgaVoidGroup();
var currentGroup = _bgaCurrent; // 局部变量供闭包捕获
_bgaCurrent.Label = new TextBlock { FontSize = 13, FontWeight = FontWeights.Bold, Cursor = System.Windows.Input.Cursors.Hand, Visibility = Visibility.Collapsed };
_bgaCurrent.Label.SetValue(ContextMenuService.IsEnabledProperty, false);
_bgaCurrent.Label.PreviewMouseRightButtonUp += (s, ev) => { ShowBgaLimitEditor(currentGroup); ev.Handled = true; };
_bgaCurrent.Label = new TextBlock { FontSize = 13, FontWeight = FontWeights.Bold, IsHitTestVisible = false, Visibility = Visibility.Collapsed };
_measureOverlay.Children.Add(_bgaCurrent.Label);
_bgaDrawBall = false;
RaiseMeasureStatusChanged("BGA空隙 - 点击画气泡圆心(右键切换为画焊球)");
@@ -924,10 +939,12 @@ namespace XP.ImageProcessing.RoiControl.Controls
if (g.E4BH == dot) { _mDraggingOwner = g; _mDraggingRole = "E4B"; break; }
}
}
// 查找 BGA 组
// 查找 BGA 组(已完成的 + 正在编辑的)
if (_mDraggingOwner == null)
{
foreach (var g in _bgaGroups)
var allBga = new System.Collections.Generic.List<Models.BgaVoidGroup>(_bgaGroups);
if (_bgaCurrent != null) allBga.Add(_bgaCurrent);
foreach (var g in allBga)
{
if (g.Ball?.CenterDot == dot) { _mDraggingOwner = g; _mDraggingRole = "BallCenter"; break; }
if (g.Ball?.EdgeDot == dot) { _mDraggingOwner = g; _mDraggingRole = "BallEdge"; break; }