修改页面代码显示

v1.0.0
于肖磊 2024-08-16 18:12:17 +08:00
parent 748ff23ede
commit dbea7082f5
4 changed files with 2 additions and 100 deletions

View File

@ -34,84 +34,4 @@ interface react1 {
y: number;
width: number;
height: number;
}
// 文本的默认值
const text_com_data = {
com_width: 150,
com_height: 17,
staging_height: 17,
text_title: '文本',
data_source_id: '',
data_source_list: {},
text_link: {},
text_color: '#000',
text_weight: 'normal',
text_size: 12,
text_option: 'none',
text_location: 'left',
text_padding: {
padding: 0,
padding_top: 0,
padding_bottom: 0,
padding_left: 0,
padding_right: 0,
},
text_rotate: 0,
border_show: false,
border_color: '#FF5D5D',
border_style: 'solid',
border_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
},
border_size: 1,
com_bg: '',
bottom_up: true,
}
// 图片的默认值
const img_com_data = {
com_width: 50,
com_height: 50,
staging_height: 50,
img_src: [],
data_source_id: '',
data_source_list: {},
link: {},
img_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
},
img_width: 50,
img_height: 50,
img_rotate: 0,
border_show: false,
border_color: '#FF3F3F',
border_style: 'dashed',
border_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
},
border_size: 1,
bottom_up: true,
}
// 线条的默认值
const line_com_data = {
com_width: 306,
com_height: 11,
staging_height: 11,
line_settings: 'horizontal',
line_style: 'solid',
line_width: 306,
line_size: 1,
line_color: '#000',
bottom_up: true,
}

View File

@ -80,7 +80,8 @@
</template>
<script setup lang="ts">
import { cloneDeep, isEmpty } from 'lodash';
import { get_math, isRectangleIntersecting } from '@/utils';
import { get_math } from '@/utils';
import { text_com_data, img_com_data, line_com_data, isRectangleIntersecting } from "./index-default";
//
const app = getCurrentInstance();
//#region

View File

@ -75,8 +75,6 @@ const key = ref('');
const dragkey = ref('');
const right_update = (item: any) => {
console.log(item, '122545');
diy_data.value = item;
// id
key.value = Math.random().toString(36).substring(2);

View File

@ -232,21 +232,4 @@ export const location_compute = (size: number, location: number, container_size:
} else {
return location;
}
}
// 判断两个矩形是否有交集或者被包裹
export const isRectangleIntersecting = (rect1: react1, rect2: react1) => {
// 矩形的格式为 { x, y, width, height }
const { x: x1, y: y1, width: w1, height: h1 } = rect1;
const { x: x2, y: y2, width: w2, height: h2 } = rect2;
// 检查是否有交集
if ((x1 < x2 + w2 && x1 + w1 > x2) && (y1 < y2 + h2 && y1 + h1 > y2)) {
return true; // 有交集
}
// 检查是否一个包含另一个
if (x1 >= x2 && y1 >= y2 && x1 + w1 <= x2 + w2 && y1 + h1 <= y2 + h2) {
return true; // rect1完全包含rect2
}
return false; // 无交集
}