-
Notifications
You must be signed in to change notification settings - Fork 981
Description
Issue: (Describe the bug here)
In the DragTo method of Text.cs, there is an issue with the way the vertical drag limits (DragYLimitMin and DragYLimitMax) are being applied. The conditionals for checking coordinateX should be comparing coordinateY instead, as the drag limits for the X and Y coordinates are being mistakenly mixed.
ScottPlot Version: (What NuGet package are you using?)
ScottPlot 4
Code Sample: See http://scottplot.net/faq/repro/ for tips about creating reproducible code samples
public void DragTo(double coordinateX, double coordinateY, bool fixedSize)
{
if (!DragEnabled)
return;
Coordinate original = new(coordinateX, coordinateY);
Coordinate snapped = DragSnap.Snap(original);
coordinateX = snapped.X;
coordinateY = snapped.Y;
if (coordinateX < DragXLimitMin) coordinateX = DragXLimitMin;
if (coordinateX > DragXLimitMax) coordinateX = DragXLimitMax;
if (coordinateX < DragYLimitMin) coordinateY = DragYLimitMin;
if (coordinateX > DragYLimitMax) coordinateY = DragYLimitMax;
X = coordinateX + DeltaCX;
Y = coordinateY + DeltaCY;
Dragged(this, EventArgs.Empty);
}Change the following lines in the DragTo method:
if (coordinateX < DragYLimitMin) coordinateY = DragYLimitMin;
if (coordinateX > DragYLimitMax) coordinateY = DragYLimitMax;To
if (coordinateY < DragYLimitMin) coordinateY = DragYLimitMin;
if (coordinateY > DragYLimitMax) coordinateY = DragYLimitMax;I came across a small issue in the DragTo method of Text.cs. It seems that the code is using coordinateX to check the vertical drag limits (DragYLimitMin and DragYLimitMax), but I believe it should actually be using coordinateY instead.