fix:一些显示bug
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
This commit is contained in:
@ -225,12 +225,21 @@ const breadcrumbs = computed<Breadcrumb[]>(() => {
|
|||||||
function resolveLabel(name: string): string {
|
function resolveLabel(name: string): string {
|
||||||
return resolveBreadcrumbLabel(
|
return resolveBreadcrumbLabel(
|
||||||
name,
|
name,
|
||||||
(key) => breadcrumbData.getName(key),
|
(key) => breadcrumbData.getName(key) || fallbackDynamicLabel(key),
|
||||||
staticLabels,
|
staticLabels,
|
||||||
(message) => formatMessage(message),
|
(message) => formatMessage(message),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 动态面包屑(?Xxx)在页面异步 setName 之前,回退到静态标签,避免图标与文字不同步
|
||||||
|
function fallbackDynamicLabel(key: string): string {
|
||||||
|
const fallback: Record<string, keyof typeof staticLabels> = {
|
||||||
|
BrowseTitle: 'Discover content',
|
||||||
|
}
|
||||||
|
const staticKey = fallback[key]
|
||||||
|
return staticKey ? formatMessage(staticLabels[staticKey]) : ''
|
||||||
|
}
|
||||||
|
|
||||||
function resolveIcon(breadcrumb: Breadcrumb): Component | undefined {
|
function resolveIcon(breadcrumb: Breadcrumb): Component | undefined {
|
||||||
if (breadcrumb.iconUrl || breadcrumbData.getIcon(breadcrumb.name.slice(1))) return undefined
|
if (breadcrumb.iconUrl || breadcrumbData.getIcon(breadcrumb.name.slice(1))) return undefined
|
||||||
const dynamicIcons: Record<string, Component> = {
|
const dynamicIcons: Record<string, Component> = {
|
||||||
|
|||||||
13
tools/icon_work/chk_alpha.py
Normal file
13
tools/icon_work/chk_alpha.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from PIL import Image
|
||||||
|
im = Image.open(r"C:\Users\28579\Downloads\resources\resources\netherstar.png")
|
||||||
|
print("模式:", im.mode)
|
||||||
|
print("尺寸:", im.size)
|
||||||
|
print("有 alpha:", im.mode in ("RGBA", "LA"))
|
||||||
|
if im.mode in ("RGBA", "LA"):
|
||||||
|
a = im.getchannel("A")
|
||||||
|
print("alpha bbox:", a.getbbox())
|
||||||
|
print("alpha 范围:", a.getextrema())
|
||||||
|
# 采样角落像素,看是不是白/透明
|
||||||
|
w, h = im.size
|
||||||
|
print("左上角:", im.getpixel((0, 0)))
|
||||||
|
print("中心:", im.getpixel((w // 2, h // 2)))
|
||||||
33
tools/icon_work/fix_bc_label.py
Normal file
33
tools/icon_work/fix_bc_label.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\ui\Breadcrumbs.vue"
|
||||||
|
t = open(p, encoding="utf-8").read()
|
||||||
|
|
||||||
|
old = """function resolveLabel(name: string): string {
|
||||||
|
return resolveBreadcrumbLabel(
|
||||||
|
name,
|
||||||
|
(key) => breadcrumbData.getName(key),
|
||||||
|
staticLabels,
|
||||||
|
(message) => formatMessage(message),
|
||||||
|
)
|
||||||
|
}"""
|
||||||
|
new = """function resolveLabel(name: string): string {
|
||||||
|
return resolveBreadcrumbLabel(
|
||||||
|
name,
|
||||||
|
(key) => breadcrumbData.getName(key) || fallbackDynamicLabel(key),
|
||||||
|
staticLabels,
|
||||||
|
(message) => formatMessage(message),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 动态面包屑(?Xxx)在页面异步 setName 之前,回退到静态标签,避免图标与文字不同步
|
||||||
|
function fallbackDynamicLabel(key: string): string {
|
||||||
|
const fallback: Record<string, keyof typeof staticLabels> = {
|
||||||
|
BrowseTitle: 'Discover content',
|
||||||
|
}
|
||||||
|
const staticKey = fallback[key]
|
||||||
|
return staticKey ? formatMessage(staticLabels[staticKey]) : ''
|
||||||
|
}"""
|
||||||
|
|
||||||
|
assert old in t, "resolveLabel 找不到"
|
||||||
|
t = t.replace(old, new, 1)
|
||||||
|
open(p, "w", encoding="utf-8", newline="\n").write(t)
|
||||||
|
print("done")
|
||||||
32
tools/icon_work/fix_star_png.py
Normal file
32
tools/icon_work/fix_star_png.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
from PIL import Image
|
||||||
|
import numpy as np
|
||||||
|
from scipy import ndimage
|
||||||
|
|
||||||
|
src = r"C:\Users\28579\Downloads\resources\resources\netherstar.png"
|
||||||
|
dst = r"D:\Project\Starlight_Lancher\apps\app-frontend\public\models\netherstar.png"
|
||||||
|
|
||||||
|
im = Image.open(src).convert("RGBA")
|
||||||
|
arr = np.array(im, dtype=np.float32)
|
||||||
|
r, g, b, a = arr[..., 0], arr[..., 1], arr[..., 2], arr[..., 3]
|
||||||
|
|
||||||
|
# 1) 完全不透明像素的位置
|
||||||
|
opaque = a >= 254
|
||||||
|
# 2) 对每个通道,用最近的不透明像素值填充(距离变换的索引)
|
||||||
|
# 用一个临时:在 opaque 区域保留原 RGB,其余待填
|
||||||
|
h, w = a.shape
|
||||||
|
# 用 scipy 的 distance_transform_edt 拿到"最近的 opaque 像素索引"
|
||||||
|
indices = ndimage.distance_transform_edt(~opaque, return_distances=False, return_indices=True)
|
||||||
|
nearest_rgb = arr[indices[0], indices[1], :3]
|
||||||
|
|
||||||
|
# 3) 半透明区域(a < 254 且 a > 0)的 RGB 换成最近不透明像素颜色
|
||||||
|
semi = (a > 0) & (a < 254)
|
||||||
|
out = arr.copy()
|
||||||
|
out[semi, 0:3] = nearest_rgb[semi]
|
||||||
|
|
||||||
|
# 4) 可选:收紧极小 alpha(<8 直接透明),减少杂边
|
||||||
|
out[a < 8, 3] = 0
|
||||||
|
|
||||||
|
out_img = Image.fromarray(np.clip(out, 0, 255).astype(np.uint8), "RGBA")
|
||||||
|
out_img.save(dst)
|
||||||
|
print("done ->", dst)
|
||||||
|
print("尺寸:", out_img.size)
|
||||||
29
tools/icon_work/inspect_star.py
Normal file
29
tools/icon_work/inspect_star.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from PIL import Image
|
||||||
|
im = Image.open(r"C:\Users\28579\Downloads\resources\resources\netherstar.png").convert("RGBA")
|
||||||
|
w, h = im.size
|
||||||
|
# 找 alpha 从 0 到 255 的过渡带,看这些像素的 RGB
|
||||||
|
print("=== 半透明白色像素采样 ===")
|
||||||
|
cnt = 0
|
||||||
|
for y in range(0, h, 5):
|
||||||
|
for x in range(0, w, 5):
|
||||||
|
r, g, b, a = im.getpixel((x, y))
|
||||||
|
if 0 < a < 255 and r > 240 and g > 240 and b > 240:
|
||||||
|
print(f"({x},{y}) RGBA=({r},{g},{b},{a})")
|
||||||
|
cnt += 1
|
||||||
|
if cnt >= 10:
|
||||||
|
break
|
||||||
|
if cnt >= 10:
|
||||||
|
break
|
||||||
|
# 对比:全不透明像素的 RGB
|
||||||
|
print("\n=== 不透明像素采样 ===")
|
||||||
|
cnt = 0
|
||||||
|
for y in range(0, h, 5):
|
||||||
|
for x in range(0, w, 5):
|
||||||
|
r, g, b, a = im.getpixel((x, y))
|
||||||
|
if a == 255:
|
||||||
|
print(f"({x},{y}) RGBA=({r},{g},{b},{a})")
|
||||||
|
cnt += 1
|
||||||
|
if cnt >= 5:
|
||||||
|
break
|
||||||
|
if cnt >= 5:
|
||||||
|
break
|
||||||
19
tools/icon_work/sample_edge.py
Normal file
19
tools/icon_work/sample_edge.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from PIL import Image
|
||||||
|
im = Image.open(r"C:\Users\28579\Downloads\resources\resources\netherstar.png").convert("RGBA")
|
||||||
|
w, h = im.size
|
||||||
|
print("尺寸:", (w, h))
|
||||||
|
# 采样边缘一圈(alpha 低但 RGB 接近白的像素 = "脏"边缘)
|
||||||
|
dirty = 0
|
||||||
|
total_edge = 0
|
||||||
|
for y in range(0, h, 3):
|
||||||
|
for x in range(0, w, 3):
|
||||||
|
r, g, b, a = im.getpixel((x, y))
|
||||||
|
if 0 < a < 255:
|
||||||
|
total_edge += 1
|
||||||
|
# alpha 半透明,但 RGB 很亮(接近白)—— 这就是"没剔干净"的迹象
|
||||||
|
if r > 240 and g > 240 and b > 240:
|
||||||
|
dirty += 1
|
||||||
|
print("半透明像素总数:", total_edge)
|
||||||
|
print("半透明中 RGB 接近白的(脏边缘):", dirty)
|
||||||
|
if total_edge:
|
||||||
|
print("脏边比例: {:.1f}%".format(dirty / total_edge * 100))
|
||||||
Reference in New Issue
Block a user