|
@@ -400,40 +400,51 @@ const dragStart = async (event: DragEvent | MouseEvent, item: any) => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
let data = null;
|
|
let data = null;
|
|
- if (item._id && !item.componentDatas) {
|
|
|
|
- let res: any = await getComponents(item._id);
|
|
|
|
- item.component = true;
|
|
|
|
- item.componentDatas = res.componentDatas;
|
|
|
|
- item.componentData = res.componentData;
|
|
|
|
- }
|
|
|
|
- if (!item.data && !item.component && item.image) {
|
|
|
|
- let target: any = event.target;
|
|
|
|
- target.children[0] && (target = target.children[0].children[0]);
|
|
|
|
- // firefox naturalWidth svg 图片 可能是 0
|
|
|
|
- const normalWidth = target.naturalWidth || target.width;
|
|
|
|
- const normalHeight = target.naturalHeight || target.height;
|
|
|
|
- const [name, lockedOnCombine] = isGif(item.image)
|
|
|
|
- ? ['gif', 0]
|
|
|
|
- : ['image', undefined];
|
|
|
|
-
|
|
|
|
|
|
+ if (item['3d']) {
|
|
data = {
|
|
data = {
|
|
- name,
|
|
|
|
- width: 100,
|
|
|
|
- height: 100 * (normalHeight / normalWidth),
|
|
|
|
- image: item.image,
|
|
|
|
- imageRatio: true,
|
|
|
|
- lockedOnCombine,
|
|
|
|
|
|
+ name: 'iframe',
|
|
|
|
+ width: 400,
|
|
|
|
+ height: 300,
|
|
|
|
+ externElement: true,
|
|
|
|
+ iframe: 'https://view3d.le5le.com/?id=' + (item._id || item.id),
|
|
};
|
|
};
|
|
- } else if (item.component) {
|
|
|
|
- if (item.componentData) {
|
|
|
|
- const pens = convertPen([item.componentData]);
|
|
|
|
- data = deepClone(pens);
|
|
|
|
- } else if (item.componentDatas) {
|
|
|
|
- data = deepClone(item.componentDatas);
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
- data = item.componentDatas || item.data;
|
|
|
|
|
|
+ if (item._id && !item.componentDatas) {
|
|
|
|
+ let res: any = await getComponents(item._id);
|
|
|
|
+ item.component = true;
|
|
|
|
+ item.componentDatas = res.componentDatas;
|
|
|
|
+ item.componentData = res.componentData;
|
|
|
|
+ }
|
|
|
|
+ if (!item.data && !item.component && item.image) {
|
|
|
|
+ let target: any = event.target;
|
|
|
|
+ target.children[0] && (target = target.children[0].children[0]);
|
|
|
|
+ // firefox naturalWidth svg 图片 可能是 0
|
|
|
|
+ const normalWidth = target.naturalWidth || target.width;
|
|
|
|
+ const normalHeight = target.naturalHeight || target.height;
|
|
|
|
+ const [name, lockedOnCombine] = isGif(item.image)
|
|
|
|
+ ? ['gif', 0]
|
|
|
|
+ : ['image', undefined];
|
|
|
|
+
|
|
|
|
+ data = {
|
|
|
|
+ name,
|
|
|
|
+ width: 100,
|
|
|
|
+ height: 100 * (normalHeight / normalWidth),
|
|
|
|
+ image: item.image,
|
|
|
|
+ imageRatio: true,
|
|
|
|
+ lockedOnCombine,
|
|
|
|
+ };
|
|
|
|
+ } else if (item.component) {
|
|
|
|
+ if (item.componentData) {
|
|
|
|
+ const pens = convertPen([item.componentData]);
|
|
|
|
+ data = deepClone(pens);
|
|
|
|
+ } else if (item.componentDatas) {
|
|
|
|
+ data = deepClone(item.componentDatas);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ data = item.componentDatas || item.data;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
if (event instanceof DragEvent) {
|
|
if (event instanceof DragEvent) {
|
|
meta2d.canvas.addCaches = [];
|
|
meta2d.canvas.addCaches = [];
|
|
event.dataTransfer?.setData('Meta2d', JSON.stringify(data));
|
|
event.dataTransfer?.setData('Meta2d', JSON.stringify(data));
|
|
@@ -561,6 +572,9 @@ const onChangeGroupPanel = async (val: string[]) => {
|
|
config
|
|
config
|
|
);
|
|
);
|
|
if (res?.list) {
|
|
if (res?.list) {
|
|
|
|
+ for (const item of res.list) {
|
|
|
|
+ item['3d'] = true;
|
|
|
|
+ }
|
|
item.list = res.list;
|
|
item.list = res.list;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -761,12 +775,9 @@ const onMenu = async (val: string) => {
|
|
|
|
|
|
const delComponet = async () => {
|
|
const delComponet = async () => {
|
|
const id = contextmenu.component._id || contextmenu.component.id;
|
|
const id = contextmenu.component._id || contextmenu.component.id;
|
|
- const ret = await axios.post(`/api/data/le5leV-components/delete`, {
|
|
|
|
|
|
+ await axios.post(`/api/data/le5leV-components/delete`, {
|
|
id,
|
|
id,
|
|
});
|
|
});
|
|
- if (!ret) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
|
|
// 前端:从源文件夹移出组件
|
|
// 前端:从源文件夹移出组件
|
|
contextmenu.group.list.forEach((item: any, index: number, arr: any[]) => {
|
|
contextmenu.group.list.forEach((item: any, index: number, arr: any[]) => {
|