From ac96925c70bc9d1e6764066e263eb05e3a823b89 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Mon, 8 Jul 2024 13:55:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=83=BD=E9=87=8F=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1=E6=BB=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ lib/render.js | 2 +- model/note.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 66cfa01..7d90528 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.css.map config/**/*.* !config/.gitkeep + +.DS_Store + diff --git a/lib/render.js b/lib/render.js index 354eed8..fdcfe06 100644 --- a/lib/render.js +++ b/lib/render.js @@ -20,7 +20,7 @@ function render(e, renderPath, renderData = {}, cfg = {}) { // 获取渲染精度配置 const scaleCfg = setting.getConfig('config')?.render?.scale || 100; // 计算配置缩放比例 - const scaleCfgValue = Math.min(2, Math.max(0.5, scaleCfg / 100)); + const scaleCfgValue = Math.min(2, Math.max(0.5, scaleCfg / 100)) * 2; // 将函数参数中的缩放比例与配置缩放比例相乘 const scale = (cfg?.scale || 1) * scaleCfgValue; // 将缩放比例转换为style属性 diff --git a/model/note.js b/model/note.js index 8e27ebc..6fafdb0 100644 --- a/model/note.js +++ b/model/note.js @@ -52,6 +52,7 @@ export class EnergyProgress { constructor(max, current) { this.max = max; this.current = current; + this.percent = parseInt((Number(current) / Number(max)) * 100); } } @@ -64,11 +65,10 @@ export class Energy { * @param {number} restore */ constructor(progress, restore) { - this.progress = progress; + this.progress = new EnergyProgress(progress.max, progress.current); this.restore = restore; const leftHM = converSecondsToHM(restore); this.progress.rest = `${leftHM[0]}小时${leftHM[1]}分钟`; - this.percent = parseInt((progress.current / progress.max) * 100); } }