mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-08-28 13:53:56 +08:00
fix: 楼层选择组件交互错误
This commit is contained in:
parent
51166b1041
commit
3ce270e7e6
@ -43,7 +43,9 @@ export const FloorSelector = defineComponent<
|
|||||||
>((props, { emit }) => {
|
>((props, { emit }) => {
|
||||||
const listFont = new Font(Font.defaultFamily, 12);
|
const listFont = new Font(Font.defaultFamily, 12);
|
||||||
|
|
||||||
|
/** 当前选中楼层,不反向 */
|
||||||
const now = ref(props.now ?? 0);
|
const now = ref(props.now ?? 0);
|
||||||
|
/** 当前鼠标选中楼层,反向 */
|
||||||
const selList = ref(0);
|
const selList = ref(0);
|
||||||
|
|
||||||
const scrollRef = ref<ScrollExpose>();
|
const scrollRef = ref<ScrollExpose>();
|
||||||
@ -85,7 +87,7 @@ export const FloorSelector = defineComponent<
|
|||||||
const res = clamp(index, 0, floors.value.length - 1);
|
const res = clamp(index, 0, floors.value.length - 1);
|
||||||
const reversed = floors.value.length - res - 1;
|
const reversed = floors.value.length - res - 1;
|
||||||
now.value = res;
|
now.value = res;
|
||||||
selList.value = res;
|
selList.value = reversed;
|
||||||
const y = reversed * 24;
|
const y = reversed * 24;
|
||||||
scrollRef.value?.scrollTo(y, time);
|
scrollRef.value?.scrollTo(y, time);
|
||||||
emit('update', now.value, floorId.value);
|
emit('update', now.value, floorId.value);
|
||||||
@ -158,9 +160,9 @@ export const FloorSelector = defineComponent<
|
|||||||
>
|
>
|
||||||
{floors.value.map((v, i, a) => {
|
{floors.value.map((v, i, a) => {
|
||||||
const floor = core.floors[v];
|
const floor = core.floors[v];
|
||||||
|
const reversed = a.length - i - 1;
|
||||||
const nowFloor = a.length - now.value - 1;
|
const nowFloor = a.length - now.value - 1;
|
||||||
const sel = a.length - selList.value - 1;
|
const highlight = nowFloor === i || selList.value === i;
|
||||||
const highlight = nowFloor === i || sel === i;
|
|
||||||
const color = highlight ? '#fff' : '#aaa';
|
const color = highlight ? '#fff' : '#aaa';
|
||||||
const fill = highlight ? '#fff' : '#000';
|
const fill = highlight ? '#fff' : '#000';
|
||||||
return (
|
return (
|
||||||
@ -177,8 +179,8 @@ export const FloorSelector = defineComponent<
|
|||||||
font={listFont}
|
font={listFont}
|
||||||
fillStyle={color}
|
fillStyle={color}
|
||||||
onEnter={() => enterList(i)}
|
onEnter={() => enterList(i)}
|
||||||
onLeave={() => enterList(now.value)}
|
onLeave={() => enterList(nowFloor)}
|
||||||
onClick={() => changeTo(i)}
|
onClick={() => changeTo(reversed)}
|
||||||
/>
|
/>
|
||||||
<g-circle
|
<g-circle
|
||||||
stroke
|
stroke
|
||||||
|
Loading…
Reference in New Issue
Block a user