实现添加led
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user