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