mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
fix: closest to mouse not clamped
This commit is contained in:
@@ -60,15 +60,27 @@ namespace Spectrum.Detection
|
||||
{
|
||||
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||
bounds = new Rectangle(
|
||||
mousePos.X - (config.ImageWidth/2),
|
||||
mousePos.Y - (config.ImageHeight/2),
|
||||
mousePos.X - (config.ImageWidth / 2),
|
||||
mousePos.Y - (config.ImageHeight / 2),
|
||||
config.ImageWidth,
|
||||
config.ImageHeight
|
||||
);
|
||||
}
|
||||
var screenshot = null as Bitmap;
|
||||
|
||||
var screenRect = new Rectangle(0, 0, screenSize.Width, screenSize.Height);
|
||||
bounds = Rectangle.Intersect(bounds, screenRect);
|
||||
if (bounds.Width <= 0 || bounds.Height <= 0)
|
||||
{
|
||||
renderer?.CommitDetectionDrawCommands();
|
||||
Thread.Sleep(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
Bitmap? screenshot = null;
|
||||
if (config.CaptureMethod == CaptureMethod.DirectX && _captureManager.IsDirectXAvailable)
|
||||
{
|
||||
screenshot = _captureManager.CaptureScreenshotDirectX(bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_captureManager.IsInitialized)
|
||||
|
||||
@@ -94,8 +94,8 @@ namespace Spectrum
|
||||
drawList.AddRectFilled(canvasPos, size + canvasPos, ImGui.GetColorU32(new Vector4(0.12f, 0.12f, 0.14f, 1.0f)), 3f);
|
||||
drawList.AddRect(canvasPos, size + canvasPos, ImGui.GetColorU32(new Vector4(0.17f, 0.17f, 0.20f, 1.0f)), 3f);
|
||||
drawList.AddRect(
|
||||
new Vector2(boundingBox.X + canvasPos.X, boundingBox.Top + canvasPos.Y),
|
||||
new Vector2(boundingBox.X + boundingBox.Width + canvasPos.X, boundingBox.Y + boundingBox.Height + canvasPos.Y),
|
||||
new Vector2(boundingBox.X + canvasPos.X, boundingBox.Top + canvasPos.Y),
|
||||
new Vector2(boundingBox.X + boundingBox.Width + canvasPos.X, boundingBox.Y + boundingBox.Height + canvasPos.Y),
|
||||
ImGui.GetColorU32(new Vector4(0, 0, 1, 1)), 0.0f, ImDrawFlags.None, 2.0f);
|
||||
|
||||
if (_previewPath.Count > 1)
|
||||
@@ -160,7 +160,7 @@ namespace Spectrum
|
||||
{
|
||||
_previewStartPoint = new Point((int)localMousePos.X, (int)localMousePos.Y);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
_previewEndPoint = new Point((int)localMousePos.X, (int)localMousePos.Y);
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ namespace Spectrum
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||
InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||
topLeft = new(mousePos.X - (config.ImageWidth / 2), mousePos.Y - (config.ImageHeight / 2));
|
||||
bottomRight = new(mousePos.X + (config.ImageWidth / 2), mousePos.Y + (config.ImageHeight / 2));
|
||||
}
|
||||
@@ -765,7 +765,7 @@ namespace Spectrum
|
||||
center = new(mousePos.X, mousePos.Y);
|
||||
}
|
||||
|
||||
drawList.AddCircle(center, config.ImageWidth / 2,ImGui.GetColorU32(config.FOVColor), 100, 1.0f);
|
||||
drawList.AddCircle(center, config.ImageWidth / 2, ImGui.GetColorU32(config.FOVColor), 100, 1.0f);
|
||||
} // added straight to drawlist to prevent caching/flickering
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user