From 5379dc99e6c543f78297b3e1478a41b28cc506a9 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 6 Jan 2023 23:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E7=82=B9=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/fixedDetail.vue | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ui/fixedDetail.vue b/src/ui/fixedDetail.vue index 3a2b8d1..eb507f6 100644 --- a/src/ui/fixedDetail.vue +++ b/src/ui/fixedDetail.vue @@ -11,20 +11,21 @@ import BookDetail from './bookDetail.vue'; core.plugin.bookDetailPos = 0; -function close() { - core.plugin.fixedDetailOpened.value = false; -} - -onMounted(() => { - const [x, y] = flags.mouseLoc; - const mx = Math.round(x + core.bigmap.offsetX / 32); - const my = Math.round(y + core.bigmap.offsetY / 32); - const e = core.getBlockId(mx, my); - if (!e || !core.getClsFromId(e)?.startsWith('enemy')) return; +const [x, y] = flags.mouseLoc; +const mx = Math.round(x + core.bigmap.offsetX / 32); +const my = Math.round(y + core.bigmap.offsetY / 32); +const e = core.getBlockId(mx, my); +if (e && core.getClsFromId(e)?.startsWith('enemy')) { const enemy = core.material.enemys[e as EnemyIds]; const detail = getDetailedEnemy(enemy, mx, my); core.plugin.bookDetailEnemy = detail; -}); +} else { + close(); +} + +function close() { + core.plugin.fixedDetailOpened.value = false; +}