From bba3a99329a080c0924c882b04e52c61b3e227fd Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 26 Mar 2019 20:38:28 +0900 Subject: [PATCH] fix #47; In overlay mode, mask will be incorrect if the root canvas's parent position are not zero --- Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs | 2 +- .../Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs mode change 100644 => 100755 Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs old mode 100644 new mode 100755 index 4ece7d1..1139db4 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMask.cs @@ -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); diff --git a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs old mode 100644 new mode 100755 index 7c5d1b7..2210763 --- a/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs +++ b/Assets/Coffee/UIExtensions/SoftMaskForUGUI/Scripts/SoftMaskable.cs @@ -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)); }