修改显示逻辑处理

v1.2.0
于肖磊 2025-02-26 19:00:51 +08:00
parent 8c1225c0a2
commit f452fdafe0
2 changed files with 5 additions and 5 deletions

View File

@ -587,7 +587,7 @@ const dragEndHandle = (new_val: any, index: number) => {
const { location: old_location, com_data, id: old_id } = cloneDeep(diy_data.value[index])
const { data_follow = {}, com_width, com_height, is_data_update } = com_data;
// xy
const { new_x, new_y } = new_location_handle(old_location, data_follow, new_val, 0, 0);
const { new_x, new_y } = new_location_handle(old_location, data_follow, new_val, 0, 0, true);
if (data_follow?.id == '') {
//
const index = diy_data.value.findIndex(item => old_id == item.com_data?.data_follow?.id);
@ -611,7 +611,7 @@ const resizingHandle = (new_location: any, key: string, index: number, type: str
const com_data = diy_data.value[index].com_data;
const { data_follow } = com_data;
// xy
const { new_x, new_y, new_w, new_h} = new_location_handle(old_location, data_follow, new_location, old_com_data.com_width, old_com_data.com_height);
const { new_x, new_y, new_w, new_h} = new_location_handle(old_location, data_follow, new_location, old_com_data.com_width, old_com_data.com_height, false);
if (data_follow.id == '') {
//
const index = diy_data.value.findIndex(item => old_id == item.com_data.data_follow.id);

View File

@ -891,7 +891,7 @@ type DataFollow = {
id: string;
type: string;
}
export const new_location_handle = (old_location: Location, data_follow: DataFollow, location: Location, com_width: number, com_height: number) => {
export const new_location_handle = (old_location: Location, data_follow: DataFollow, location: Location, com_width: number, com_height: number, is_show_message: boolean) => {
let new_x = old_location.x;
let new_y = old_location.y;
let new_w = com_width;
@ -900,13 +900,13 @@ export const new_location_handle = (old_location: Location, data_follow: DataFol
// 如果是跟随的模版,根据选中的内容 x或者y不变
if (data_follow.id != '') {
if (data_follow.type == 'left') {
if (old_location.x !== x) {
if (old_location.x !== x && is_show_message) {
is_show_message_warning('当前组件已经左跟随其他组件x轴不允许修改');
}
new_y = y;
new_h = location?.h || com_height;
} else if (data_follow.type == 'top') {
if (old_location.y !== y) {
if (old_location.y !== y && is_show_message) {
is_show_message_warning('当前组件已经上跟随其他组件y轴不允许修改');
}
new_x = x;