fix aspect ratio and cropping on small screens
This commit is contained in:
parent
cc41f25277
commit
19c3dbb42d
4 changed files with 90 additions and 80 deletions
|
|
@ -1452,14 +1452,6 @@ function logout() {
|
|||
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;
|
||||
|
||||
async function openProfile(accountId) {
|
||||
|
|
@ -2863,7 +2855,7 @@ async function gotoSettings(tab = 'account') {
|
|||
function switchSettingsTab(tabName) {
|
||||
setActiveRoombarItem('tab-settings-' + tabName);
|
||||
if (tabName === 'account') {
|
||||
switchRoomContent("title.account", accountSettings, false);
|
||||
switchRoomContent("title.account", accountSettings, false, null, true); //skip mobile slide
|
||||
} else if (tabName === 'profile') {
|
||||
switchRoomContent("title.profile", profileSettings, false);
|
||||
setTimeout(async () => {
|
||||
|
|
@ -3037,8 +3029,13 @@ function initCropper() {
|
|||
let targetWidth = cropperType === 'avatar' ? 512 : 494;
|
||||
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;
|
||||
container.style.height = (containerWidth * (targetHeight / targetWidth)) + 'px';
|
||||
|
||||
let imgWidth = cropperImageObj.width;
|
||||
let imgHeight = cropperImageObj.height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue