Add height mode option to advanced settings

This commit is contained in:
kwaroran
2024-03-21 03:32:43 +09:00
parent 495dd64eb7
commit 82e5e48ae3
4 changed files with 39 additions and 2 deletions

View File

@@ -475,6 +475,7 @@ export async function loadData() {
updateColorScheme()
updateTextTheme()
updateAnimationSpeed()
updateHeightMode()
if(db.botSettingAtStart){
botMakerMode.set(true)
}
@@ -1571,4 +1572,29 @@ export function trimNonLatin(data:string){
return data .replace(/[^\x00-\x7F]/g, "")
.replace(/ +/g, ' ')
.trim()
}
export function updateHeightMode(){
const db = get(DataBase)
const root = document.querySelector(':root') as HTMLElement;
switch(db.heightMode){
case 'auto':
root.style.setProperty('--risu-height-size', '100%');
break
case 'vh':
root.style.setProperty('--risu-height-size', '100vh');
break
case 'dvh':
root.style.setProperty('--risu-height-size', '100dvh');
break
case 'lvh':
root.style.setProperty('--risu-height-size', '100lvh');
break
case 'svh':
root.style.setProperty('--risu-height-size', '100svh');
break
case 'percent':
root.style.setProperty('--risu-height-size', '100%');
break
}
}