fix aspect ratio and cropping on small screens
All checks were successful
Android Build / publish (push) Successful in 33s
Linux Build / publish (push) Successful in 55s

This commit is contained in:
olcxja 2026-06-24 00:11:37 +02:00
commit 19c3dbb42d
4 changed files with 90 additions and 80 deletions

View file

@ -1452,14 +1452,6 @@ function logout() {
window.location.href = "login/index.html"; window.location.href = "login/index.html";
} }
function gotoSettings() {
if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show");
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
setActiveSidebarIndicator(currentMainIndicator);
}
}
let isProfileOpen = false; let isProfileOpen = false;
async function openProfile(accountId) { async function openProfile(accountId) {
@ -2863,7 +2855,7 @@ async function gotoSettings(tab = 'account') {
function switchSettingsTab(tabName) { function switchSettingsTab(tabName) {
setActiveRoombarItem('tab-settings-' + tabName); setActiveRoombarItem('tab-settings-' + tabName);
if (tabName === 'account') { if (tabName === 'account') {
switchRoomContent("title.account", accountSettings, false); switchRoomContent("title.account", accountSettings, false, null, true); //skip mobile slide
} else if (tabName === 'profile') { } else if (tabName === 'profile') {
switchRoomContent("title.profile", profileSettings, false); switchRoomContent("title.profile", profileSettings, false);
setTimeout(async () => { setTimeout(async () => {
@ -3037,8 +3029,13 @@ function initCropper() {
let targetWidth = cropperType === 'avatar' ? 512 : 494; let targetWidth = cropperType === 'avatar' ? 512 : 494;
let targetHeight = cropperType === 'avatar' ? targetWidth : 200; let targetHeight = cropperType === 'avatar' ? targetWidth : 200;
container.style.height = 'auto';
container.style.maxHeight = 'calc(85vh - 16rem)';
container.style.aspectRatio = `${targetWidth} / ${targetHeight}`;
// Force layout recalculation
void container.offsetHeight;
let containerWidth = container.clientWidth || 300; let containerWidth = container.clientWidth || 300;
container.style.height = (containerWidth * (targetHeight / targetWidth)) + 'px';
let imgWidth = cropperImageObj.width; let imgWidth = cropperImageObj.width;
let imgHeight = cropperImageObj.height; let imgHeight = cropperImageObj.height;

View file

@ -813,15 +813,15 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-popup-content { .profile-popup-content {
position: relative; position: relative;
width: 31em; width: 90vw;
max-width: 31rem;
height: 85vh; height: 85vh;
max-height: 44em; max-height: 44rem;
font-size: min(1rem, calc(90vw / 31));
background: var(--main-bg-color); background: var(--main-bg-color);
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
border-radius: 0.9em; border-radius: 0.9rem;
overflow: hidden; overflow: hidden;
box-shadow: 0 1em 3em rgba(0, 0, 0, 0.5); box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
opacity: 0; opacity: 0;
transform: scale(0.6); transform: scale(0.6);
transition: all 0.2s ease; transition: all 0.2s ease;
@ -835,16 +835,16 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-popup-close-btn { .profile-popup-close-btn {
position: absolute; position: absolute;
top: 1em; top: 1rem;
right: 1em; right: 1rem;
z-index: 10; z-index: 10;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(0.25em); backdrop-filter: blur(0.25rem);
-webkit-backdrop-filter: blur(0.25em); -webkit-backdrop-filter: blur(0.25rem);
border: none; border: none;
width: 2.5em; width: 2.5rem;
height: 2.5em; height: 2.5rem;
border-radius: 0.8em; border-radius: 0.8rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -853,8 +853,8 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
cursor: pointer; cursor: pointer;
} }
.profile-popup-close-btn svg { .profile-popup-close-btn svg {
width: 1.5em; width: 1.5rem;
height: 1.5em; height: 1.5rem;
} }
.profile-popup-close-btn:hover { .profile-popup-close-btn:hover {
background: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2);
@ -875,55 +875,63 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-avatar-container { .profile-avatar-container {
position: relative; position: relative;
margin-top: -3.75em; margin-top: calc(-3.75 / 31 * 100%);
margin-left: 2em; margin-left: calc(2 / 31 * 100%);
width: 7.5em; width: calc(7.5 / 31 * 100%);
height: 7.5em; flex-shrink: 0;
}
.profile-avatar-container::before {
content: "";
display: block;
padding-top: 100%;
} }
.profile-avatar { .profile-avatar {
position: absolute;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 0.8em; border-radius: 0.8rem;
border: var(--border-width) solid rgba(255, 255, 255, 0.2); border: var(--border-width) solid rgba(255, 255, 255, 0.2);
object-fit: cover; object-fit: cover;
background: var(--main-bg-color); background: var(--main-bg-color);
} }
.profile-info { .profile-info {
padding: 1em 2em 2em 2em; padding: 1rem 2rem 2rem 2rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1em; gap: 1rem;
} }
.profile-name { .profile-name {
font-size: 2em; font-size: 2rem;
font-weight: 800; font-weight: 800;
line-height: 1.1; line-height: 1.1;
margin-bottom: 0.2em; margin-bottom: 0.2rem;
word-break: break-word; word-break: break-word;
} }
.profile-id-host { .profile-id-host {
font-size: 1em; font-size: 1rem;
opacity: 0.6; opacity: 0.6;
font-weight: 600; font-weight: 600;
} }
.profile-bio { .profile-bio {
font-size: 1.05em; font-size: 1.05rem;
line-height: 1.5; line-height: 1.5;
white-space: pre-wrap; white-space: pre-wrap;
background: rgba(255, 255, 255, 0.03); background: rgba(255, 255, 255, 0.03);
padding: 1em; padding: 1rem;
border-radius: 0.8em; border-radius: 0.8rem;
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
word-break: break-word; word-break: break-word;
} }
.profile-action-btn { .profile-action-btn {
align-self: flex-start; align-self: flex-start;
padding: 0.6em 1.5em; padding: 0.6rem 1.5rem;
font-weight: 700; font-weight: 700;
background: var(--text-color); background: var(--text-color);
color: var(--main-bg-color); color: var(--main-bg-color);
border-radius: 0.8em; border-radius: 0.8rem;
margin-top: 0.5em; margin-top: 0.5rem;
margin-left: 0; margin-left: 0;
height: auto; height: auto;
} }

View file

@ -1452,14 +1452,6 @@ function logout() {
window.location.href = "login/index.html"; window.location.href = "login/index.html";
} }
function gotoSettings() {
if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show");
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
setActiveSidebarIndicator(currentMainIndicator);
}
}
let isProfileOpen = false; let isProfileOpen = false;
async function openProfile(accountId) { async function openProfile(accountId) {
@ -2863,7 +2855,7 @@ async function gotoSettings(tab = 'account') {
function switchSettingsTab(tabName) { function switchSettingsTab(tabName) {
setActiveRoombarItem('tab-settings-' + tabName); setActiveRoombarItem('tab-settings-' + tabName);
if (tabName === 'account') { if (tabName === 'account') {
switchRoomContent("title.account", accountSettings, false); switchRoomContent("title.account", accountSettings, false, null, true); //skip mobile slide
} else if (tabName === 'profile') { } else if (tabName === 'profile') {
switchRoomContent("title.profile", profileSettings, false); switchRoomContent("title.profile", profileSettings, false);
setTimeout(async () => { setTimeout(async () => {
@ -3037,8 +3029,13 @@ function initCropper() {
let targetWidth = cropperType === 'avatar' ? 512 : 494; let targetWidth = cropperType === 'avatar' ? 512 : 494;
let targetHeight = cropperType === 'avatar' ? targetWidth : 200; let targetHeight = cropperType === 'avatar' ? targetWidth : 200;
container.style.height = 'auto';
container.style.maxHeight = 'calc(85vh - 16rem)';
container.style.aspectRatio = `${targetWidth} / ${targetHeight}`;
// Force layout recalculation
void container.offsetHeight;
let containerWidth = container.clientWidth || 300; let containerWidth = container.clientWidth || 300;
container.style.height = (containerWidth * (targetHeight / targetWidth)) + 'px';
let imgWidth = cropperImageObj.width; let imgWidth = cropperImageObj.width;
let imgHeight = cropperImageObj.height; let imgHeight = cropperImageObj.height;

View file

@ -813,15 +813,15 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-popup-content { .profile-popup-content {
position: relative; position: relative;
width: 31em; width: 90vw;
max-width: 31rem;
height: 85vh; height: 85vh;
max-height: 44em; max-height: 44rem;
font-size: min(1rem, calc(90vw / 31));
background: var(--main-bg-color); background: var(--main-bg-color);
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
border-radius: 0.9em; border-radius: 0.9rem;
overflow: hidden; overflow: hidden;
box-shadow: 0 1em 3em rgba(0, 0, 0, 0.5); box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
opacity: 0; opacity: 0;
transform: scale(0.6); transform: scale(0.6);
transition: all 0.2s ease; transition: all 0.2s ease;
@ -835,16 +835,16 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-popup-close-btn { .profile-popup-close-btn {
position: absolute; position: absolute;
top: 1em; top: 1rem;
right: 1em; right: 1rem;
z-index: 10; z-index: 10;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(0.25em); backdrop-filter: blur(0.25rem);
-webkit-backdrop-filter: blur(0.25em); -webkit-backdrop-filter: blur(0.25rem);
border: none; border: none;
width: 2.5em; width: 2.5rem;
height: 2.5em; height: 2.5rem;
border-radius: 0.8em; border-radius: 0.8rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -853,8 +853,8 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
cursor: pointer; cursor: pointer;
} }
.profile-popup-close-btn svg { .profile-popup-close-btn svg {
width: 1.5em; width: 1.5rem;
height: 1.5em; height: 1.5rem;
} }
.profile-popup-close-btn:hover { .profile-popup-close-btn:hover {
background: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2);
@ -875,55 +875,63 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
} }
.profile-avatar-container { .profile-avatar-container {
position: relative; position: relative;
margin-top: -3.75em; margin-top: calc(-3.75 / 31 * 100%);
margin-left: 2em; margin-left: calc(2 / 31 * 100%);
width: 7.5em; width: calc(7.5 / 31 * 100%);
height: 7.5em; flex-shrink: 0;
}
.profile-avatar-container::before {
content: "";
display: block;
padding-top: 100%;
} }
.profile-avatar { .profile-avatar {
position: absolute;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 0.8em; border-radius: 0.8rem;
border: var(--border-width) solid rgba(255, 255, 255, 0.2); border: var(--border-width) solid rgba(255, 255, 255, 0.2);
object-fit: cover; object-fit: cover;
background: var(--main-bg-color); background: var(--main-bg-color);
} }
.profile-info { .profile-info {
padding: 1em 2em 2em 2em; padding: 1rem 2rem 2rem 2rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1em; gap: 1rem;
} }
.profile-name { .profile-name {
font-size: 2em; font-size: 2rem;
font-weight: 800; font-weight: 800;
line-height: 1.1; line-height: 1.1;
margin-bottom: 0.2em; margin-bottom: 0.2rem;
word-break: break-word; word-break: break-word;
} }
.profile-id-host { .profile-id-host {
font-size: 1em; font-size: 1rem;
opacity: 0.6; opacity: 0.6;
font-weight: 600; font-weight: 600;
} }
.profile-bio { .profile-bio {
font-size: 1.05em; font-size: 1.05rem;
line-height: 1.5; line-height: 1.5;
white-space: pre-wrap; white-space: pre-wrap;
background: rgba(255, 255, 255, 0.03); background: rgba(255, 255, 255, 0.03);
padding: 1em; padding: 1rem;
border-radius: 0.8em; border-radius: 0.8rem;
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
word-break: break-word; word-break: break-word;
} }
.profile-action-btn { .profile-action-btn {
align-self: flex-start; align-self: flex-start;
padding: 0.6em 1.5em; padding: 0.6rem 1.5rem;
font-weight: 700; font-weight: 700;
background: var(--text-color); background: var(--text-color);
color: var(--main-bg-color); color: var(--main-bg-color);
border-radius: 0.8em; border-radius: 0.8rem;
margin-top: 0.5em; margin-top: 0.5rem;
margin-left: 0; margin-left: 0;
height: auto; height: auto;
} }