区域句柄调整
This commit is contained in:
@@ -394,9 +394,9 @@ namespace Camera
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scaleX = (float)imageWidth / picBoxCamera.ClientSize.Width;
|
float scaleX = (float)picBoxCamera.ClientSize.Width / imageWidth;
|
||||||
float scaleY = (float)imageHeight / picBoxCamera.ClientSize.Height;
|
float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight;
|
||||||
Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY));
|
Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY));
|
||||||
Point controlPoint = e.Location;
|
Point controlPoint = e.Location;
|
||||||
|
|
||||||
Rectangle detectionZone = _camera.GetDetectionZone();
|
Rectangle detectionZone = _camera.GetDetectionZone();
|
||||||
@@ -503,9 +503,9 @@ namespace Camera
|
|||||||
Rectangle editRect = _isEditingDetectionZone ? scaledDetectionZone : scaledLedZone;
|
Rectangle editRect = _isEditingDetectionZone ? scaledDetectionZone : scaledLedZone;
|
||||||
int handle = GetHoveredHandle(editRect, e.Location);
|
int handle = GetHoveredHandle(editRect, e.Location);
|
||||||
|
|
||||||
if (_isResizing && handle >= 0)
|
if (_isResizing)
|
||||||
{
|
{
|
||||||
picBoxCamera.Cursor = GetResizeCursor(handle);
|
picBoxCamera.Cursor = GetResizeCursor(_hoveredHandle);
|
||||||
|
|
||||||
int dx = e.Location.X - _resizeStartPoint.X;
|
int dx = e.Location.X - _resizeStartPoint.X;
|
||||||
int dy = e.Location.Y - _resizeStartPoint.Y;
|
int dy = e.Location.Y - _resizeStartPoint.Y;
|
||||||
@@ -537,13 +537,14 @@ namespace Camera
|
|||||||
}
|
}
|
||||||
else if (_isMoving)
|
else if (_isMoving)
|
||||||
{
|
{
|
||||||
Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY));
|
picBoxCamera.Cursor = Cursors.SizeAll;
|
||||||
int moveDx = imagePoint.X - _startPoint.X;
|
|
||||||
int moveDy = imagePoint.Y - _startPoint.Y;
|
int dx = e.Location.X - _resizeStartPoint.X;
|
||||||
|
int dy = e.Location.Y - _resizeStartPoint.Y;
|
||||||
|
|
||||||
Rectangle newZone = new Rectangle(
|
Rectangle newZone = new Rectangle(
|
||||||
_originalZone.X + moveDx,
|
_originalZone.X + (int)(dx / scaleX),
|
||||||
_originalZone.Y + moveDy,
|
_originalZone.Y + (int)(dy / scaleY),
|
||||||
_originalZone.Width,
|
_originalZone.Width,
|
||||||
_originalZone.Height
|
_originalZone.Height
|
||||||
);
|
);
|
||||||
@@ -583,7 +584,7 @@ namespace Camera
|
|||||||
{
|
{
|
||||||
picBoxCamera.Cursor = Cursors.SizeAll;
|
picBoxCamera.Cursor = Cursors.SizeAll;
|
||||||
|
|
||||||
Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY));
|
Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY));
|
||||||
|
|
||||||
int dx = imagePoint.X - _startPoint.X;
|
int dx = imagePoint.X - _startPoint.X;
|
||||||
int dy = imagePoint.Y - _startPoint.Y;
|
int dy = imagePoint.Y - _startPoint.Y;
|
||||||
@@ -650,9 +651,9 @@ namespace Camera
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scaleX = (float)imageWidth / picBoxCamera.ClientSize.Width;
|
float scaleX = (float)picBoxCamera.ClientSize.Width / imageWidth;
|
||||||
float scaleY = (float)imageHeight / picBoxCamera.ClientSize.Height;
|
float scaleY = (float)picBoxCamera.ClientSize.Height / imageHeight;
|
||||||
Point imagePoint = new Point((int)(e.X * scaleX), (int)(e.Y * scaleY));
|
Point imagePoint = new Point((int)(e.Location.X / scaleX), (int)(e.Location.Y / scaleY));
|
||||||
|
|
||||||
if (_isDrawing && !_isMoving)
|
if (_isDrawing && !_isMoving)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user