fix: 能量进度条满问题

This commit is contained in:
bietiaop 2024-07-08 13:55:06 +08:00
parent 1c65f10e24
commit ac96925c70
3 changed files with 6 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
*.css.map
config/**/*.*
!config/.gitkeep
.DS_Store

View file

@ -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属性

View file

@ -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);
}
}