Skip to content

Commit 60f47bf

Browse files
committed
Fix some math for the RectRegion, take into account the left bounds when trying to see if the width/height is past the image bounds
1 parent da82b0f commit 60f47bf

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Data/RectRegion.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public double Height
9191
_height = value;
9292
if (OwnedTexture != null)
9393
{
94-
if (_height > OwnedTexture.ImageHeight)
95-
_height = OwnedTexture.ImageHeight;
94+
if ((_height + Y) > OwnedTexture.ImageHeight)
95+
_height = OwnedTexture.ImageHeight - Y;
9696
}
9797
if (_height < 0)
9898
_height = 1;
@@ -110,8 +110,8 @@ public double Width
110110
_width = value;
111111
if (OwnedTexture != null)
112112
{
113-
if (_width > OwnedTexture.ImageWidth)
114-
_width = OwnedTexture.ImageWidth;
113+
if ((_width + X) > OwnedTexture.ImageWidth)
114+
_width = OwnedTexture.ImageWidth - X;
115115
}
116116
if (_width < 0)
117117
_width = 1;

0 commit comments

Comments
 (0)