This commit is contained in:
2020-07-11 12:36:54 +08:00
parent f563839566
commit e84465cd64
26 changed files with 247 additions and 248 deletions

View File

@@ -1126,6 +1126,7 @@ public class UIWidget : UIRect
float leftOffset = offsetRect.x;
float rightOffset = offsetRect.z;
float topOffset = offsetRect.y;
float bottomOffset = offsetRect.w;
UIPanel panel = null;
#endregion
@@ -1142,6 +1143,7 @@ public class UIWidget : UIRect
leftOffset *= panel.width;
rightOffset *= panel.width;
topOffset *= panel.height;
bottomOffset *= panel.height;
} else
{
leftOffset = 0;
@@ -1154,7 +1156,13 @@ public class UIWidget : UIRect
{
lt = NGUIMath.Lerp(sides[0].x, sides[2].x, leftAnchor.relative) + leftAnchor.absolute + leftOffset;
rt = NGUIMath.Lerp(sides[0].x, sides[2].x, rightAnchor.relative) + rightAnchor.absolute - rightOffset;
bt = NGUIMath.Lerp(sides[3].y, sides[1].y, bottomAnchor.relative) + bottomAnchor.absolute - topOffset;
if(bottomAnchor.absolute < 0)
{
bt = NGUIMath.Lerp(sides[3].y, sides[1].y, bottomAnchor.relative) + bottomAnchor.absolute - topOffset;
} else
{
bt = NGUIMath.Lerp(sides[3].y, sides[1].y, bottomAnchor.relative) + bottomAnchor.absolute + bottomOffset;
}
tt = NGUIMath.Lerp(sides[3].y, sides[1].y, topAnchor.relative) + topAnchor.absolute - topOffset;
mIsInFront = true;
}
@@ -1164,7 +1172,7 @@ public class UIWidget : UIRect
Vector3 lp = GetLocalPos(leftAnchor, parent);
lt = lp.x + leftAnchor.absolute + leftOffset;
bt = lp.y + bottomAnchor.absolute - topOffset;
rt = lp.x + rightAnchor.absolute - rightOffset;
rt = lp.x + rightAnchor.absolute + rightOffset;
tt = lp.y + topAnchor.absolute - topOffset;
mIsInFront = (!hideIfOffScreen || lp.z >= 0f);
}
@@ -1243,6 +1251,7 @@ public class UIWidget : UIRect
leftOffset *= panel.width;
rightOffset *= panel.width;
topOffset *= panel.height;
bottomOffset *= panel.height;
}
else
{
@@ -1254,11 +1263,11 @@ public class UIWidget : UIRect
if (sides != null)
{
bt = NGUIMath.Lerp(sides[3].y, sides[1].y, bottomAnchor.relative) + bottomAnchor.absolute - topOffset;
bt = NGUIMath.Lerp(sides[3].y, sides[1].y, bottomAnchor.relative) + bottomAnchor.absolute + bottomOffset;
}
else
{
bt = GetLocalPos(bottomAnchor, parent).y + bottomAnchor.absolute - topOffset;
bt = GetLocalPos(bottomAnchor, parent).y + bottomAnchor.absolute + bottomOffset;
}
}
else bt = pos.y - pvt.y * mHeight;