feat(project): sync all pending tenant ui changes

This commit is contained in:
2026-02-20 16:50:20 +08:00
parent 937c9b4334
commit 788491ad3d
34 changed files with 7527 additions and 95 deletions

View File

@@ -163,16 +163,26 @@ const adjustCropperToAspectRatio = () => {
const containerWidthVal = containerWidth.value;
const containerHeightVal = containerHeight.value;
// 根据比例计算裁剪框尺寸
let newHeight: number, newWidth: number;
// 有固定比例时保留默认留白,避免初始裁剪框占满导致拖拽不便
const padding = Math.min(
CROPPER_CONSTANTS.MAX_PADDING,
Math.floor(containerWidthVal * CROPPER_CONSTANTS.PADDING_RATIO),
Math.floor(containerHeightVal * CROPPER_CONSTANTS.PADDING_RATIO),
);
const maxCropWidth = Math.max(
CROPPER_CONSTANTS.MIN_WIDTH,
containerWidthVal - padding * 2,
);
const maxCropHeight = Math.max(
CROPPER_CONSTANTS.MIN_HEIGHT,
containerHeightVal - padding * 2,
);
// 先按宽度优先计算
newWidth = containerWidthVal;
newHeight = newWidth / ratio;
// 如果高度超出容器,按高度优先计算
if (newHeight > containerHeightVal) {
newHeight = containerHeightVal;
// 根据比例在可用区域内计算裁剪框尺寸
let newWidth = maxCropWidth;
let newHeight = newWidth / ratio;
if (newHeight > maxCropHeight) {
newHeight = maxCropHeight;
newWidth = newHeight * ratio;
}