فهرست منبع

fix: ai导入特殊图例调整为正方形

bill 2 ماه پیش
والد
کامیت
0d1727d0aa
3فایلهای تغییر یافته به همراه18 افزوده شده و 10 حذف شده
  1. 7 7
      src/example/constant.ts
  2. 1 1
      src/example/platform/platform-draw.ts
  3. 10 2
      src/example/platform/platform-resource.ts

+ 7 - 7
src/example/constant.ts

@@ -5,18 +5,18 @@ export const iconGroups = [
       {
         name: "门",
         children: [
-          { icon: "cad-men", name: "门" },
-          { icon: "cad-shuangkaimen", name: "双开门" },
-          { icon: "cad-yimen", name: "移门" },
-          { icon: "cad-yakou", name: "哑口" },
+          { wall: true, icon: "cad-men", name: "门" },
+          { wall: true, icon: "cad-shuangkaimen", name: "双开门" },
+          { wall: true, icon: "cad-yimen", name: "移门" },
+          { wall: true, icon: "cad-yakou", name: "哑口" },
         ],
       },
       {
         name: "窗",
         children: [
-          { icon: "cad-chuang", name: "窗" },
-          { icon: "cad-piaochuang", name: "飘窗" },
-          { icon: "cad-luodichuang", name: "落地窗" },
+          { wall: true, icon: "cad-chuang", name: "窗" },
+          { wall: true, icon: "cad-piaochuang", name: "飘窗" },
+          { wall: true, icon: "cad-luodichuang", name: "落地窗" },
         ],
       },
       {

+ 1 - 1
src/example/platform/platform-draw.ts

@@ -318,7 +318,7 @@ const drawLayerResource = async (
             item.url,
             item.size?.width,
             item.size?.height,
-            item.fixed,
+            // item.fixed,
           );
         } catch {}
       }

+ 10 - 2
src/example/platform/platform-resource.ts

@@ -312,18 +312,20 @@ export const taggingGets = {
                 ? (aiIconMap as any)[shape.category]
                 : shape.category;
             let name = "";
+            let isWall = false
             for (const group of iconGroups) {
               for (const itemGroup of group.children) {
                 for (const item of itemGroup.children) {
                   if (item.icon === icon) {
                     name = item.name;
+                    isWall = 'wall' in item && item.wall
                   }
                 }
               }
             }
             const isTag = icon === "Tag";
             if (name || isTag) {
-              tags.push({
+              const item = {
                 isText: isTag,
                 position: pos,
                 url: isTag
@@ -333,7 +335,13 @@ export const taggingGets = {
                 pixel: true,
                 size,
                 subgroup,
-              } as any);
+              }
+              if (isWall) {
+                const wh = Math.max(item.size.width, item.size.height)
+                item.size.width = wh
+                item.size.height = wh
+              }
+              tags.push(item as any);
             } else {
               console.error("找不到ai家具", icon, name, pos);
             }