实现添加led

This commit is contained in:
zqm
2026-03-26 10:30:55 +08:00
parent d779af975f
commit ad6c439a22

View File

@@ -874,18 +874,24 @@ namespace Camera
float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight;
Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY));
if (_isDrawing && !_isMoving)
if (_isDrawing)
{
int x = Math.Min(_startPoint.X, imagePoint.X);
int y = Math.Min(_startPoint.Y, imagePoint.Y);
int width = Math.Abs(imagePoint.X - _startPoint.X);
int height = Math.Abs(imagePoint.Y - _startPoint.Y);
if (width > 10 && height > 10)
if (width > 5 && height > 5)
{
if (_isDrawingLedMode)
{
// 确保是新增LED区而不是修改现有LED区
int newIndex = _camera.GetLedZoneCount() + 1;
// 确保新索引不与现有索引冲突
while (_camera.GetLedZones().ContainsKey(newIndex))
{
newIndex++;
}
_camera.AddLedZone(newIndex, new Rectangle(x, y, width, height), Color.Lime);
_selectedZoneIndex = newIndex;
_currentLedIndex = newIndex;