Alsmile 1 anno fa
parent
commit
ded1181e80

+ 2 - 2
src/services/defaults.ts

@@ -2106,6 +2106,6 @@ export const cases: any[] = [
 ];
 
 export const templates: any[] = [
-  { name: '科技蓝', list: [] },
-  { name: '简约', list: [] },
+  { name: '主题', list: [] },
+  { name: '布局', list: [] },
 ];

+ 1 - 1
src/views/components/ElementTree.vue

@@ -322,7 +322,7 @@ onBeforeUnmount(() => {
 
   inTreePanel.timer = setTimeout(() => {
     inTreePanel.value = false;
-  }, 1000);
+  }, 500);
 });
 </script>
 <style lang="postcss" scoped>

+ 7 - 5
src/views/components/Graphics.vue

@@ -536,18 +536,19 @@ const dragStart = async (event: DragEvent | MouseEvent, item: any) => {
     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 width = target.naturalWidth || target.width;
+    const height = target.naturalHeight || target.height;
     const [name, lockedOnCombine] = isGif(item.image)
       ? ['gif', 0]
       : ['image', undefined];
 
     data = {
       name,
-      width: 100,
-      height: 100 * (normalHeight / normalWidth),
+      width,
+      height,
       image: item.image,
       imageRatio: true,
+      ratio: true,
       lockedOnCombine,
     };
   } else {
@@ -590,6 +591,7 @@ const open = async (item: any) => {
     return;
   }
 
+  sessionStorage.setItem('opening', '1');
   router.push({
     path: '/',
     query: {
@@ -600,9 +602,9 @@ const open = async (item: any) => {
   for (const k of delAttrs) {
     delete ret[k];
   }
-
   autoSave();
   meta2d.open(ret);
+  meta2d.fitView();
 };
 
 const getPrivateGraphics = async () => {

+ 2 - 1
src/views/components/View.vue

@@ -857,9 +857,10 @@ const open = async (flag: boolean = false) => {
     if (data) {
       meta2d.open(JSON.parse(data));
     }
-  } else {
+  } else if (!sessionStorage.getItem('opening')) {
     meta2d.open({ name: '新建项目', pens: [] } as any);
   }
+  sessionStorage.removeItem('opening');
   !meta2d.store.data.x && (meta2d.store.data.x = meta2d.store.options.x || 0);
   !meta2d.store.data.y && (meta2d.store.data.y = meta2d.store.options.y || 0);
 };