feat:【mall】diy editor 的 magic-cube-editor 优化

This commit is contained in:
YunaiV
2025-10-30 00:11:56 +08:00
parent cb9fc7ad3f
commit 38df83e281
2 changed files with 12 additions and 4 deletions

View File

@@ -241,7 +241,7 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => {
<IconifyIcon icon="ep:circle-close-filled" />
</div>
<span v-if="hotArea.width">
{{ `${hotArea.width}×${hotArea.height}`}}
{{ `${hotArea.width}×${hotArea.height}` }}
</span>
</div>
</table>
@@ -259,6 +259,11 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => {
text-align: center;
cursor: pointer;
border: 1px solid var(--el-border-color);
line-height: 1;
:deep(.iconify) {
display: inline-block;
}
&.active {
background: var(--el-color-primary-light-9);

View File

@@ -43,7 +43,6 @@ export function isContains(hotArea: Rect, point: Point): boolean {
);
}
// TODO @AIlinter 修复
/**
* 在两个坐标点中间,创建一个矩形
*
@@ -58,8 +57,12 @@ export function isContains(hotArea: Rect, point: Point): boolean {
*/
export function createRect(a: Point, b: Point): Rect {
// 计算矩形的范围
const [left, left2] = [a.x, b.x].sort();
const [top, top2] = [a.y, b.y].sort();
let [left, left2] = [a.x, b.x].sort();
left = left ?? 0;
left2 = left2 ?? 0;
let [top, top2] = [a.y, b.y].sort();
top = top ?? 0;
top2 = top2 ?? 0;
const right = left2 + 1;
const bottom = top2 + 1;
const height = bottom - top;