fix #47; In overlay mode, mask will be incorrect if the root canvas's parent position are not zero
parent
ce177b6837
commit
ecce86f1fa
|
@ -482,7 +482,7 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
else
|
||||
{
|
||||
var pos = c.transform.localPosition;
|
||||
var pos = c.transform.position;
|
||||
var vm = Matrix4x4.TRS(new Vector3(-pos.x, -pos.y, -1000), Quaternion.identity, new Vector3(1, 1, -1f));
|
||||
var pm = Matrix4x4.TRS(new Vector3(0, 0, -1), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2 / 10000f));
|
||||
_cb.SetViewProjectionMatrices(vm, pm);
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
var scale = c.transform.localScale.x;
|
||||
var size = (c.transform as RectTransform).sizeDelta;
|
||||
var pos = c.transform.localPosition;
|
||||
var pos = c.transform.position;
|
||||
mat.SetMatrix(s_GameVPId, Matrix4x4.TRS(new Vector3(0, 0, 0.5f), Quaternion.identity, new Vector3(2 / size.x, 2 / size.y, 0.0005f * scale)));
|
||||
mat.SetMatrix(s_GameTVPId, Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2/2000f)) * Matrix4x4.Translate(-pos));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue