fix: 字体大小

This commit is contained in:
unanmed 2024-03-04 20:04:08 +08:00
parent 37840ba0b0
commit 3d61d87e6c
5 changed files with 31 additions and 22 deletions

View File

@ -1326,7 +1326,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
filterMap.push(
[
['sample0', 'sample1', 'sample2'], // 楼层列表
'brightness(120%)' // 滤镜内容
'brightness(80%)' // 滤镜内容
],
[['MT0'], 'contrast(120%)']
);

View File

@ -119,7 +119,7 @@ export class MotaSetting extends EventEmitter<SettingEvent> {
* @param key
* @param value
*/
setValue(key: string, value: boolean | number) {
setValue(key: string, value: boolean | number, noEmit: boolean = false) {
const setting = this.getSettingBy(key.split('.'));
if (typeof setting.value !== typeof value) {
throw new Error(
@ -130,7 +130,7 @@ export class MotaSetting extends EventEmitter<SettingEvent> {
const old = setting.value as boolean | number;
setting.value = value;
this.emit('valueChange', key, value, old);
if (!noEmit) this.emit('valueChange', key, value, old);
}
/**
@ -348,8 +348,22 @@ function handleScreenSetting<T extends number | boolean>(
o: T
) {
if (key === 'fullscreen') {
const fontSize = mainSetting.getValue('screen.fontSize', 16);
const beforeIsMobile = isMobile;
// 全屏
triggerFullscreen(n as boolean);
triggerFullscreen(n as boolean).then(() => {
if (beforeIsMobile) {
mainSetting.setValue(
'screen.fontSize',
Math.floor((fontSize * 2) / 3)
);
} else if (isMobile) {
mainSetting.setValue(
'screen.fontSize',
Math.floor((fontSize * 3) / 2)
);
}
});
} else if (key === 'heroDetail') {
// 勇士显伤
core.drawHero();
@ -497,3 +511,11 @@ mainSetting
.setDescription('audio.soundEnabled', `是否开启音效`)
.setDescription('audio.soundVolume', `音效的音量`)
.setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`);
Mota.requireAll('var').hook.once('mounted', () => {
if (storage.getValue('@@exitFromFullscreen', false)) {
const fontSize = mainSetting.getValue('screen.fontSize', 16);
mainSetting.setValue('screen.fontSize', Math.round((fontSize * 3) / 2));
}
storage.setValue('@@exitFromFullscreen', !!document.fullscreenElement);
});

View File

@ -10,6 +10,7 @@ import { parseColor } from './webgl/utils';
import { Keyboard, KeyboardEmits } from '@/core/main/custom/keyboard';
import { mainUi } from '@/core/main/init/ui';
import { isAssist } from '@/core/main/custom/hotkey';
import { mainSetting, settingStorage } from '@/core/main/setting';
type CanParseCss = keyof {
[P in keyof CSSStyleDeclaration as CSSStyleDeclaration[P] extends string
@ -284,6 +285,8 @@ export async function triggerFullscreen(full: boolean) {
maxGameScale();
});
}
mainSetting.setValue('screen.fullscreen', full, true);
settingStorage.setValue('@@exitFromFullscreen', full);
}
/**

View File

@ -697,12 +697,7 @@ onUnmounted(() => {
}
@media screen and (max-width: 600px) {
#equipbox {
padding: 5%;
}
#equipbox-main {
height: 90vh;
flex-direction: column-reverse;
font-size: 100%;
}
@ -717,7 +712,7 @@ onUnmounted(() => {
}
#equip-list {
flex-basis: 30%;
flex-basis: 45%;
#filter #sort-type {
font-size: 150%;

View File

@ -387,22 +387,11 @@ onUnmounted(() => {
}
@media screen and (max-width: 600px) {
#toolbox {
padding: 5%;
}
#tools {
transform: translateY(-50%);
span {
margin: 0;
}
}
#toolbox-main {
flex-direction: column-reverse;
height: 90%;
font-size: 100%;
margin-top: 20%;
margin-top: 10%;
}
.item-list {