1
0

sm sec fixes

This commit is contained in:
2026-02-26 02:00:07 +03:00
parent fe7e03f756
commit 7b0b3d65e8
2 changed files with 78 additions and 24 deletions

View File

@@ -28,8 +28,19 @@ namespace DrawFigureLibrary
public override string ToString() => Name ?? "";
public static bool Check(Figure fig, int dX, int dY, Image img) => fig.x + dX >= 0 && fig.y + dY >= 0 && fig.x + dX + fig.w <= img.ActualWidth && fig.y + dY + fig.h <= img.ActualHeight;
public static bool Check(Figure fig, int dX, int dY, Image img)
{
long nx = (long)fig.x + dX;
long ny = (long)fig.y + dY;
long nr = nx + fig.w;
long nb = ny + fig.h;
return nx >= 0 &&
ny >= 0 &&
nr <= (long)img.ActualWidth &&
nb <= (long)img.ActualHeight;
}
public virtual bool HitTest(Point p) => p.X >= x && p.X <= x + w && p.Y >= y && p.Y <= y + h;
public virtual bool MoveByChecked(int dX, int dY)