From afb1ff30aa266cb5326bc0451237e9ee89ec454f Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 26 Nov 2026 20:00:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=84=E4=BB=B6=E5=9C=A8=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=BC=96=E5=86=99=E4=B8=AD=E5=8F=91=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client-base/src/components/icon.tsx | 2 +- .../src/components/listSelector.tsx | 20 +++++++++++-------- .../client-base/src/components/textbox.tsx | 16 +++++++++++---- .../client-base/src/components/thumbnail.tsx | 4 ++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/packages-user/client-base/src/components/icon.tsx b/packages-user/client-base/src/components/icon.tsx index d036272..55da835 100644 --- a/packages-user/client-base/src/components/icon.tsx +++ b/packages-user/client-base/src/components/icon.tsx @@ -50,7 +50,7 @@ export const Icon = defineComponent(props => { }); /** 当不播放图块动画时,静态使用的贴图 */ const staticImage = computed(() => { - if (!animate.value || !data.value) return null; + if (animate.value || !data.value) return null; const frame = props.frame ?? data.value.defaultFrame; const o = data.value.offset * frame; const tex = data.value.texture; diff --git a/packages-user/client-base/src/components/listSelector.tsx b/packages-user/client-base/src/components/listSelector.tsx index 9e2e6fd..e026e93 100644 --- a/packages-user/client-base/src/components/listSelector.tsx +++ b/packages-user/client-base/src/components/listSelector.tsx @@ -73,8 +73,10 @@ export const ListSelector = defineComponent< } }); /** 当前选中项的信息 */ - const current = computed( - () => list.value[list.value.length - now.value - 1] + const current = computed(() => + props.reverse + ? list.value[list.value.length - now.value - 1] + : list.value[now.value] ); /** 每行的行高 */ const lh = computed(() => props.interval ?? 24); @@ -137,7 +139,7 @@ export const ListSelector = defineComponent< /** 切换至指定选择项 */ const changeTo = (index: number, time: number = 500) => { const res = clamp(index, 0, list.value.length - 1); - const reversed = list.value.length - res - 1; + const reversed = props.reverse ? list.value.length - res - 1 : res; now.value = res; selList.value = reversed; const y = reversed * lh.value; @@ -164,9 +166,11 @@ export const ListSelector = defineComponent< padEnd={height.value / 2 - lh.value / 2} > {list.value.map(([, title], i, a) => { - const reversed = a.length - i - 1; - const nowFloor = a.length - now.value - 1; - const highlight = nowFloor === i || selList.value === i; + const reversed = props.reverse ? a.length - i - 1 : i; + const nowItem = props.reverse + ? a.length - now.value - 1 + : now.value; + const highlight = nowItem === i || selList.value === i; const color = highlight ? '#fff' : '#aaa'; const fill = highlight ? '#fff' : '#000'; const y = (i - 0.5) * lh.value + height.value / 2; @@ -175,7 +179,7 @@ export const ListSelector = defineComponent< nocache loc={[0, y, width.value, lh.value]} onEnter={() => enterList(i)} - onLeave={() => enterList(nowFloor)} + onLeave={() => enterList(nowItem)} onClick={() => changeTo(reversed)} > ); diff --git a/packages-user/client-base/src/components/textbox.tsx b/packages-user/client-base/src/components/textbox.tsx index 3f4028c..efcb631 100644 --- a/packages-user/client-base/src/components/textbox.tsx +++ b/packages-user/client-base/src/components/textbox.tsx @@ -315,6 +315,7 @@ const textboxOptions = { 'titleStroke', 'titlePadding', 'materials', + 'typer', 'icon', 'loc', 'x', @@ -330,6 +331,13 @@ export const Textbox = defineComponent< TextboxEmits, keyof TextboxEmits >((props, { expose, emit }) => { + const defaultMaterials = inject( + '@default/materials', + null + ); + /** 使用的贴图管理器 */ + const materials = computed(() => props.materials ?? defaultMaterials); + /** 是否包含标题 */ const hasTitle = computed(() => !isNil(props.title)); /** 标题内边距 */ @@ -358,7 +366,7 @@ export const Textbox = defineComponent< /** 图标信息 */ const iconData = computed(() => { const icon = props.icon; - const material = props.materials; + const material = materials.value; if (isNil(icon) || !material) return null; const data = material.tile(icon); return data; @@ -428,7 +436,7 @@ export const Textbox = defineComponent< color={props.backColor} border={props.strokeColor} circle={[0]} - materials={props.materials} + materials={materials.value ?? void 0} loc={[0, 0, tw.value, th.value]} /> @@ -455,7 +463,7 @@ export const Textbox = defineComponent< hidden={!!iconData.value} icon={props.icon} loc={iconLoc.value} - materials={props.materials} + materials={materials.value ?? void 0} animate /> (props => { floorId={props.floorId} size={size.value} damage={props.damage} - zIndex={10} + zIndex={0} /> ))}