sm sec fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user