From 17d46fa15828e549ec39144fb76ff29962a9a4d9 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Tue, 23 Apr 2024 22:03:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=BC=B9=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/main/custom/danmaku.ts | 20 +++++++++----------- src/ui/danmaku.vue | 7 ++++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/core/main/custom/danmaku.ts b/src/core/main/custom/danmaku.ts index 3cb67c3..6355da2 100644 --- a/src/core/main/custom/danmaku.ts +++ b/src/core/main/custom/danmaku.ts @@ -2,7 +2,13 @@ import BoxAnimate from '@/components/boxAnimate.vue'; import { EmitableEvent, EventEmitter } from '@/core/common/eventEmitter'; import { logger } from '@/core/common/logger'; import { ResponseBase } from '@/core/interface'; -import { deleteWith, ensureArray, parseCss, tip } from '@/plugin/utils'; +import { + deleteWith, + ensureArray, + getIconHeight, + parseCss, + tip +} from '@/plugin/utils'; import axios, { AxiosResponse, toFormData } from 'axios'; import { Component, VNode, h, shallowReactive } from 'vue'; /* @__PURE__ */ import { id, password } from '../../../../user'; @@ -484,22 +490,14 @@ export class Danmaku extends EventEmitter { // 图标类型 Danmaku.registerSpecContent('i', content => { - const iconInfo = core.getBlockInfo(content as AllIds); - if (!iconInfo) { - return h(BoxAnimate as Component, { - id: 'greenSlime', - noborder: true, - width: 32, - height: 32 - }); - } + const height = getIconHeight(content as AllIds); return h(BoxAnimate as Component, { id: content, noborder: true, noAnimate: true, width: 32, - height: iconInfo.height + height }); }); diff --git a/src/ui/danmaku.vue b/src/ui/danmaku.vue index 3196d9d..1549fef 100644 --- a/src/ui/danmaku.vue +++ b/src/ui/danmaku.vue @@ -97,7 +97,7 @@ ticker.add(time => { if (!hover) { const dx = dt * speed; value.pos -= dx; - ele.style.left = `${value.pos.toFixed(2)}px`; + ele.style.transform = `translateX(${value.pos.toFixed(2)}px)`; } if (value.pos + width < 0) { @@ -134,7 +134,7 @@ function touchStart(id: number) { function calTop(id: number) { const danmaku = eleMap.get(id)!; - const fontSize = mainSetting.getValue('screen.fontSize', 16) * 1.25 + 10; + const fontSize = mainSetting.getValue('screen.fontSize', 16) * 1.25 + 15; const used: Set = new Set(); eleMap.forEach(v => { @@ -177,7 +177,8 @@ onUnmounted(() => { .danmaku-one { position: fixed; - left: 100vw; + left: 0; + transform: translateX(100vw); width: max-content; white-space: nowrap; text-wrap: nowrap;