From 58bf83d08ef49099f25ac25f33b5155ab265326e Mon Sep 17 00:00:00 2001
From: ZHU MINCHAO <48154958+MinchaoZhu@users.noreply.github.com>
Date: Wed, 4 Nov 2026 10:30:47 +0800
Subject: [PATCH] ui: avoid alpha 0 on images with Mask dependency across
PledgerSkin
---
src/Decentralized/PledgerSkin.cs | 24 ++++++++++++++++++------
src/Decentralized/WalletWindow.cs | 2 +-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/Decentralized/PledgerSkin.cs b/src/Decentralized/PledgerSkin.cs
index f87347d..737a478 100644
--- a/src/Decentralized/PledgerSkin.cs
+++ b/src/Decentralized/PledgerSkin.cs
@@ -27,8 +27,16 @@ namespace Decentralized
public static readonly Color Paper = new Color(0.847f, 0.855f, 0.816f); // #D8DAD0
public static readonly Color RowNormal = new Color(0f, 0f, 0f, 0.04f);
public static readonly Color Transparent = new Color(0f, 0f, 0f, 0f);
+ public static readonly Color MaskClear = new Color(0f, 0f, 0f, 0.004f);
public static readonly Color Separator = new Color(0.12f, 0.12f, 0.14f, 0.18f);
+ /// 透明化底图:若附带 Mask 组件则保留极微小 alpha(0.004),避免 Mask 模板 alpha 为 0 导致子内容被整裁。
+ public static void SetClear(Image img)
+ {
+ if (img == null) return;
+ img.color = (img.GetComponent() != null) ? MaskClear : Transparent;
+ }
+
private static readonly Dictionary Sliced = new Dictionary();
/// 把本 mod 的像素图做成九宫格贴到 Image 上:边角 border 像素不拉伸,一个像素放大成 3 个界面单位。
@@ -116,7 +124,7 @@ namespace Decentralized
foreach (var name in new[] { "header", "rule" })
{
var img = win.root.transform.Find(name)?.GetComponent();
- if (img != null) img.color = Transparent;
+ if (img != null) SetClear(img);
}
if (win.frame?.titleText != null)
{
@@ -193,18 +201,18 @@ namespace Decentralized
foreach (var scroll in screen.GetComponentsInChildren(true))
{
var bg = scroll.GetComponent();
- if (bg != null) bg.color = Transparent;
+ if (bg != null) SetClear(bg);
if (scroll.viewport != null)
{
var vpImg = scroll.viewport.GetComponent();
// 视口的图是 Mask 的模板:alpha 为 0 会把整个内容裁掉,只能压到几乎看不见
- if (vpImg != null) vpImg.color = new Color(0f, 0f, 0f, 0.004f);
+ if (vpImg != null) SetClear(vpImg);
}
if (scroll.verticalScrollbar != null)
{
var sb = scroll.verticalScrollbar;
var track = sb.GetComponent();
- if (track != null) track.color = Transparent;
+ if (track != null) SetClear(track);
if (sb.handleRect != null)
{
var handleImg = sb.handleRect.GetComponent();
@@ -217,11 +225,15 @@ namespace Decentralized
}
}
- // 清理辅助 Panel 底图
+ // 清理辅助 Panel 底图与任何残留原生灰色边框的容器
if (clear != null)
{
foreach (var img in clear)
- if (img != null) img.color = Transparent;
+ if (img != null) SetClear(img);
+ }
+ foreach (var img in screen.GetComponentsInChildren(true))
+ {
+ if (img.sprite == MachineryStyle.BevelFrame) SetClear(img);
}
// 数据表行:反色高亮与整行点击
diff --git a/src/Decentralized/WalletWindow.cs b/src/Decentralized/WalletWindow.cs
index 5050e8e..727dcef 100644
--- a/src/Decentralized/WalletWindow.cs
+++ b/src/Decentralized/WalletWindow.cs
@@ -195,7 +195,7 @@ namespace Decentralized
OnClick = () => { dev.Asset = x.asset; dev.Note = null; Open(dev); }
});
PledgerSkin.Apply(win, screen, bezel, paper, _picked, _clear, rows);
- if (plate != null) plate.color = PledgerSkin.Transparent;
+ if (plate != null) PledgerSkin.SetClear(plate);
// 签名要按住 ✓:在按键上挂一个按住计时
if (ok != null && dev.Screen == Screen.Review && ok.GetComponent() == null) ok.AddComponent().Device = dev.Address;
}